Skip to content

aioble/security: Control order of bond database and allow limiting of the number of pairs. #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

andrewleech
Copy link
Contributor

@andrewleech andrewleech commented Sep 23, 2021

Requires: micropython/micropython#7845

In my application, we have a stm327f765 chip running micropython, with a build of the official nimble uart/hci application running on a separate nrf52810 (https://github.com/apache/mynewt-nimble/tree/master/apps/blehci)

We use this with aioble and paring/bonding.

It's been found that this nimble hci radio only has buffer/storage for 4 RPA / IRK addressing lookups, so if you've got more devices than this stored in the pairing/bonding database, any new devices that come along and try to pair/bond seem to work initially, but upon disconnect/reconnect the pairing details are lost.
Also, if you've got more devices than this stored in the bond database, with the current inplementation of aioble the fact these are stored in a dict/json file means the order is not strictly controlled, so you can't know for certain which devices keys will be loaded first/last into the radio - which ever ones don't fit can fail to connect correctly.

This PR aims to control the order of keys to maintain knowledge of newest / oldest keys.

A limit on the number of peers can be configured eg. aioble.security.limit_peers = 3
In this case, only the newest 3 peers will be loaded into the radio at startup.
If a new peer tries to pair/bond and this limit has already been reached, the oldest device in the database will be dropped / unpaired to make space for the new one.

jimmo and others added 2 commits July 23, 2021 15:13
@andrewleech andrewleech changed the title aioble/security: Control order of bond database and allow limiting of the number of pairs. Draft: aioble/security: Control order of bond database and allow limiting of the number of pairs. Sep 23, 2021
@andrewleech andrewleech changed the title Draft: aioble/security: Control order of bond database and allow limiting of the number of pairs. aioble/security: Control order of bond database and allow limiting of the number of pairs. Sep 28, 2021
@andrewleech andrewleech force-pushed the pairing_limits branch 3 times, most recently from 84926f0 to bc3f4cf Compare October 11, 2021 03:09
@andrewleech
Copy link
Contributor Author

This PR has been split out into separate ones for each feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants