-
Notifications
You must be signed in to change notification settings - Fork 1.4k
samples: bluetooth: Set CONFIG_BT_SMP_SC_PAIR_ONLY=n when needed #24009
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
base: main
Are you sure you want to change the base?
samples: bluetooth: Set CONFIG_BT_SMP_SC_PAIR_ONLY=n when needed #24009
Conversation
Thank you for your contribution! Note: This comment is automatically posted and updated by the Contribs GitHub Action. |
5770da1
to
e2d9deb
Compare
LE legacy pairing is no longer enabled by default. A few more samples that use it, need to disable the BT_SMP_SC_PAIR_ONLY Kconfig option. See Zephyr PR 73217.
e2d9deb
to
9d8e069
Compare
@@ -8,6 +8,7 @@ CONFIG_NCS_SAMPLES_DEFAULTS=y | |||
CONFIG_BT=y | |||
CONFIG_BT_CENTRAL=y | |||
CONFIG_BT_SMP=y | |||
CONFIG_BT_SMP_SC_PAIR_ONLY=n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why the option was enabled:
Support for Bluetooth LE legacy pairing is no longer enabled by default, because it is not secure.
Using Bluetooth LE legacy pairing introduces, among others, a risk of passive eavesdropping.
Supporting Bluetooth LE legacy pairing makes devices vulnerable to downgrade attacks.
The CONFIG_BT_SMP_SC_PAIR_ONLY Kconfig option is enabled by default in Zephyr.
If you still need to support the Bluetooth LE legacy pairing, you need to disable the option in the configuration.
You could accept the security risk and disable the CONFIG_BT_SMP_SC_PAIR_ONLY
option locally in your configuration, but I am worried that we should not keep it disabled in the sample (preferring security over interoperability).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial pairing failures that you replicate might be caused by the fact that pairing with devices that do not support secure connections pairing will not be supported if CONFIG_BT_SMP_SC_PAIR_ONLY
is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial pairing failures that you replicate might be caused by the fact that pairing with devices that do not support secure connections pairing will not be supported if
CONFIG_BT_SMP_SC_PAIR_ONLY
is enabled.
Correct. As a new commer, there was no clear indicator when I updated from 2.2 to 3.1.0 why my simple HID mouse would no longer pair suddenly. I wasted a week troubleshooting before I discovered randomly, a commit where this option was added to other bluetooth/central_* samples. Commit -> 2b1be2d
At the very least, this should be included but commented out with a note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was documented, but only in the release notes (as it was changed for NCS 3.0.0 release) - it might not be visible enough. Generally we discourage using BLE legacy pairing as it's not secure and most of the BLE devices already support BLE secure connection pairing (unfortunately it seems that still not all of the users' devices support it).
I will think how could we improve documentation to avoid confusing users (keeping in mind that this could affect multiple samples).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed with tech-writers. We can add a migration guide entry to improve visibility of the information.
@RobertDaleSmith Would this approach be acceptable for you?
I banged my head against this one for a week. 🫠
After erasing my board, the
central_hids
andcentral_uart
samples suddenly refused to pair successfully. I started my project on SDK v2.2 and had paired successfully once before with the board I was using. So I had a cached bond on my board prior to updating to v3.1.0 and restarting my project withcentral_hids
as the base. Everything worked fine until I decided to totally erase my board to fix a bootloader issue. After this I was plagued with the following error on my firmware and even these two basic samples I based my firmware on:After trying everything I could think of. I stumbled on this fix that was applied to some of the other samples:
Without this
CONFIG_BT_SMP_SC_PAIR_ONLY=n
I could not pair to a simple bluetooth mouse. But if i had paired/bonded with an older firmware on v2.2, then flashed these samples, it would pair no problem. It was only the initial bond without cached bonds or withoutCONFIG_BT_SMP_SC_PAIR_ONLY=n
set, that throws the reason 4 error log I posted above.I'm pushing this PR to save some other poor developer the same fate and because I actually tested/verified these two samples work with this config fix.