sachineswar
Posts: 4
Joined: Mon Apr 17, 2017 8:20 pm

Bluetooth pairing using fixed PIN on bluez 5.

Tue Oct 10, 2017 7:16 pm

Hi All,

I am trying to connect 2 or more Raspberry Pi 3 boards over bluetooth. I am looking for options to set security while pairing. I am using Raspian-stretch(Latest one available). Bluez version available on RPI-3 is 5.23(as shown from bluetoothd -v command).

I am using headless version. I want the pairing to be secured(meaing there should be some kind of authentication i can set like PIN(4 digits) or Passkey(6 digits)) without the user logged into it. So if i have to connect my phone to the RPI, i dont have to login to RPI inorder to enter the PIN/Passkey.
Then i would like to set up bluetooth PAN network so that i can communicate to between devices connected to PAN network.

I want pair the device/s using a PIN which is available in a file in the system or somewhere i can point it to. Say for example, pin.txt file in /temp/ directory or by running an agent to set the PIN. I read from other posts that bluez5.x got rid of the bluetooth-agent which was used in earlier version of bluez to do the things i could acomplish.

Agents in bluetoothctl such as DisplayOnly, KeyboardDisplay,NoInputNoOutput, DisplayYesNo,KeyboardOnly,on either sets a dynamic passkey which has to be entered manually or confirmation the passkey or just lets any device to pair and connect without any authntication in case of NoInputNoOutput.

Here is the link which i found of this forum stating that the agent is no longer available:
viewtopic.php?t=133961
I also refers to some examples that shows pairing of devices but doesnt address what i am looking for.

There is no info available on manpage too.
https://manpages.debian.org/stretch/blu ... .1.en.html

Here is something i found about the commands but still not what i am looking for.
https://wiki.archlinux.org/index.php/Bluetooth

Any help or suggestion to get around this or links to documnets i could refer to is appreciated.

Thanks in advance.

User avatar
Douglas6
Posts: 4600
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth pairing using fixed PIN on bluez 5.

Tue Oct 10, 2017 7:45 pm

sachineswar wrote:
Tue Oct 10, 2017 7:16 pm

Here is the link which i found of this forum stating that the agent is no longer available:
viewtopic.php?t=133961
You seem to have misinterpreted that thread. In it, I stated that:
Bluez-simple-agent is renamed, to simple-agent
I even provided a link: https://github.com/pauloborges/bluez/bl ... mple-agent

sachineswar
Posts: 4
Joined: Mon Apr 17, 2017 8:20 pm

Re: Bluetooth pairing using fixed PIN on bluez 5.

Tue Oct 10, 2017 10:33 pm

Thanks for pointing it out and clarifying. I think i mis-interpreted the comment "Bluez-utils has been removed in the Bluez 5 package. Bluez-simple-agent is renamed, to simple-agent (I think) but bluetoothctl has been added for managing devices."

simple agent is not available by default. It had to be downloaded manually.

I came across another link while looking for the same. Below link provides steps to use it and the first steps is to get the source files.
https://unix.stackexchange.com/question ... r-security

This uses simple-agent you mentioned but this was not a part of bluez5 package.

User avatar
Douglas6
Posts: 4600
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth pairing using fixed PIN on bluez 5.

Tue Oct 10, 2017 11:11 pm

You can download all of the BlueZ 5 test scripts with

Code: Select all

sudo apt-get install bluez-test-scripts

sachineswar
Posts: 4
Joined: Mon Apr 17, 2017 8:20 pm

Re: Bluetooth pairing using fixed PIN on bluez 5.

Wed Oct 11, 2017 1:31 pm

Douglas6 wrote: You can download all of the BlueZ 5 test scripts with

Code: Select all

sudo apt-get install bluez-test-scripts
Thanks a lot Douglas. This is what i was looking for. Now i can look into configuring Bluetooth PAN with all the paired devices.

Return to “Advanced users”