.\" Copyright (c) 2001-2002 Maksim Yevmenkin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $Id: hcsecd.8,v 1.8 2003/09/08 18:54:20 max Exp $ .\" $FreeBSD$ .\" .Dd November 16, 2002 .Dt HCSECD 8 .Os .Sh NAME .Nm hcsecd .Nd control link keys and PIN codes for Bluetooth devices .Sh SYNOPSIS .Nm .Op Fl dh .Fl f Ar configfile .Sh DESCRIPTION The .Nm daemon controls link keys and PIN codes for Bluetooth devices. It opens raw HCI socket and listens for the .Dv Link_Key_Request , .Dv PIN_Code_Request and .Dv Link_Key_Notification HCI events. .Pp Once .Dv Link_Key_Request or .Dv PIN_Code_Request HCI event is received, the daemon will scan configuration file for matching entry. The remote device BD_ADDR is used as a key. If no matching entry was found, the default entry will be used. If no default entry was found then it is assumed that no link key and no PIN code exists. For any given entry, link key takes precedence over PIN code. If link key was not specified, it means device must generate link key from PIN code. If entry was found and the link key (or PIN code) exists then the .Dv Link_Key_Request_Reply (or .Dv PIN_Code_Request_Reply ) command will be sent back to the device. Otherwise, the .Dv Link_Key_Request_Negative_Reply (or .Dv PIN_Code_Request_Negative_Reply ) command will be sent back to the device. .Pp The .Nm daemon also handles HCI .Dv Link_Key_Notification event and caches link keys created from the PIN codes in the memory. To preserve link keys between restarts the .Nm daemon dumps link keys for all entries in the .Pa /var/db/hcsecd.keys link keys file. If exists, the link keys file gets processed by .Nm daemon after it processes its main configuration file. The link keys file gets written every time .Nm daemon is gracefully shutdown. It is possible to force .Nm daemon to re-read its main configuration file and dump link keys file by sending .Dv HUP signal to the .Nm process. User is not expected to modify link keys file by hand. .Pp The command line options are as follows: .Bl -tag -width indent .It Fl d Do not detach from the controlling terminal. .It Fl f Ar configfile Specify name of the configuration file. The default is .Pa /etc/bluetooth/hcsecd.conf . .It Fl h Display usage message and exit. .El .Sh BUGS Currently there is no way to select link key or PIN code based on which local device received the request. Everything is based on remote device BD_ADDR. Also might implement interface for external helpers to obtain link keys and PIN codes. .Sh FILES .Bl -tag -width ".Pa /etc/bluetooth/hcsecd.conf" -compact .It Pa /etc/bluetooth/hcsecd.conf .It Pa /var/db/hcsecd.keys .It Pa /var/run/hcsecd.pid .El .Sh SEE ALSO .Xr ng_btsocket 4 , .Xr ng_hci 4 , .Xr hcsecd.conf 5 , .Xr hccontrol 8 , .Xr hcseriald 8 .Sh AUTHORS .An Maksim Yevmenkin Aq m_evmenkin@yahoo.com