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