Blob


1 .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .\"
15 .Dd $Mdocdate: December 14 2021 $
16 .Dt KAMID.CONF 5
17 .Os
18 .Sh NAME
19 .Nm kamid.conf
20 .Nd 9p file server daemon configuration file
21 .Sh DESCRIPTION
22 .Nm
23 is the configuration file for the 9p file server daemon
24 .Xr kamid 8 .
25 .Pp
26 The format of the configuration file is fairly flexible.
27 The current line can be extended over multiple lines using a backslash
28 .Pq Sq \e .
29 Comments can be put anywhere in the file using a hash mark
30 .Pq Sq # ,
31 and extend to the end of the current line.
32 Care should be taken when commenting out multi-line text: the comment is
33 effective until the end of the entire block.
34 Arguments names not beginning with a letter, digit, or underscore, as
35 well as reserved words
36 (such as
37 .Ic listen ,
38 .Ic pki
39 and
40 .Ic table )
41 must be quoted.
42 Arguments containing whitespace should be surrounded by double quotes
43 .Pq \&" .
44 .Pp
45 Macros can be defined that are later expanded in context.
46 Macro names must start with a letter, digit, or underscore, and may
47 contain any of those characters, but may not be reserved words.
48 Macros are not expanded inside quotes.
49 For example:
50 .Bd -literal -offset indent
51 lan_addr = "192.168.0.1"
52 listen on $lan_addr
53 listen on $lan_addr tls auth <users>
54 .Ed
55 .Pp
56 Additional configuration files can be included with the
57 .Ic include
58 keyword, for example:
59 .Bd -literal -offset indent
60 include "/etc/kamid.conf.local"
61 .Ed
62 .Pp
63 The syntax of
64 .Nm
65 is described below.
66 .Bl -tag -width Ds
67 .It Ic listen Op Ar options...
68 The options are as follows:
69 .Bl -tag -width Ds
70 .It Ic on Ar address Ic port Ar number
71 Listen on the
72 .Ar address
73 for incoming connection on the given port
74 .Ar number .
75 .Ar address
76 can be an IP address or a domain name.
77 .It Ic tls Ic pki Ar name
78 Use the tls certificate
79 .Ar name
80 previously defined with the
81 .Ic pki
82 rule.
83 .It Ic auth Pf < Ar table Ns >
84 Use the given authentication
85 .Ar table
86 to authorize the clients.
87 .It Ic userdata Pf < Ar table Ns >
88 Maps user
89 .Pq virtuals or not
90 to their exported tree.
91 By default the user home directory obtained with
92 .Xr getpwnam 3
93 is used.
94 .It Ic virtual Pf < Ar table Ns >
95 Maps virtual users to local user.
96 .El
97 .It Ic pki Ar pkiname Ic cert Ar certfile
98 Associate certificate file
99 .Ar certfile
100 with pki entry
101 .Ar pkiname .
102 The pki entry defines a keypair configuration that can be referenced in
103 listener rules.
104 .It Ic pki Ar pkiname Ic key Ar keyfile
105 Associate the key located in
106 .Ar keyfile
107 with pki entry
108 .Ar pkiname .
109 .\" TODO: document the other syntax for the table
110 .It Ic table Ar name Brq Ar value Cm => Ar value Oo , Ar ... Oc
111 Tables provide additional configuration information for
112 .Xr kamid 8
113 in the form of key-value mappings.
114 .Pp
115 Declare a mapping table containing the given static
116 .Ar key Ns Pf - Ar value
117 pairs.
118 .El
119 .Sh EXAMPLES
120 A sample configuration file:
121 .Bd -literal -offset indent
122 pki localhost cert "/etc/ssl/localhost.crt"
123 pki localhost key "/etc/ssl/private/localhost.key"
125 table users { "SHA256:..." => "op" }
127 listen on localhost port 1337 tls pki localhost auth <users>
128 .Ed
129 .Sh SEE ALSO
130 .Xr kamictl 8 ,
131 .Xr kamid 8