chiark / gitweb /
server/tests.at: Whitespace fixing.
[tripe] / server / tripe.8.in
1 .\" -*-nroff-*-
2 .\".
3 .\" Manual for the server
4 .\"
5 .\" (c) 2008 Straylight/Edgeware
6 .\"
7 .
8 .\"----- Licensing notice ---------------------------------------------------
9 .\"
10 .\" This file is part of Trivial IP Encryption (TrIPE).
11 .\"
12 .\" TrIPE is free software; you can redistribute it and/or modify
13 .\" it under the terms of the GNU General Public License as published by
14 .\" the Free Software Foundation; either version 2 of the License, or
15 .\" (at your option) any later version.
16 .\"
17 .\" TrIPE is distributed in the hope that it will be useful,
18 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 .\" GNU General Public License for more details.
21 .\"
22 .\" You should have received a copy of the GNU General Public License
23 .\" along with TrIPE; if not, write to the Free Software Foundation,
24 .\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 .
26 .\"--------------------------------------------------------------------------
27 .so ../common/defs.man \" @@@PRE@@@
28 .
29 .\"--------------------------------------------------------------------------
30 .TH tripe 8 "10 February 2001" "Straylight/Edgeware" "TrIPE: Trivial IP Encryption"
31 .
32 .\"--------------------------------------------------------------------------
33 .SH "NAME"
34 .
35 tripe \- a simple VPN daemon
36 .
37 .\"--------------------------------------------------------------------------
38 .SH "SYNOPSIS"
39 .
40 .B tripe
41 .RB [ \-DF ]
42 .RB [ \-d
43 .IR dir ]
44 .RB [ \-b
45 .IR addr ]
46 .RB [ \-p
47 .IR port ]
48 .RB [ \-n
49 .IR tunnel ]
50 .br
51         \c
52 .RB [ \-U
53 .IR user ]
54 .RB [ \-G
55 .IR group ]
56 .RB [ \-a
57 .IR socket ]
58 .RB [ \-T
59 .IR trace-opts ]
60 .br
61         \c
62 .RB [ \-k
63 .IR priv-keyring ]
64 .RB [ \-K
65 .IR pub-keyring ]
66 .RB [ \-t
67 .IR key-tag ]
68 .
69 .\"--------------------------------------------------------------------------
70 .SH "DESCRIPTION"
71 .
72 The
73 .B tripe
74 program is a server which can provide strong IP-level encryption and
75 authentication between co-operating hosts.  The program and its protocol
76 are deliberately very simple, to make analysing them easy and to help
77 build trust rapidly in the system.
78 .SS "Overview"
79 The
80 .B tripe
81 server manages a number of secure connections to other `peer' hosts.
82 Each daemon is given a private key of its own, and a file of public keys
83 for the peers with which it is meant to communicate.  It is responsible
84 for negotiating sets of symmetric keys with its peers, and for
85 encrypting, encapsulating and sending IP packets to its peers, and
86 decrypting, checking and de-encapsulating packets it receives from
87 them.
88 .PP
89 When the server starts, it creates a Unix-domain socket on which it
90 listens for administration commands.  It also logs warnings and
91 diagnostic information to the programs connected to its admin socket.
92 Clients connected to the socket can add new peers, and remove or find
93 out about existing peers.  The textual protocol used to give the
94 .B tripe
95 server admin commands is described in
96 .BR tripe\-admin (5).
97 A client program
98 .BR tripectl (1)
99 is provided to allow commands to be sent to the server either
100 interactively or by simple scripts.
101 .SS "Command-line arguments"
102 If not given any command-line arguments,
103 .B tripe
104 will initialize by following these steps:
105 .hP 1.
106 It sets the directory named by the
107 .B TRIPEDIR
108 environment variable (or
109 .B "\*(/c"
110 if the variable is unset) as the current directory.
111 .hP 2.
112 It acquires a UDP socket with an arbitrary kernel-selected port number.
113 It will use this socket to send and receive all communications with its
114 peer servers.  The port chosen may be discovered by means of the
115 .B PORT
116 admin command (see
117 .BR tripe\-admin (5)).
118 .hP 3.
119 It loads the private key with the tag or type name
120 .B tripe
121 (or, failing that,
122 .B tripe\-dh
123 for backwards compatibility reasons) from the Catacomb-format file
124 .BR keyring ,
125 and loads the file
126 .B keyring.pub
127 ready for extracting the public keys of peers as they're introduced.
128 (The format of these files is described in
129 .BR keyring (5).
130 They are maintained using the program
131 .BR key (1)
132 provided with the Catacomb distribution.)
133 .hP 4.
134 It creates and listens to the Unix-domain socket
135 .BR tripesock .
136 .PP
137 Following this, the server enters its main loop, accepting admin
138 connections and obeying any administrative commands, and communicating
139 with peers.  It also treats its standard input and standard output
140 streams as an admin connection, reading commands from standard input and
141 writing responses and diagnostics messages to standard output.  Finally,
142 it will reload keys from its keyring files if it notices that they've
143 changed (it checks inode number and modification time) \- there's no
144 need to send a signal.
145 .PP
146 Much of this behaviour may be altered by giving
147 .B tripe
148 suitable command-line options:
149 .TP
150 .B "\-h, \-\-help"
151 Writes a brief description of the command-line options available to
152 standard output and exits with status 0.
153 .TP
154 .B "\-v, \-\-version"
155 Writes
156 .BR tripe 's
157 version number to standard output and exits with status 0.
158 .TP
159 .B "\-u, \-\-usage"
160 Writes a brief usage summary to standard output and exits with status 0.
161 .TP
162 .B "\-\-tunnels"
163 Writes to standard output a list of the configured tunnel drivers, one
164 per line, and exits with status 0.  This is intended for the use of the
165 start-up script, so that it can check that it will actually work.
166 .TP
167 .B "\-D, \-\-daemon"
168 Dissociates from its terminal and starts running in the background after
169 completing the initialization procedure described above.  If running as
170 a daemon,
171 .B tripe
172 will not read commands from standard input or write diagnostics to
173 standard output.  A better way to start
174 .B tripe
175 in the background is with
176 .BR tripectl (1).
177 .TP
178 .B "\-F, \-\-foreground"
179 Runs the server in the `foreground'; i.e.,
180 .B tripe
181 will quit if it sees end-of-file on its standard input.  This is
182 incompatible with
183 .BR \-D .
184 .TP
185 .BI "\-d, \-\-directory=" dir
186 Makes
187 .I dir
188 the current directory.  The default directory to change to is given by
189 the environment variable
190 .BR TRIPEDIR ;
191 if that's not specified, a default default of
192 .B "\*(/c"
193 is used.  Give a current directory of
194 .B .
195 if you don't want it to change directory at all.
196 .TP
197 .BI "\-b, \-\-bind-address="addr
198 Bind the UDP socket to IP address
199 .I addr
200 rather than the default of
201 .BR INADDR_ANY .
202 This is useful if your main globally-routable IP address is one you want
203 to tunnel through the VPN.
204 .TP
205 .BI "\-p, \-\-port=" port
206 Use the specified UDP port for all communications with peers, rather
207 than an arbitarary kernel-assigned port.
208 .TP
209 .BI "\-n, \-\-tunnel=" tunnel
210 Use the specified tunnel driver for new peers by default.
211 .TP
212 .BI "\-U, \-\-setuid=" user
213 Set uid to that of
214 .I user
215 (either a user name or integer uid) after initialization.  Also set gid
216 to
217 .IR user 's
218 primary group, unless overridden by a
219 .B \-G
220 option.  The selected user (and group) will also be the owner of the
221 administration socket.
222 .TP
223 .BI "\-G, \-\-setgid=" group
224 Set gid to that of
225 .I group
226 (either a group name or integer gid) after initialization.
227 .TP
228 .BI "\-k, \-\-priv\-keyring=" file
229 Reads the private key from
230 .I file
231 rather than the default
232 .BR keyring .
233 .TP
234 .BI "\-K, \-\-pub\-keyring=" file
235 Reads public keys from
236 .I file
237 rather than the default
238 .BR keyring.pub .
239 This can be the same as the private keyring, but that's not recommended.
240 .TP
241 .BI "\-t, \-\-tag=" tag
242 Uses the private key whose tag or type is
243 .I tag
244 rather than the default
245 .B tripe
246 or
247 .BR tripe\-dh .
248 .TP
249 .BI "\-a, \-\-admin\-socket=" socket
250 Accept admin connections to a Unix-domain socket named
251 .IR socket .
252 The default socket, if this option isn't specified, is given by the
253 environment variable
254 .BR TRIPESOCK ;
255 if that's not set either, then a default default of
256 .B "\*(/s/tripesock"
257 is used instead.
258 .TP
259 .BI "\-T, \-\-trace=" trace-opts
260 Allows the enabling or disabling of various internal diagnostics.  See
261 below for the list of options.
262 .SS "Key exchange group types"
263 The
264 .B tripe
265 server uses Diffie\(en\&Hellman key exchange to agree the symmetric keys
266 used for bulk data transfer.  Currently
267 .B tripe
268 can do Diffie\(en\&Hellman in two different kinds of cyclic groups:
269 .I "Schnorr groups"
270 (denoted
271 .BR dh )
272 and
273 .I "elliptic curve groups"
274 (denoted
275 .BR ec ).
276 .PP
277 A Schnorr group is a prime-order subgroup of the multiplicative group of
278 a finite field; this is the usual
279 .I g\*(ssx\*(se
280 mod
281 .I p
282 kind of Diffie\(en\&Hellman.  An elliptic curve group is a prime-order
283 subgroup of the abelian group of
284 .BR K -rational
285 points on an elliptic curve defined over a finite field
286 .BR K .
287 .PP
288 Given current public knowledge, elliptic curves can provide similar or
289 better security to systems based on integer discrete log problems,
290 faster, and with less transmitted data.  It's a matter of controversy
291 whether this will continue to be the case.  The author uses elliptic
292 curves.
293 .PP
294 The server works out which it should be doing based on the key's
295 .B kx-group
296 attribute, which should be either
297 .B dh
298 or
299 .BR ec .
300 If this attribute isn't present, then the key's type is examined: if
301 it's of the form
302 .BR tripe\- group
303 then the
304 .I group
305 is used.  If no group is specified,
306 .B dh
307 is used as a fallback.
308 .PP
309 To create usual Schnorr-group keys, say something like
310 .VS
311 key add \-adh-param \-LS \-b3072 \-B256 \e
312         \-eforever \-tparam tripe\-param kx-group=dh
313 .VE
314 to construct a parameters key; and create the private keys by
315 .VS
316 key add \-adh \-pparam \-talice \e
317         \-e"now + 1 year" tripe
318 .VE
319 To create elliptic curve keys, say something like
320 .VS
321 key add \-aec\-param \-Cnist-p256 \-eforever \e
322         \-tparam tripe\-param kx-group=ec
323 .VE
324 to construct a parameters key, using your preferred elliptic curve in
325 the
326 .B \-C
327 option (see
328 .BR key (1)
329 for details); and create the private keys by
330 .VS
331 key add \-aec \-pparam \-talice \e
332         \-e"now + 1 year" tripe
333 .VE
334 Note that the
335 .BR tripe-keys (8)
336 program provides a rather more convenient means for generating and
337 managing keys for
338 .BR tripe .
339 .SS "Using other symmetric algorithms"
340 The default symmetric algorithms
341 .B tripe
342 uses are Blowfish (by Schneier) for symmetric encryption, and RIPEMD-160
343 (by Dobbertin, Bosselaers and Preneel) for hashing and as a MAC (in HMAC
344 mode, designed by Bellare, Canetti and Krawczyk).  These can all be
345 overridden by setting attributes on your private key, as follows.
346 .TP
347 .B cipher
348 Names the symmetric encryption scheme to use.  The default is
349 .BR blowfish\-cbc .
350 .TP
351 .B hash
352 Names the hash function to use.  The default is
353 .BR rmd160 .
354 .TP
355 .B mac
356 Names the message authentication code to use.  The name of the MAC may
357 be followed by a
358 .RB ` / '
359 and the desired tag length in bits.  The default is
360 .IB hash \-hmac
361 at half the underlying hash function's output length.
362 .TP
363 .B mgf
364 A `mask-generation function', used in the key-exchange.  The default is
365 .IB hash \-mgf
366 and there's no good reason to change it.
367 .SS "Using SLIP interfaces"
368 Though not for the faint of heart, it is possible to get
369 .B tripe
370 to read and write network packets to a pair of file descriptors using
371 SLIP encapsulation.  No fancy header compression of any kind is
372 supported.
373 .PP
374 Two usage modes are supported: a preallocation system, whereby SLIP
375 interfaces are created and passed to the
376 .B tripe
377 server at startup; and a dynamic system, where the server runs a script
378 to allocate a new SLIP interface when it needs one.  It is possible to
379 use a mixture of these two modes, starting
380 .B tripe
381 with a few preallocated interfaces and having it allocate more
382 dynamically as it needs them.
383 .PP
384 The behaviour of
385 .BR tripe 's
386 SLIP driver is controlled by the
387 .B TRIPE_SLIPIF
388 environment variable.  The server will not create SLIP tunnels if this
389 variable is not defined.  The variable's value is a colon-delimited list
390 of preallocated interfaces, followed optionally by the filename of a
391 script to run to dynamically allocate more interfaces.
392 .PP
393 A static allocation entry has the form
394 .IR infd [ \c
395 .BI , outfd \c
396 .RB ] \c
397 .BI = \c
398 .IR ifname ,
399 If the
400 .I outfd
401 is omitted, the same file descriptor is used for input and output.
402 .PP
403 The dynamic allocation script must be named by an absolute or relative
404 pathname, beginning with
405 .RB ` / '
406 or
407 .RB ` . '.
408 The server will pass the script an argument, which is the name of the
409 peer for which the interface is being created.  The script should
410 allocate a new SLIP interface (presumably by creating a pty pair),
411 configure it appropriately, and write the interface's name to its
412 standard output, followed by a newline.  It should then read and write
413 SLIP packets on its stdin and stdout.  The script's stdin will be closed
414 when the interface is no longer needed, and the server will attempt to
415 send it a
416 .B SIGTERM
417 signal (though this may fail if the script runs with higher privileges
418 than the server).
419 .PP
420 The output file descriptor should not block unless it really needs to:
421 the
422 .B tripe
423 daemon assumes that it won't, and will get wedged waiting for it to
424 accept output.
425 .SS "About the name"
426 The program's name is
427 .BR tripe ,
428 all in lower-case.  The name of the protocol it uses is `TrIPE', with
429 four capital letters and one lower-case.  The name stands for `Trivial
430 IP Encryption'.
431 .
432 .\"--------------------------------------------------------------------------
433 .SH "BUGS"
434 .
435 The code hasn't been audited.  It may contain security bugs.  If you
436 find one, please inform the author
437 .IR immediately .
438 .
439 .\"--------------------------------------------------------------------------
440 .SH "SEE ALSO"
441 .
442 .BR key (1),
443 .BR tripectl (1),
444 .BR tripe\-admin (5),
445 .BR tripe\-keys (8).
446 .PP
447 .IR "The Trivial IP Encryption Protocol" ,
448 .IR "The Wrestlers Protocol" .
449 .
450 .\"--------------------------------------------------------------------------
451 .SH "AUTHOR"
452 .
453 Mark Wooding, <mdw@distorted.org.uk>
454 .
455 .\"----- That's all, folks --------------------------------------------------