-
Notifications
You must be signed in to change notification settings - Fork 3
/
kbfsd.5
232 lines (232 loc) · 5.21 KB
/
kbfsd.5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2021 Mateusz Piotrowski <0mp@FreeBSD.org>
.\"
.\" 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
.Dd July 22, 2021
.Dt KBFSD 5
.Os
.Sh NAME
.Nm kbfsd
.Nd service daemon for the Keybase filesystem (KBFS)
.Sh SYNOPSIS
Required
.Xr rc.conf 5
variables:
.Bd -literal -offset indent
kbfsd_enable="YES"
kbfsd_user="beastie"
.Ed
.Pp
Optional
.Xr rc.conf 5
variables:
.Bd -literal -offset indent
kbfsd_keybase_username="${kbfsd_user}"
kbfsd_mountpoint="/keybase"
.Ed
.Sh DESCRIPTION
.Nm
is an
.Xr rc 8
daemon for the Keybase filesystem (KBFS).
Its aim is to ease the process of using KBFS on
.Fx .
It takes care of the configuration the Keybase user would have to do manually
otherwise.
.Pp
.Nm
does not start automatically even when
.Va kbfsd_enable
is set to
.Ql YES
in
.Xr rc.conf 5 .
See the
.Sx CAVEATS
section for more details.
.Pp
.Nm
has to configure some bits of the system in order to mount KBFS as
.Va kbfsd_user .
.Va kbfsd_mountpoint
is created and
the
.Xr sysctl 8
tunable
.Va vfs.usermount
is set to
.Dq 1
so that
.Va kbfsd_user
could mount
.Va kbfsd_mountpoint .
Then
.Va kbfsd_user
is added to the
.Dq operator
group to be able to use the
.Pa /dev/fuse
device.
Finally,
.Nm
attempts to spin off the Keybase server and create required socket files.
Note that this step requires
.Va kbfsd_user
to be able to log in as
.Va kbfsd_keybase_username .
This should be possible once
.Va kbfsd_user
registers a device with
.Ql keybase device add .
.Pp
.Nm
may be controlled with the following
.Xr rc.conf 5
variables:
.Bl -tag -width kbfsd_keybase_username
.It Va kbfsd_enable
.Pq Vt bool , No default: Ql NO
Enable
.Nm .
.It Va kbfsd_keybase_username
.Pq Vt str , No default: Va kbfsd_user
The username used to log into Keybase.
.It Va kbfsd_mountpoint
.Pq Vt str , No default: Ql /keybase
The directory where KBFS should be mounted.
.It Va kbfsd_user
.Pq Vt str , No no defaults
The login name of a user, who should own
.Va kbfsd_mountpoint .
It cannot be empty.
.El
.Sh INSTALLATION
The easiest way is to just install the
.Nm
package via
.Xr pkg 8
on
.Fx :
.Bd -literal -offset indent
pkg install kbfsd
.Ed
.Pp
.Nm
can be installed manually with the following command:
.Bd -literal -offset indent
make all
make install
.Ed
.Sh FILES
.Bl -tag -width "/home/${kbfsd_user}/.config/keybase/kbfsd.${kbfsd_user}.pid" -compact
.Sm off
.It Pa /home/ No ${ Ar kbfsd_user No } Pa /.config/keybase/kbfsd\&. No ${ Ar kbfsd_user No } Pa ".pid"
.Sm on
PID file.
.El
.Sh EXIT STATUS
The
.Nm
daemon
exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr rc.conf 5 ,
.Xr mount 8 ,
.Xr rc 8
.Sh AUTHORS
The
.Nm
daemon and its manual page were written by
.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org .
.Sh CAVEATS
.Nm
is
.Em not
started automatically together with other daemons during boot because it uses
the
.Ql nostart
KEYWORD
.Pq see Xr rc 8 for details .
The reason is that in order to reliably mount KBFS the user has to establish
a session with the Keybase server first.
This is done by calling:
.Ql keybase login username
.Po where
.Ar username
is the same as
.Ar kbfsd_keybase_username
.Pc .
Unfortunately, this command happens to block the booting process from time to
time, which is unacceptable.
.Sh BUGS
.Nm
seems to kill
.Nm kbfsfuse
too rapidly for
.Nm kbfsfuse
to properly unmount.
As a workaround,
.Nm
calls
.Xr umount 8
on the mount point in the
.Em poststop
phase
.Pq see Xr rc.subr 8 .
.Pp
Currently,
.Nm
uses
.Va kbfsd_env
internally to set the
.Ev HOME
environmental variable to the home directory of
.Va kbfsd_user .
It is recommended to read the service file before setting
.Va kbfsd_env
in
.Xr rc.conf 5 .
.Pp
On some
.Fx
versions older than 13.0 the name of
.Xr fusefs 5
might be
.Dq fuse
instead of
.Dq fusefs .
As a result,
.Nm
might fail to start.
A potential workaronud is to set
.Va required_modules
to an empty string in
.Pa /usr/local/etc/rc.conf.d/kbfsd
and then loading the FUSE kernel module differently
.Po e.g., via
.Va kld_list
in
.Xr rc.conf 5
.Pc .