xref: /freebsd/usr.sbin/bluetooth/hcsecd/hcsecd.8 (revision 531c890b8aecbf157fe3491503b5ca62c0b01093)
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 a raw HCI socket and listens for
43.Dv Link_Key_Request ,
44.Dv PIN_Code_Request
45and
46.Dv Link_Key_Notification
47HCI events.
48.Pp
49Once a
50.Dv Link_Key_Request
51or
52.Dv PIN_Code_Request
53HCI event is received, the daemon scans the configuration file for a
54matching 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, the link key takes precedence over the PIN code.
60If a link key was not specified, the device must generate the link key from
61the PIN code.
62If an entry was found and the link key (or PIN code) exists, 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
77events and caches link keys created from the PIN codes in 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 it exists, the link keys file gets processed by the
84.Nm
85daemon after it processes its main configuration file.
86The link keys file gets written every time the
87.Nm
88daemon shuts down gracefully.
89It is possible to force the
90.Nm
91daemon to re-read its main configuration file and dump the link keys file by
92sending the
93.Dv HUP
94signal to the
95.Nm
96process.
97The user is expected to not modify the link keys file by hand.
98.Pp
99The command line options are as follows:
100.Bl -tag -width indent
101.It Fl d
102Do not detach from the controlling terminal.
103.It Fl f Ar configfile
104Specify the name of the configuration file.
105The default is
106.Pa /etc/bluetooth/hcsecd.conf .
107.It Fl h
108Display usage message and exit.
109.El
110.Sh FILES
111.Bl -tag -width ".Pa /etc/bluetooth/hcsecd.conf" -compact
112.It Pa /etc/bluetooth/hcsecd.conf
113.It Pa /var/db/hcsecd.keys
114.It Pa /var/run/hcsecd.pid
115.El
116.Sh SEE ALSO
117.Xr ng_btsocket 4 ,
118.Xr ng_hci 4 ,
119.Xr hcsecd.conf 5 ,
120.Xr hccontrol 8 ,
121.Xr hcseriald 8
122.Sh AUTHORS
123.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
124.Sh BUGS
125Currently there is no way to select the link key or the PIN code based on
126which local device received the request.
127Everything is based on the remote device BD_ADDR.
128An interface for external helpers to obtain link keys and PIN codes is missing.
129