NetBSD/usr.sbin/bthcid/bthcid.8

184 lines
6.2 KiB
Groff

.\" $NetBSD: bthcid.8,v 1.1 2006/06/19 15:44:56 gdamore Exp $
.\"
.\" Copyright (c) 2006 Itronix Inc.
.\" 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.
.\" 3. The name of Itronix Inc. may not be used to endorse
.\" or promote products derived from this software without specific
.\" prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``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 ITRONIX INC. 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.
.\"
.\"
.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
.\" 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: bthcid.8,v 1.1 2006/06/19 15:44:56 gdamore Exp $
.\" $FreeBSD: src/usr.sbin/bluetooth/hcsecd/hcsecd.8,v 1.6 2006/02/11 15:36:37 markus Exp $
.\"
.Dd November 16, 2002
.Dt BTHCID 8
.Os
.Sh NAME
.Nm bthcid
.Nd Bluetooth Link Key/PIN Code Manager
.Sh SYNOPSIS
.Nm
.Op Fl fn
.Op Fl c Ar config_file
.Op Fl d Ar device
.Op Fl m Ar mode
.Op Fl s Ar socket_name
.Nm
.Op Fl h
.Sh DESCRIPTION
The
.Nm
daemon manages link keys and PIN codes for Bluetooth devices.
It opens a raw HCI socket and listens for the following HCI events at the
.Ar device
address given, if any.
.Pp
.Bl -tag -width XXXX -compact
.It Dv Link_Key_Request
.Nm
scans first the
.Pa /var/db/bthcid.keys
file for a cached link key matching the remote device BD_ADDR and, if
none is found, further scans the configuration file. When a link key
has been found, the
.Dv Link_Key_Request_Reply
will be sent back to the device, otherwise the
.Dv Link_Key_Request_Negative_Reply
will be sent.
.Pp
.It Dv Link_Key_Notification
When a new link key is created by the device, it will be cached for future
use in the
.Pa /var/db/bthcid.keys
link keys file, which will be created if it does not already exist.
.Pp
.It Dv PIN_Code_Request
The
.Nm
daemon first checks its cached PINs, then the configuration file
for a matching remote device entry.
When no PIN is found, the
.Nm
daemon will send a message to any PIN clients that have
registered, with the device details and a timeout value.
When no clients are available or the timeout has expired,
.Nm
will send a
.Dv PIN_Code_Request_Negative_Reply
back to the device.
When a PIN is found, or if a client responds within the timeout period, a
.Dv PIN_Code_Request_Reply
will be sent back to the device.
.Pp
PINs received from clients will be cached for 5 minutes, and may be added
to the cache prior to pairing with the
.Xr btpin 1
utility.
.El
.Pp
The command line options are as follows:
.Bl -tag -width XXXX
.It Fl c Ar config_file
Specify the name of the configuration file.
The default is
.Pa /etc/bluetooth/bluetooth.conf .
.It Fl d Ar device
Specify the local Bluetooth device address. The default is BDADDR_ANY.
.It Fl f
Run in foreground (do not detach).
.It Fl h
Display usage message and exit.
.It Fl m
Specify the file mode access bits for the PIN client socket. The
default is to allow readwrite access to user and group (0660).
.It Fl n
Do not listen for PIN clients.
.It Fl s Ar socket_name
Specify the socket name to listen on for PIN clients. The default path is
.Pa /var/run/bthcid .
.El
.Sh FILES
.Bl -tag -compact
.It Pa /etc/bluetooth/bluetooth.conf
.It Pa /var/db/bthcid.keys
.It Pa /var/run/bthcid
.It Pa /var/run/bthcid.pid
.El
.Sh SEE ALSO
.Xr bluetooth 4 ,
.Xr bluetooth.conf 5 ,
.Xr btconfig 8 ,
.Xr btpin 1
.Sh AUTHORS
.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com ,
.An Iain Hibbert
.Sh HISTORY
The
.Nm
daemon first appeared in
.Fx 5.3
as
.Ic hcsecd .
It was ported to
.Nx 4.0
with its present name and extended to support PIN clients by
.An Iain Hibbert
under the sponsorship of
.An Itronix, Inc.
.Sh BUGS
Currently there is no way to select the link key based on
which local device received the request.
.Pp
Everything is based on the remote device BD_ADDR.
.Pp
Currently the only way to make the
.Nm
daemon forget a link key is to edit the
.Pa /var/db/bthcid.keys
file by hand.