Skip to contentSkip to conversation

implementing security mode 2 or 3

Bluez-users Marco Trudel 3 participants 12 messages Apr 26, 2005 – Apr 27, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Sorry for double-posting. I sent this email already but it seems it never reached the list...

Hello

I've two rfcomm service running on different channels. I wish to have one channel authenticated/encrypted, the other unathenticated(unencrypted).

As much as I know, that means that security mode 3 won't work, security mode 2 has to be used and I've to program this myself.

Does this mean that I've to request authentication/encryption on incoming connections? How can I do that using bluez?
Will this provide less security/encryption than using security mode 3?

regards
Marco

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#1 lore raw
Quoted 9 lines · Marco Trudel

I've two rfcomm service running on different channels. I wish to have one channel authenticated/encrypted, the other unathenticated(unencrypted).

As much as I know, that means that security mode 3 won't work, security mode 2 has to be used and I've to program this myself.

Does this mean that I've to request authentication/encryption on incoming connections?

Yes.

Quoted 1 line

How can I do that using bluez?

int opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; setsockopt(s, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

Quoted 1 line

Will this provide less security/encryption than using security mode 3?

No, but you will need a recent kernel. For older kernels it will simply not work, and IIRC the call even failed silently without reporting an error in one kernel version. Can't remember which one it was though. 2.6.8 or 9 maybe?

Fred

Signature · 13 lines
Fred Schaettgen
[email protected]


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users
#2 lore raw

Thank you, this works great with a 2.6.11 kernel. Unfortunately I'm bound to kernel 2.4.26 or 2.6.7. 2.4.26 doesn't work. It just let's remote devices connect... Do you know if 2.6.7 will?

If not, which part of the kernel has to be fixed? Is it a part of bluez? Can this encryption be reached in another way?

Where are the link keys saved? I'm unable to find them.

Is there something that has to be paid attention to if I do encryption like this? Does the password/Dongle/... influence the encryption strength?

regards
Marco

Quoted 23 lines · Fred Schaettgen
Quoted 9 lines · Marco Trudel

I've two rfcomm service running on different channels. I wish to have one channel authenticated/encrypted, the other unathenticated(unencrypted).

As much as I know, that means that security mode 3 won't work, security mode 2 has to be used and I've to program this myself.

Does this mean that I've to request authentication/encryption on incoming connections?

Yes.

Quoted 1 line

How can I do that using bluez?

int opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; setsockopt(s, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

Quoted 7 lines
Quoted 1 line

Will this provide less security/encryption than using security mode 3?

No, but you will need a recent kernel. For older kernels it will simply not work, and IIRC the call even failed silently without reporting an error in one kernel version. Can't remember which one it was though. 2.6.8 or 9 maybe?

Fred

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

maintainer
#3 lore raw

Hi Marco,

Quoted 4 lines

this works great with a 2.6.11 kernel. Unfortunately I'm bound to kernel 2.4.26 or 2.6.7. 2.4.26 doesn't work. It just let's remote devices connect... Do you know if 2.6.7 will?

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

It is inside the BlueZ core and the RFCOMM layer.

Quoted 1 line

Can this encryption be reached in another way?

In general yes. You must call the HCI functions, but it is impossible to call them at the correct time (after the SABM).

Quoted 1 line

Where are the link keys saved? I'm unable to find them.

Starting with bluez-utils-2.16 under /var/lib/bluetooth/*/linkkeys.

Quoted 2 lines

Is there something that has to be paid attention to if I do encryption like this? Does the password/Dongle/... influence the encryption strength?

The encryption key size is the only thing that may vary. For CSR chips it can be between 56 bits and 128 bits depending on the firmware.

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#4 lore raw

Hello Marcel

Quoted 14 lines · Marcel Holtmann

Hi Marco,

Quoted 4 lines

this works great with a 2.6.11 kernel. Unfortunately I'm bound to kernel 2.4.26 or 2.6.7. 2.4.26 doesn't work. It just let's remote devices connect... Do you know if 2.6.7 will?

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 4 lines
Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

It is inside the BlueZ core and the RFCOMM layer.

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

I assume it's easier to backport it to 2.6.7, if 2.4.26 is easier, please let me know.

Quoted 5 lines
Quoted 1 line

Can this encryption be reached in another way?

In general yes. You must call the HCI functions, but it is impossible to call them at the correct time (after the SABM).

ok. so backporting would be the best option.

Quoted 4 lines
Quoted 1 line

Where are the link keys saved? I'm unable to find them.

Starting with bluez-utils-2.16 under /var/lib/bluetooth/*/linkkeys.

found them, thank you.

Quoted 5 lines
Quoted 1 line

Is there something that has to be paid attention to if I do encryption like this? Does the password/Dongle/... influence the encryption strength?

The encryption key size is the only thing that may vary. For CSR chips it can be between 56 bits and 128 bits depending on the firmware.

ok. thank you.

regards
Marco

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

maintainer
#5 lore raw

Hi Marco,

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

this works great with a 2.6.11 kernel. Unfortunately I'm bound to kernel 2.4.26 or 2.6.7. 2.4.26 doesn't work. It just let's remote devices connect... Do you know if 2.6.7 will?

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

It is inside the BlueZ core and the RFCOMM layer.

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

tell me what interfaces are you going to use. Is it always USB? What kernel layers are involved? RFCOMM, BNEP, CMTP, HIDP?

You will need more than this two patches for a 2.6.7 based kernel, because there are some serious problems, too.

Quoted 2 lines

I assume it's easier to backport it to 2.6.7, if 2.4.26 is easier, please let me know.

The 2.6.7 backport will be end up in selecting patches and fixes small things, while for 2.4.26 you need to rewrite most of the patches.

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#6 lore raw
Quoted 17 lines · Marcel Holtmann

Hi Marco,

Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

this works great with a 2.6.11 kernel. Unfortunately I'm bound to kernel 2.4.26 or 2.6.7. 2.4.26 doesn't work. It just let's remote devices connect... Do you know if 2.6.7 will?

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It is inside the BlueZ core and the RFCOMM layer.

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

tell me what interfaces are you going to use. Is it always USB? What kernel layers are involved? RFCOMM, BNEP, CMTP, HIDP?

always USB. RFCOMM services.

authentication/encryption enabled as suggested on the list:
int opt = RFCOMM_LM_AUTH|RFCOMM_LM_ENCRYPT; setsockopt(sock, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

Quoted 2 lines

You will need more than this two patches for a 2.6.7 based kernel, because there are some serious problems, too.

actually I never run into problems with the 2.4 kernel. But I think it would definitely make sense to have this things fixed too...

Quoted 5 lines
Quoted 1 line

I assume it's easier to backport it to 2.6.7, if 2.4.26 is easier, please let me know.

The 2.6.7 backport will be end up in selecting patches and fixes small things, while for 2.4.26 you need to rewrite most of the patches.

ok, so it's 2.6.7...

regards
Marco

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

maintainer
#7 lore raw

Hi Marco,

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

It is inside the BlueZ core and the RFCOMM layer.

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

Quoted 8 lines
Quoted 2 lines

tell me what interfaces are you going to use. Is it always USB? What kernel layers are involved? RFCOMM, BNEP, CMTP, HIDP?

always USB. RFCOMM services.

authentication/encryption enabled as suggested on the list:

    int opt = RFCOMM_LM_AUTH|RFCOMM_LM_ENCRYPT;
    setsockopt(sock, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

this means HCI, L2CAP, RFCOMM and hci_usb driver updates up to 2.6.12-rc2 should be included.

Quoted 5 lines
Quoted 2 lines

You will need more than this two patches for a 2.6.7 based kernel, because there are some serious problems, too.

actually I never run into problems with the 2.4 kernel. But I think it would definitely make sense to have this things fixed too...

Some of them were hard to trigger and there is still one RFCOMM thing that is unresolved. Btw do you need a SMP or HT kernel?

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#8 lore raw
Quoted 20 lines · Marcel Holtmann

Hi Marco,

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

It is inside the BlueZ core and the RFCOMM layer.

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

tell me what interfaces are you going to use. Is it always USB? What kernel layers are involved? RFCOMM, BNEP, CMTP, HIDP?

always USB. RFCOMM services.

Quoted 7 lines
Quoted 3 lines

authentication/encryption enabled as suggested on the list:

   int opt = RFCOMM_LM_AUTH|RFCOMM_LM_ENCRYPT;
   setsockopt(sock, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

this means HCI, L2CAP, RFCOMM and hci_usb driver updates up to 2.6.12-rc2 should be included.

sounds reasonable...

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You will need more than this two patches for a 2.6.7 based kernel, because there are some serious problems, too.

actually I never run into problems with the 2.4 kernel. But I think it would definitely make sense to have this things fixed too...

Some of them were hard to trigger and there is still one RFCOMM thing that is unresolved. Btw do you need a SMP or HT kernel?

No. I don't think so.
I work with an arm SBC with one processor and a very minimal redhat. not much fancy stuff...

regards
Marco

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#9 lore raw

Hello Marcel

what's the state? interested in doing that?

regards
Marco

Quoted 57 lines · Marco Trudel
Quoted 24 lines · Marcel Holtmann

Hi Marco,

Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

the 2.6.7 will fail. The needed security hooks are introduced with 2.6.10 and the RFCOMM service level security with 2.6.11 according to my patch logs.

Quoted 1 line

If not, which part of the kernel has to be fixed? Is it a part of bluez?

It is inside the BlueZ core and the RFCOMM layer.

Quoted 6 lines
Quoted 2 lines

How long would you have to backport that to kernel 2.6.7? Maybe we can arrainge something with a donation...

tell me what interfaces are you going to use. Is it always USB? What kernel layers are involved? RFCOMM, BNEP, CMTP, HIDP?

always USB. RFCOMM services.

Quoted 8 lines
Quoted 3 lines

authentication/encryption enabled as suggested on the list:

   int opt = RFCOMM_LM_AUTH|RFCOMM_LM_ENCRYPT;
   setsockopt(sock, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));

this means HCI, L2CAP, RFCOMM and hci_usb driver updates up to 2.6.12-rc2 should be included.

sounds reasonable...

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

You will need more than this two patches for a 2.6.7 based kernel, because there are some serious problems, too.

actually I never run into problems with the 2.4 kernel. But I think it would definitely make sense to have this things fixed too...

Some of them were hard to trigger and there is still one RFCOMM thing that is unresolved. Btw do you need a SMP or HT kernel?

No. I don't think so.
I work with an arm SBC with one processor and a very minimal redhat. not much fancy stuff...

regards
Marco

Quoted 11 lines

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

maintainer
#10 lore raw

Hi Marco,

Quoted 1 line

what's the state? interested in doing that?

I am away until the weekend, but I am taking my patches with me and put them together when I have some idle time.

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#11 lore raw

great, thank you.
just contact me when it's done...

regards
Marco

Quoted 16 lines · Marcel Holtmann

Hi Marco,

Quoted 1 line

what's the state? interested in doing that?

I am away until the weekend, but I am taking my patches with me and put them together when I have some idle time.

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users