1.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: hcsecd.8,v 1.8 2003/09/08 18:54:20 max Exp $ 26.\" $FreeBSD$ 27.\" 28.Dd November 16, 2002 29.Dt HCSECD 8 30.Os 31.Sh NAME 32.Nm hcsecd 33.Nd control link keys and PIN codes for Bluetooth devices 34.Sh SYNOPSIS 35.Nm 36.Op Fl dh 37.Fl f Ar configfile 38.Sh DESCRIPTION 39The 40.Nm 41daemon controls link keys and PIN codes for Bluetooth devices. 42It opens raw HCI socket and listens for the 43.Dv Link_Key_Request , 44.Dv PIN_Code_Request 45and 46.Dv Link_Key_Notification 47HCI events. 48.Pp 49Once 50.Dv Link_Key_Request 51or 52.Dv PIN_Code_Request 53HCI event is received, the daemon will 54scan configuration file for matching entry. 55The remote device BD_ADDR is used as a key. 56If no matching entry was found, the default entry will be used. 57If no default entry was found then it is assumed that no link key and no 58PIN code exists. 59For any given entry, link key takes precedence over PIN code. 60If link key was not specified, it means device must generate link key from 61PIN code. 62If entry was found and the link key (or PIN code) exists then the 63.Dv Link_Key_Request_Reply 64(or 65.Dv PIN_Code_Request_Reply ) 66command will be sent back to the device. 67Otherwise, the 68.Dv Link_Key_Request_Negative_Reply 69(or 70.Dv PIN_Code_Request_Negative_Reply ) 71command will be sent back to the device. 72.Pp 73The 74.Nm 75daemon also handles HCI 76.Dv Link_Key_Notification 77event and caches link keys created from the PIN codes in the memory. 78To preserve link keys between restarts the 79.Nm 80daemon dumps link keys for all entries in the 81.Pa /var/db/hcsecd.keys 82link keys file. 83If exists, the link keys file gets processed by 84.Nm 85daemon after it processes its main configuration file. 86The link keys file gets written every time 87.Nm 88daemon is gracefully shutdown. 89It is possible to force 90.Nm 91daemon to re-read its main configuration file and dump link keys file by sending 92.Dv HUP 93signal to the 94.Nm 95process. 96User is not expected to modify link keys file by hand. 97.Pp 98The command line options are as follows: 99.Bl -tag -width indent 100.It Fl d 101Do not detach from the controlling terminal. 102.It Fl f Ar configfile 103Specify name of the configuration file. 104The default is 105.Pa /etc/bluetooth/hcsecd.conf . 106.It Fl h 107Display usage message and exit. 108.El 109.Sh FILES 110.Bl -tag -width ".Pa /etc/bluetooth/hcsecd.conf" -compact 111.It Pa /etc/bluetooth/hcsecd.conf 112.It Pa /var/db/hcsecd.keys 113.It Pa /var/run/hcsecd.pid 114.El 115.Sh SEE ALSO 116.Xr ng_btsocket 4 , 117.Xr ng_hci 4 , 118.Xr hcsecd.conf 5 , 119.Xr hccontrol 8 , 120.Xr hcseriald 8 121.Sh AUTHORS 122.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com 123.Sh BUGS 124Currently there is no way to select link key or PIN code based on which local 125device received the request. 126Everything is based on remote device BD_ADDR. 127Also might implement interface for external helpers to obtain link keys and 128PIN codes. 129