Bluetooth security with password

Hi! I just installed BalenaSound on my rp4 and its great, however there is one thing I cannot figure out. I live next to a crowded street so I want to prevent someone passing by to connect to my speaker through bluetooth (wifi is WPA2 secured already). Is there anyway to set a password for Bluetooth and if not a method of disabling just bluetooth connectivity?

Thanks!

Hi there, it is possible to set a pairing pin, can you have a look at https://github.com/balenalabs/balena-sound/pull/51? If that doesn’t work for you, feel free to open an issue in the balenaSound repo and the engineers working on it can have a look. Thanks!

Thanks! will try that

I have the same problem but I do not understand how I can get this pin code in my balena configuration?

Hi there, could you please try adding DEFAULT_PIN_CODE environment variable to the bluetooth container with your PIN.

Apologies, that variable should be BLUETOOTH_PIN_CODE, also you will need to set BLUETOOTH_PAIRING_MODE=LEGACY, the documentation is here.

Sorry, but do you know where I can find the documentation so that I could understand how to integrate the “balena bluetooth block” into my system? I have a similar issue as Snelli, but I seem to be lacking on the understanding part.

From what little I understand is that this feature is not in the “vanilla” balenasound and I have to add something. I am willing to learn, I just don’t know where to start.

Thanks for your help.

Bluetooth is part of BalenaSound (first “Highlight” in readme). As ab77 pointed out you will have to add the environment variables in your balena cloud configuration.

I switched to LEGACY pairing mode, with custom pin e.g. 4321. My android phone asks for PIN on pairing but aborts with “incorrect pin” message.
On my windows 10 computer i can pair and connect by entering my custom pin. after that the device asks for another pin. If I enter my 4321 pin, it fails, however i tried with 0000 and that worked.

How come i need to enter two different pins?

As the documentation says, this LEGACY mode is no longer supported. Is there any developement to get bluetooth connection with pin for new Android (and iOS) devices.
I don’t want my neighbors to be able to pair to my device.

the bluetooth plugin for balena-sound should be enabled by default and is using the bluetooth block that was linked above if you installed the latest release

for more documentation see https://sound.balenalabs.io/docs/

Thanks for your answers. I did not understand that it was already included. I thought I needed to add something to get the “LEGACY” mode working.

As mentioned by heavy-matill, I did set the variables, I used a 6 number PIN and it did not work on my iPhone 7. I did not try a computer nor the 000000 PIN (I now realize I should have). Anyway, I always got a timeout error on my iPhone. (edit: BTW, the Bluetooth pairing worked great without the LEGACY + PIN variables… I just wanted an extra layer of security because my use-case is similar to Snellie’s)

After reading the documentation, I now understand it is not supported by iOS.

From the attached document (thanks @heavy-matill), it seems that out-of-band pairing method are still permitted. I understand it is probably not implemented, but that would work for me.

@robertgzr : I did install the latest version I could on my raspberry pi 3. I also tried both 32 and 64 bits version.

Anyway, thanks for your answer, I now have a better understanding why the bluetooth was not working and how the system works.

Hi everybody,
I’m having a similar problem with pincode security.

→ With no custom variables on my phones (Lineage OS) I get the message “pincode incorrect”, but I’m able to connect with my tablet (Standard Samsung Android).
→ When setting custom variables BLUETOOTH_PAIRING_MODE and BLUETOOTH_PIN_CODE I get the pincode-screen on my phones, yet after typing the correct pincode I still get the “pincode incorrect” message. My tablet won’t connect at all.

I’m on release 9189bce and the problem accured after changing from an older release (~mid 2021).

Can anybody give me a hint of what I can do?

Thanks in advance :slight_smile:

Hi @7d587eee5c, just to clarify, you were able to get legacy Bluetooth with PIN code working on your Lineage OS phone and Android tablet until you updated the balenaSound Bluetooth plugin in mid-2021?