chiark / gitweb /
svc/connect.in (Peer.get): Don't apply filter to default value.
[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 it under
13 .\" the terms of the GNU General Public License as published by the Free
14 .\" Software Foundation; either version 3 of the License, or (at your
15 .\" option) any later version.
16 .\"
17 .\" TrIPE is distributed in the hope that it will be useful, but WITHOUT
18 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 .\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 .\" for more details.
21 .\"
22 .\" You should have received a copy of the GNU General Public License
23 .\" along with TrIPE.  If not, see <https://www.gnu.org/licenses/>.
24 .
25 .\"--------------------------------------------------------------------------
26 .so ../common/defs.man \" @@@PRE@@@
27 .
28 .\"--------------------------------------------------------------------------
29 .TH tripe 8tripe "10 February 2001" "Straylight/Edgeware" "TrIPE: Trivial IP Encryption"
30 .
31 .\"--------------------------------------------------------------------------
32 .SH "NAME"
33 .
34 tripe \- a simple VPN daemon
35 .
36 .\"--------------------------------------------------------------------------
37 .SH "SYNOPSIS"
38 .
39 .B tripe
40 .RB [ \-DF ]
41 .RB [ \-d
42 .IR dir ]
43 .RB [ \-b
44 .IR addr ]
45 .RB [ \-p
46 .IR port ]
47 .RB [ \-n
48 .IR tunnel ]
49 .br
50         \c
51 .RB [ \-U
52 .IR user ]
53 .RB [ \-G
54 .IR group ]
55 .RB [ \-a
56 .IR socket ]
57 .RB [ \-m
58 .IR mode ]
59 .RB [ \-T
60 .IR trace-opts ]
61 .br
62         \c
63 .RB [ \-k
64 .IR priv-keyring ]
65 .RB [ \-K
66 .IR pub-keyring ]
67 .RB [ \-t
68 .IR key-tag ]
69 .
70 .\"--------------------------------------------------------------------------
71 .SH "DESCRIPTION"
72 .
73 The
74 .B tripe
75 program is a server which can provide strong IP-level encryption and
76 authentication between co-operating hosts.  The program and its protocol
77 are deliberately very simple, to make analysing them easy and to help
78 build trust rapidly in the system.
79 .SS "Overview"
80 The
81 .B tripe
82 server manages a number of secure connections to other `peer' hosts.
83 Each daemon is given a private key of its own, and a file of public keys
84 for the peers with which it is meant to communicate.  It is responsible
85 for negotiating sets of symmetric keys with its peers, and for
86 encrypting, encapsulating and sending IP packets to its peers, and
87 decrypting, checking and de-encapsulating packets it receives from
88 them.
89 .PP
90 When the server starts, it creates a Unix-domain socket on which it
91 listens for administration commands.  It also logs warnings and
92 diagnostic information to the programs connected to its admin socket.
93 Clients connected to the socket can add new peers, and remove or find
94 out about existing peers.  The textual protocol used to give the
95 .B tripe
96 server admin commands is described in
97 .BR tripe\-admin (5).
98 A client program
99 .BR tripectl (1)
100 is provided to allow commands to be sent to the server either
101 interactively or by simple scripts.
102 .SS "Command-line arguments"
103 If not given any command-line arguments,
104 .B tripe
105 will initialize by following these steps:
106 .hP 1.
107 It sets the directory named by the
108 .B TRIPEDIR
109 environment variable (or
110 .B "\*(/c"
111 if the variable is unset) as the current directory.
112 .hP 2.
113 It acquires a UDP socket.  The default port is 4070
114 It will use this socket to send and receive all communications with its
115 peer servers.  The port chosen may be discovered by means of the
116 .B PORT
117 admin command (see
118 .BR tripe\-admin (5)).
119 .hP 3.
120 It loads the private key with the tag or type name
121 .B tripe
122 (or, failing that,
123 .B tripe\-dh
124 for backwards compatibility reasons) from the Catacomb-format file
125 .BR keyring ,
126 and loads the file
127 .B keyring.pub
128 ready for extracting the public keys of peers as they're introduced.
129 (The format of these files is described in
130 .BR keyring (5).
131 They are maintained using the program
132 .BR key (1)
133 provided with the Catacomb distribution.)
134 .hP 4.
135 It creates and listens to the Unix-domain socket
136 .BR tripesock .
137 .PP
138 Following this, the server enters its main loop, accepting admin
139 connections and obeying any administrative commands, and communicating
140 with peers.  It also treats its standard input and standard output
141 streams as an admin connection, reading commands from standard input and
142 writing responses and diagnostics messages to standard output.  Finally,
143 it will reload keys from its keyring files if it notices that they've
144 changed (it checks inode number and modification time) \- there's no
145 need to send a signal.
146 .PP
147 Much of this behaviour may be altered by giving
148 .B tripe
149 suitable command-line options:
150 .TP
151 .B "\-h, \-\-help"
152 Writes a brief description of the command-line options available to
153 standard output and exits with status 0.
154 .TP
155 .B "\-v, \-\-version"
156 Writes
157 .BR tripe 's
158 version number to standard output and exits with status 0.
159 .TP
160 .B "\-u, \-\-usage"
161 Writes a brief usage summary to standard output and exits with status 0.
162 .TP
163 .B "\-\-tunnels"
164 Writes to standard output a list of the configured tunnel drivers, one
165 per line, and exits with status 0.  This is intended for the use of the
166 start-up script, so that it can check that it will actually work.
167 .TP
168 .B "\-D, \-\-daemon"
169 Dissociates from its terminal and starts running in the background after
170 completing the initialization procedure described above.  If running as
171 a daemon,
172 .B tripe
173 will not read commands from standard input or write diagnostics to
174 standard output.  A better way to start
175 .B tripe
176 in the background is with
177 .BR tripectl (1).
178 .TP
179 .B "\-F, \-\-foreground"
180 Runs the server in the `foreground'; i.e.,
181 .B tripe
182 will quit if it sees end-of-file on its standard input.  This is
183 incompatible with
184 .BR \-D .
185 .TP
186 .BI "\-d, \-\-directory=" dir
187 Makes
188 .I dir
189 the current directory.  The default directory to change to is given by
190 the environment variable
191 .BR TRIPEDIR ;
192 if that's not specified, a default default of
193 .B "\*(/c"
194 is used.  Give a current directory of
195 .B .
196 if you don't want it to change directory at all.
197 .TP
198 .BI "\-b, \-\-bind-address="addr
199 Bind the UDP socket to IP address
200 .I addr
201 rather than the default of
202 .BR INADDR_ANY .
203 This is useful if your main globally-routable IP address is one you want
204 to tunnel through the VPN.
205 .TP
206 .BI "\-p, \-\-port=" port
207 Use the specified UDP port for all communications with peers, rather
208 than the default port 4070.  If this is zero, the kernel will assign a
209 free port, which can be determined using the
210 .B PORT
211 administration command (see
212 .BR tripe-admin (5)).
213 .TP
214 .BI "\-n, \-\-tunnel=" tunnel
215 Use the specified tunnel driver for new peers by default.
216 .TP
217 .BI "\-U, \-\-setuid=" user
218 Set uid to that of
219 .I user
220 (either a user name or integer uid) after initialization.  Also set gid
221 to
222 .IR user 's
223 primary group, unless overridden by a
224 .B \-G
225 option.  The selected user (and group) will also be the owner of the
226 administration socket.
227 .TP
228 .BI "\-G, \-\-setgid=" group
229 If the current effective uid is zero (i.e., the daemon was invoked as
230 .BR root )
231 then set gid to that of
232 .I group
233 (either a group name or integer gid) after initialization.  In any
234 event, arrange hat the administration socket be owned by the given
235 .IR group .
236 .TP
237 .BI "\-k, \-\-priv\-keyring=" file
238 Reads the private key from
239 .I file
240 rather than the default
241 .BR keyring .
242 .TP
243 .BI "\-K, \-\-pub\-keyring=" file
244 Reads public keys from
245 .I file
246 rather than the default
247 .BR keyring.pub .
248 This can be the same as the private keyring, but that's not recommended.
249 .TP
250 .BI "\-t, \-\-tag=" tag
251 Uses the private key whose tag or type is
252 .I tag
253 rather than the default
254 .B tripe
255 or
256 .BR tripe\-dh .
257 .TP
258 .BI "\-a, \-\-admin\-socket=" socket
259 Accept admin connections to a Unix-domain socket named
260 .IR socket .
261 The default socket, if this option isn't specified, is given by the
262 environment variable
263 .BR TRIPESOCK ;
264 if that's not set either, then a default default of
265 .B "\*(/s/tripesock"
266 is used instead.
267 .TP
268 .BI "\-m, \-\-admin\-perms=" mode
269 Permissions (as an octal number) to set on the administration socket.  The
270 default is 600, which allows only the socket owner.  Setting 660 allows
271 members of the
272 .I group
273 configured through the
274 .B \-G
275 option to connect to the socket, which may be useful.  Allowing world access
276 is a terrible idea.
277 .TP
278 .BI "\-T, \-\-trace=" trace-opts
279 Allows the enabling or disabling of various internal diagnostics.  See
280 below for the list of options.
281 .SS "Key exchange group types"
282 The
283 .B tripe
284 server uses Diffie\(en\&Hellman key exchange to agree the symmetric keys
285 used for bulk data transfer.
286 .PP
287 The server works out which it should be doing based on the key's
288 .B kx-group
289 attribute.
290 If this attribute isn't present, then the key's type is examined: if
291 it's of the form
292 .BI tripe\- group
293 then the
294 .I group
295 is used.  If no group is specified,
296 .B dh
297 is used as a fallback.
298 The following groups are defined.
299 .TP
300 .B dh
301 .RS
302 Use traditional Diffie\(enHellman in a
303 .IR "Schnorr group" :
304 a prime-order subgroup of the multiplicative group of
305 a finite field; this is the usual
306 .I g\*(ssx\*(se
307 mod
308 .I p
309 kind of Diffie\(en\&Hellman.
310 .PP
311 To create usual Schnorr-group keys, say something like
312 .VS
313 key add \-adh-param \-LS \-b3072 \-B256 \e
314         \-eforever \-tparam tripe\-param kx-group=dh
315 .VE
316 to construct a parameters key; and create the private keys by
317 .VS
318 key add \-adh \-pparam \-talice \e
319         \-e"now + 1 year" tripe
320 .VE
321 .RE
322 .sv -1
323 .TP
324 .B ec
325 .RS
326 Use elliptic curve Diffie\(enHellman.
327 An elliptic curve group is a prime-order
328 subgroup of the abelian group of
329 .BR K -rational
330 points on an elliptic curve defined over a finite field
331 .BR K .
332 .PP
333 Given current public knowledge, elliptic curves can provide similar or
334 better security to systems based on integer discrete log problems,
335 faster, and with less transmitted data.  It's a matter of controversy
336 whether this will continue to be the case.  The author uses elliptic
337 curves.
338 .PP
339 To create elliptic curve keys, say something like
340 .VS
341 key add \-aec\-param \-Cnist-p256 \-eforever \e
342         \-tparam tripe\-param kx-group=ec
343 .VE
344 to construct a parameters key, using your preferred elliptic curve in
345 the
346 .B \-C
347 option (see
348 .BR key (1)
349 for details); and create the private keys by
350 .VS
351 key add \-aec \-pparam \-talice \e
352         \-e"now + 1 year" tripe
353 .VE
354 .RE
355 .sv -1
356 .TP
357 .B x25519
358 .RS
359 Use Bernstein's X25519 Diffie\(enHellman function.
360 This is technically a variant on
361 the general elliptic curve Diffie\(enHellman
362 available through the
363 .B ec
364 setting,
365 but carefully designed and heavily optimized.
366 .PP
367 To create
368 .B x25519
369 keys,
370 say something like
371 .VS
372 key add \-aempty \-eforever \e
373         \-tparam tripe\-param kx-group=x25519
374 .VE
375 to construct a parameters key
376 (see
377 .BR key (1)
378 for details);
379 and create the private keys by
380 .VS
381 key add \-ax25519 \-pparam \-talice \e
382         \-e"now + 1 year" tripe
383 .VE
384 .RE
385 .sv -1
386 .TP
387 .B x448
388 .RS
389 Use Hamburg's X448 Diffie\(enHellman function.
390 Like
391 .B x25519
392 above,
393 this is technically a variant on
394 the general elliptic curve Diffie\(enHellman
395 available through the
396 .B ec
397 setting,
398 but carefully designed and heavily optimized.
399 .PP
400 To create
401 .B x448
402 keys,
403 say something like
404 .VS
405 key add \-aempty \-eforever \e
406         \-tparam tripe\-param kx-group=x448
407 .VE
408 to construct a parameters key
409 (see
410 .BR key (1)
411 for details);
412 and create the private keys by
413 .VS
414 key add \-ax448 \-pparam \-talice \e
415         \-e"now + 1 year" tripe
416 .VE
417 .RE
418 Note that the
419 .BR tripe-keys (8)
420 program provides a rather more convenient means for generating and
421 managing keys for
422 .BR tripe .
423 .SS "Using other symmetric algorithms"
424 The default symmetric algorithms
425 .B tripe
426 uses are Blowfish (by Schneier) for symmetric encryption, and RIPEMD-160
427 (by Dobbertin, Bosselaers and Preneel) for hashing and as a MAC (in HMAC
428 mode, designed by Bellare, Canetti and Krawczyk).  These can all be
429 overridden by setting attributes on your private key, as follows.
430 .TP
431 .B bulk
432 Names the bulk-crypto transform to use.  See below.
433 .TP
434 .B blkc
435 Names a block cipher, used by some bulk-crypto transforms (e.g.,
436 .BR iiv ).
437 The default is to use the block cipher underlying the chosen
438 .BR cipher ,
439 if any.
440 .TP
441 .B cipher
442 Names the symmetric encryption scheme to use.  The default is
443 .BR blowfish\-cbc .
444 .TP
445 .B hash
446 Names the hash function to use.  The default is
447 .BR rmd160 .
448 .TP
449 .B mac
450 Names the message authentication code to use.  The name of the MAC may
451 be followed by a
452 .RB ` / '
453 and the desired tag length in bits.  The default is
454 .IB hash \-hmac
455 at half the underlying hash function's output length.
456 If the MAC's name contains a
457 .RB ` / '
458 character,
459 e.g.,
460 .RB ` sha512/256 ',
461 then an
462 .I additional
463 .RB ` / '
464 and the tag size is required to disambiguate,
465 so, e.g.,
466 one might write
467 .RB ` sha512/256/256 '.
468 .TP
469 .B mgf
470 A `mask-generation function', used in the key-exchange.  The default is
471 .IB hash \-mgf
472 and there's no good reason to change it.
473 .PP
474 The available bulk-crypto transforms are as follows.
475 .TP
476 .B v0
477 Originally this was the only transform available.  It's a standard
478 generic composition of a CPA-secure symmetric encryption scheme with a
479 MAC; initialization vectors for symmetric encryption are chosen at
480 random and included explicitly in the cryptogram.
481 .TP
482 .B iiv
483 A newer `implicit-IV' transform.  Rather than having an explicit random
484 IV, the IV is computed from the sequence number using a block cipher.
485 This has two advantages over the
486 .B v0
487 transform.  Firstly, it adds less overhead to encrypted messages
488 (because the IV no longer needs to be sent explicitly).  Secondly, and
489 more significantly, the transform is entirely deterministic, so (a) it
490 doesn't need the (possibly slow) random number generator, and (b) it
491 closes a kleptographic channel, over which a compromised implementation
492 could leak secret information to a third party.
493 .TP
494 .B naclbox
495 A transform based on the NaCl
496 .B crypto_secretbox
497 transformation.
498 The main difference is that NaCl uses XSalsa20,
499 while TrIPE uses plain Salsa20 or ChaCha,
500 because it doesn't need the larger nonce space.
501 You can set the
502 .B cipher
503 key attribute to one of
504 .BR salsa20 ,
505 .BR salsa20/12 ,
506 .BR salsa20/8 ,
507 .BR chacha20 ,
508 .BR chacha12 ,
509 or
510 .B chacha8
511 to select the main cipher.
512 You can set the
513 .B mac
514 key attribute to
515 .B poly1305
516 or
517 .B poly1305/128
518 but these are the default and no other choice is permitted.
519 (This is for forward compatibility,
520 in case other MACs and/or tag sizes are allowed later.)
521 .SS "Other key attributes"
522 The following attributes can also be set on keys.
523 .TP
524 .B serialization
525 Selects group-element serialization formats.
526 The recommended setting is
527 .BR constlen ,
528 which selects a constant-length encoding when hashing group elements.
529 The default,
530 for backwards compatibility, is
531 .BR v0 ;
532 but this is deprecated.
533 (The old format uses a variable length format for hashing,
534 which can leak information through timing.)
535 .SS "Using SLIP interfaces"
536 Though not for the faint of heart, it is possible to get
537 .B tripe
538 to read and write network packets to a pair of file descriptors using
539 SLIP encapsulation.  No fancy header compression of any kind is
540 supported.
541 .PP
542 Two usage modes are supported: a preallocation system, whereby SLIP
543 interfaces are created and passed to the
544 .B tripe
545 server at startup; and a dynamic system, where the server runs a script
546 to allocate a new SLIP interface when it needs one.  It is possible to
547 use a mixture of these two modes, starting
548 .B tripe
549 with a few preallocated interfaces and having it allocate more
550 dynamically as it needs them.
551 .PP
552 The behaviour of
553 .BR tripe 's
554 SLIP driver is controlled by the
555 .B TRIPE_SLIPIF
556 environment variable.  The server will not create SLIP tunnels if this
557 variable is not defined.  The variable's value is a colon-delimited list
558 of preallocated interfaces, followed optionally by the filename of a
559 script to run to dynamically allocate more interfaces.
560 .PP
561 A static allocation entry has the form
562 .IR infd [ \c
563 .BI , outfd \c
564 .RB ] \c
565 .BI = \c
566 .IR ifname ,
567 If the
568 .I outfd
569 is omitted, the same file descriptor is used for input and output.
570 .PP
571 The dynamic allocation script must be named by an absolute or relative
572 pathname, beginning with
573 .RB ` / '
574 or
575 .RB ` . '.
576 The server will pass the script an argument, which is the name of the
577 peer for which the interface is being created.  The script should
578 allocate a new SLIP interface (presumably by creating a pty pair),
579 configure it appropriately, and write the interface's name to its
580 standard output, followed by a newline.  It should then read and write
581 SLIP packets on its stdin and stdout.  The script's stdin will be closed
582 when the interface is no longer needed, and the server will attempt to
583 send it a
584 .B SIGTERM
585 signal (though this may fail if the script runs with higher privileges
586 than the server).
587 .PP
588 The output file descriptor should not block unless it really needs to:
589 the
590 .B tripe
591 daemon assumes that it won't, and will get wedged waiting for it to
592 accept output.
593 .SS "About the name"
594 The program's name is
595 .BR tripe ,
596 all in lower-case.  The name of the protocol it uses is `TrIPE', with
597 four capital letters and one lower-case.  The name stands for `Trivial
598 IP Encryption'.
599 .
600 .\"--------------------------------------------------------------------------
601 .SH "BUGS"
602 .
603 The code hasn't been audited.  It may contain security bugs.  If you
604 find one, please inform the author
605 .IR immediately .
606 .
607 .\"--------------------------------------------------------------------------
608 .SH "SEE ALSO"
609 .
610 .BR key (1),
611 .BR tripectl (1),
612 .BR tripe\-admin (5),
613 .BR tripe\-keys (8).
614 .PP
615 .IR "The Trivial IP Encryption Protocol" ,
616 .IR "The Wrestlers Protocol" .
617 .
618 .\"--------------------------------------------------------------------------
619 .SH "AUTHOR"
620 .
621 Mark Wooding, <mdw@distorted.org.uk>
622 .
623 .\"----- That's all, folks --------------------------------------------------