11a63eb31SJulian Elischer.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 21a63eb31SJulian Elischer.\" All rights reserved. 31a63eb31SJulian Elischer.\" 41a63eb31SJulian Elischer.\" Redistribution and use in source and binary forms, with or without 51a63eb31SJulian Elischer.\" modification, are permitted provided that the following conditions 61a63eb31SJulian Elischer.\" are met: 71a63eb31SJulian Elischer.\" 1. Redistributions of source code must retain the above copyright 81a63eb31SJulian Elischer.\" notice, this list of conditions and the following disclaimer. 91a63eb31SJulian Elischer.\" 2. Redistributions in binary form must reproduce the above copyright 101a63eb31SJulian Elischer.\" notice, this list of conditions and the following disclaimer in the 111a63eb31SJulian Elischer.\" documentation and/or other materials provided with the distribution. 121a63eb31SJulian Elischer.\" 131a63eb31SJulian Elischer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 141a63eb31SJulian Elischer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 151a63eb31SJulian Elischer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 161a63eb31SJulian Elischer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 171a63eb31SJulian Elischer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 181a63eb31SJulian Elischer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 191a63eb31SJulian Elischer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 201a63eb31SJulian Elischer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 211a63eb31SJulian Elischer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 221a63eb31SJulian Elischer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 231a63eb31SJulian Elischer.\" SUCH DAMAGE. 241a63eb31SJulian Elischer.\" 250986ab12SMaksim Yevmenkin.\" $Id: hcsecd.8,v 1.8 2003/09/08 18:54:20 max Exp $ 261a63eb31SJulian Elischer.\" $FreeBSD$ 2772f00208SRuslan Ermilov.\" 281a63eb31SJulian Elischer.Dd November 16, 2002 291a63eb31SJulian Elischer.Dt HCSECD 8 301a63eb31SJulian Elischer.Os 311a63eb31SJulian Elischer.Sh NAME 321a63eb31SJulian Elischer.Nm hcsecd 331a63eb31SJulian Elischer.Nd control link keys and PIN codes for Bluetooth devices 341a63eb31SJulian Elischer.Sh SYNOPSIS 351a63eb31SJulian Elischer.Nm 3672f00208SRuslan Ermilov.Op Fl dh 3772f00208SRuslan Ermilov.Fl f Ar configfile 381a63eb31SJulian Elischer.Sh DESCRIPTION 391a63eb31SJulian ElischerThe 401a63eb31SJulian Elischer.Nm 410986ab12SMaksim Yevmenkindaemon controls link keys and PIN codes for Bluetooth devices. 4272f00208SRuslan ErmilovIt opens raw HCI socket and listens for the 430986ab12SMaksim Yevmenkin.Dv Link_Key_Request , 441a63eb31SJulian Elischer.Dv PIN_Code_Request 450986ab12SMaksim Yevmenkinand 460986ab12SMaksim Yevmenkin.Dv Link_Key_Notification 4772f00208SRuslan ErmilovHCI events. 480986ab12SMaksim Yevmenkin.Pp 490986ab12SMaksim YevmenkinOnce 500986ab12SMaksim Yevmenkin.Dv Link_Key_Request 510986ab12SMaksim Yevmenkinor 520986ab12SMaksim Yevmenkin.Dv PIN_Code_Request 530986ab12SMaksim YevmenkinHCI event is received, the daemon will 5472f00208SRuslan Ermilovscan configuration file for matching entry. 550986ab12SMaksim YevmenkinThe remote device BD_ADDR is used as a key. 5672f00208SRuslan ErmilovIf no matching entry was found, the default entry will be used. 570986ab12SMaksim YevmenkinIf no default entry was found then it is assumed that no link key and no 580986ab12SMaksim YevmenkinPIN code exists. 5972f00208SRuslan ErmilovFor any given entry, link key takes precedence over PIN code. 6072f00208SRuslan ErmilovIf link key was not specified, it means device must generate link key from 6172f00208SRuslan ErmilovPIN code. 620986ab12SMaksim YevmenkinIf entry was found and the link key (or PIN code) exists then the 631a63eb31SJulian Elischer.Dv Link_Key_Request_Reply 641a63eb31SJulian Elischer(or 6572f00208SRuslan Ermilov.Dv PIN_Code_Request_Reply ) 6672f00208SRuslan Ermilovcommand will be sent back to the device. 6772f00208SRuslan ErmilovOtherwise, the 681a63eb31SJulian Elischer.Dv Link_Key_Request_Negative_Reply 691a63eb31SJulian Elischer(or 7072f00208SRuslan Ermilov.Dv PIN_Code_Request_Negative_Reply ) 7172f00208SRuslan Ermilovcommand will be sent back to the device. 721a63eb31SJulian Elischer.Pp 731a63eb31SJulian ElischerThe 741a63eb31SJulian Elischer.Nm 750986ab12SMaksim Yevmenkindaemon also handles HCI 761a63eb31SJulian Elischer.Dv Link_Key_Notification 770986ab12SMaksim Yevmenkinevent and caches link keys created from the PIN codes in the memory. 780986ab12SMaksim YevmenkinTo preserve link keys between restarts the 790986ab12SMaksim Yevmenkin.Nm 800986ab12SMaksim Yevmenkindaemon dumps link keys for all entries in the 810986ab12SMaksim Yevmenkin.Pa /var/db/hcsecd.keys 820986ab12SMaksim Yevmenkinlink keys file. 830986ab12SMaksim YevmenkinIf exists, the link keys file gets processed by 840986ab12SMaksim Yevmenkin.Nm 850986ab12SMaksim Yevmenkindaemon after it processes its main configuration file. 860986ab12SMaksim YevmenkinThe link keys file gets written every time 870986ab12SMaksim Yevmenkin.Nm 880986ab12SMaksim Yevmenkindaemon is gracefully shutdown. 890986ab12SMaksim YevmenkinIt is possible to force 900986ab12SMaksim Yevmenkin.Nm 910986ab12SMaksim Yevmenkindaemon to re-read its main configuration file and dump link keys file by sending 920986ab12SMaksim Yevmenkin.Dv HUP 930986ab12SMaksim Yevmenkinsignal to the 940986ab12SMaksim Yevmenkin.Nm 950986ab12SMaksim Yevmenkinprocess. 960986ab12SMaksim YevmenkinUser is not expected to modify link keys file by hand. 971a63eb31SJulian Elischer.Pp 981a63eb31SJulian ElischerThe command line options are as follows: 9972f00208SRuslan Ermilov.Bl -tag -width indent 1001a63eb31SJulian Elischer.It Fl d 1011a63eb31SJulian ElischerDo not detach from the controlling terminal. 10272f00208SRuslan Ermilov.It Fl f Ar configfile 10372f00208SRuslan ErmilovSpecify name of the configuration file. 10472f00208SRuslan ErmilovThe default is 1050986ab12SMaksim Yevmenkin.Pa /etc/bluetooth/hcsecd.conf . 1061a63eb31SJulian Elischer.It Fl h 1071a63eb31SJulian ElischerDisplay usage message and exit. 1081a63eb31SJulian Elischer.El 1091a63eb31SJulian Elischer.Sh BUGS 1101a63eb31SJulian ElischerCurrently there is no way to select link key or PIN code based on which local 11172f00208SRuslan Ermilovdevice received the request. 11272f00208SRuslan ErmilovEverything is based on remote device BD_ADDR. 1131a63eb31SJulian ElischerAlso might implement interface for external helpers to obtain link keys and 1141a63eb31SJulian ElischerPIN codes. 1151a63eb31SJulian Elischer.Sh FILES 1160986ab12SMaksim Yevmenkin.Bl -tag -width ".Pa /etc/bluetooth/hcsecd.conf" -compact 1170986ab12SMaksim Yevmenkin.It Pa /etc/bluetooth/hcsecd.conf 1180986ab12SMaksim Yevmenkin.It Pa /var/db/hcsecd.pid 1190986ab12SMaksim Yevmenkin.It Pa /var/run/hcsecd.keys 1201a63eb31SJulian Elischer.El 1211a63eb31SJulian Elischer.Sh SEE ALSO 1221a63eb31SJulian Elischer.Xr ng_btsocket 4 , 12372f00208SRuslan Ermilov.Xr ng_hci 4 , 1240986ab12SMaksim Yevmenkin.Xr hcsecd.conf 5 , 1251a63eb31SJulian Elischer.Xr hccontrol 8 , 1261a63eb31SJulian Elischer.Xr hcseriald 8 1271a63eb31SJulian Elischer.Sh AUTHORS 1281a63eb31SJulian Elischer.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com 129