xref: /freebsd/usr.sbin/bluetooth/hcsecd/hcsecd.8 (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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.\"
27.Dd November 16, 2002
28.Dt HCSECD 8
29.Os
30.Sh NAME
31.Nm hcsecd
32.Nd control link keys and PIN codes for Bluetooth devices
33.Sh SYNOPSIS
34.Nm
35.Op Fl dh
36.Fl f Ar configfile
37.Sh DESCRIPTION
38The
39.Nm
40daemon controls link keys and PIN codes for Bluetooth devices.
41It opens a raw HCI socket and listens for
42.Dv Link_Key_Request ,
43.Dv PIN_Code_Request
44and
45.Dv Link_Key_Notification
46HCI events.
47.Pp
48Once a
49.Dv Link_Key_Request
50or
51.Dv PIN_Code_Request
52HCI event is received, the daemon scans the configuration file for a
53matching entry.
54The remote device BD_ADDR is used as a key.
55If no matching entry was found, the default entry will be used.
56If no default entry was found then it is assumed that no link key and no
57PIN code exists.
58For any given entry, the link key takes precedence over the PIN code.
59If a link key was not specified, the device must generate the link key from
60the PIN code.
61If an entry was found and the link key (or PIN code) exists, the
62.Dv Link_Key_Request_Reply
63(or
64.Dv PIN_Code_Request_Reply )
65command will be sent back to the device.
66Otherwise, the
67.Dv Link_Key_Request_Negative_Reply
68(or
69.Dv PIN_Code_Request_Negative_Reply )
70command will be sent back to the device.
71.Pp
72The
73.Nm
74daemon also handles HCI
75.Dv Link_Key_Notification
76events and caches link keys created from the PIN codes in memory.
77To preserve link keys between restarts the
78.Nm
79daemon dumps link keys for all entries in the
80.Pa /var/db/hcsecd.keys
81link keys file.
82If it exists, the link keys file gets processed by the
83.Nm
84daemon after it processes its main configuration file.
85The link keys file gets written every time the
86.Nm
87daemon shuts down gracefully.
88It is possible to force the
89.Nm
90daemon to re-read its main configuration file and dump the link keys file by
91sending the
92.Dv HUP
93signal to the
94.Nm
95process.
96The user is expected to not modify the 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 the 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.Sh AUTHORS
121.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
122.Sh BUGS
123Currently there is no way to select the link key or the PIN code based on
124which local device received the request.
125Everything is based on the remote device BD_ADDR.
126An interface for external helpers to obtain link keys and PIN codes is missing.
127