chiark / gitweb /
Handle flags on challenge timers correctly to prevent confusing the event
[tripe] / doc / tripe.8
CommitLineData
74eb47db 1.\" -*-nroff-*-
2.\".
3.de hP
4.IP
5\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
6..
7.de VS
8.sp 1
9.RS
10.nf
11.ft B
12..
13.de VE
14.ft R
15.fi
16.RE
17.sp 1
18..
19.ie t \{\
20. ds o \(bu
21. ds ss \s8\u
22. ds se \d\s0
23. if \n(.g \{\
24. fam P
25. \}
26.\}
27.el \{\
28. ds o o
29. ds ss ^
d6623498 30. ds se
74eb47db 31.\}
32.TH tripe 8 "10 February 2001" "Straylight/Edgeware" "TrIPE: Trivial IP Encryption"
33.SH "NAME"
34tripe \- a simple VPN daemon
35.SH "SYNOPSIS"
36.B tripe
37.RB [ \-D ]
74eb47db 38.RB [ \-d
39.IR dir ]
33ced0d3 40.RB [ \-p
41.IR port ]
42.RB [ \-U
43.IR user ]
44.RB [ \-G
45.IR group ]
74eb47db 46.br
47
48.RB [ \-k
49.IR priv-keyring ]
50.RB [ \-K
51.IR pub-keyring ]
52.RB [ \-t
53.IR key-tag ]
33ced0d3 54.br
55
56.RB [ \-a
57.IR socket ]
58.RB [ \-T
59.IR trace-opts ]
74eb47db 60.SH "DESCRIPTION"
61The
62.B tripe
63program is a server which can provide strong IP-level encryption and
1a19f865 64authentication between co-operating hosts. The program and its protocol
65are deliberately very simple, to make analysing them easy and to help
66build trust rapidly in the system.
74eb47db 67.SS "Overview"
68The
69.B tripe
70server manages a number of secure connections to other `peer' hosts.
71Each daemon is given a private key of its own, and a file of public keys
72for the peers with which it is meant to communicate. It is responsible
73for negotiating sets of symmetric keys with its peers, and for
74encrypting, encapsulating and sending IP packets to its peers, and
75decrypting, checking and de-encapsulating packets it receives from
76them.
77.PP
78When the server starts, it creates a Unix-domain socket on which it
79listens for administration commands. It also logs warnings and
80diagnostic information to the programs connected to its admin socket.
81Clients connected to the socket can add new peers, and remove or find
82out about existing peers. The textual protocol used to give the
83.B tripe
84server admin commands is described in
85.BR tripe\-admin (5).
86A client program
87.BR tripectl (1)
88is provided to allow commands to be sent to the server either
89interactively or by simple scripts.
90.SS "Command-line arguments"
91If not given any command-line arguments,
92.B tripe
93will initialize by following these steps:
1a19f865 94.hP 1.
95It sets the directory named by the
96.B TRIPEDIR
97environment variable (or
98.B /var/lib/tripe
99if the variable is unset) as the current directory.
100.hP 2.
74eb47db 101It acquires a UDP socket with an arbitrary kernel-selected port number.
102It will use this socket to send and receive all communications with its
103peer servers. The port chosen may be discovered by means of the
104.B PORT
105admin command (see
106.BR tripe\-admin (5)).
1a19f865 107.hP 3.
74eb47db 108It loads the private key with the tag or type name
109.B tripe\-dh
110from the Catacomb-format file
111.BR keyring ,
112and loads the file
113.B keyring.pub
114ready for extracting the public keys of peers as they're introduced.
115(The format of these files is described in
116.BR keyring (5).
117They are maintained using the program
118.BR key (1)
119provided with the Catacomb distribution.)
1a19f865 120.hP 4.
74eb47db 121It creates and listens to the Unix-domain socket
122.BR tripesock .
123.PP
124Following this, the server enters its main loop, accepting admin
125connections and obeying any administrative commands, and communicating
126with peers. It also treats its standard input and standard output
127streams as an admin connection, reading commands from standard input and
33ced0d3 128writing responses and diagnostics messages to standard output. Finally,
129it will reload keys from its keyring files if it notices that they've
130changed (it checks inode number and modification time) \- there's no
131need to send a signal.
74eb47db 132.PP
133Much of this behaviour may be altered by giving
134.B tripe
135suitable command-line options:
136.TP
137.B "\-h, \-\-help"
138Writes a brief description of the command-line options available to
139standard output and exits with status 0.
140.TP
141.B "\-v, \-\-version"
142Writes
143.BR tripe 's
144version number to standard output and exits with status 0.
145.TP
146.B "\-u, \-\-usage"
147Writes a brief usage summary to standard output and exits with status 0.
148.TP
149.B "\-D, \-\-daemon"
150Dissociates from its terminal and starts running in the background after
151completing the initialization procedure described above. If running as
152a daemon,
153.B tripe
154will not read commands from standard input or write diagnostics to
155standard output. A better way to start
156.B tripe
157in the background is with
158.BR tripectl (1).
159.TP
160.BI "\-d, \-\-directory=" dir
161Makes
162.I dir
163the current directory, instead of
164.BR /var/lib/tripe .
165Give a current directory of
166.B .
167if you don't want it to change directory at all.
168.TP
169.BI "\-p, \-\-port=" port
170Use the specified UDP port for all communications with peers, rather
171than an arbitarary kernel-assigned port.
172.TP
33ced0d3 173.BI "\-U, \-\-setuid=" user
174Set uid to that of
175.I user
176(either a user name or integer uid) after initialization. Also set gid
177to
178.IR user 's
179primary group, unless overridden by a
180.B \-G
181option.
182.TP
183.BI "\-G, \-\-setgid=" group
184Set gid to that of
185.I group
186(either a group name or integer gid) after initialization.
187.TP
74eb47db 188.BI "\-k, \-\-priv\-keyring=" file
189Reads the private key from
190.I file
191rather than the default
192.BR keyring .
193.TP
194.BI "\-K, \-\-pub\-keyring=" file
195Reads public keys from
196.I file
197rather than the default
198.BR keyring.pub .
199This can be the same as the private keyring, but that's not recommended.
200.TP
201.BI "\-t, \-\-tag=" tag
202Uses the private key whose tag or type is
203.I tag
204rather than the default
205.BR tripe\-dh .
206.TP
207.BI "\-a, \-\-admin\-socket=" socket
208Accept admin connections to a Unix-domain socket named
209.I socket
210rather than the default
211.BR tripesock .
212.TP
213.BI "\-T, \-\-trace=" trace-opts
214Allows the enabling or disabling of various internal diagnostics. See
215below for the list of options.
d6623498 216.SS "Setting up a VPN with tripe"
217The
218.B tripe
219server identifies peers by name. While it's
220.I possible
221for each host to maintain its own naming system for its peers, this is
222likely to lead to confusion, and it's more sensible to organize a naming
223system that works everywhere. How you manage this naming is up to you.
224The only restriction on the format of names is that they must be valid
225Catacomb key tags, since this is how
226.B tripe
227identifies which public key to use for a particular peer: they may not
228contain whitespace characters, or a colon
229.RB ` : '
230or dot
231.RB ` . ',
232.PP
233Allocating IP addresses for VPNs can get quite complicated. I'll
234attempt to illustrate with a relatively simple example. Our objective
235will be to set up a virtual private network between two sites of
236.BR example.com .
237The two sites are using distinct IP address ranges from the private
238address space described in RFC1918: site A is using addresses from
23910.0.1.0/24 and site B is using 10.0.2.0/24. Each site has a gateway
240host set up with both an address on the site's private network, and an
241externally-routable address from the public IP address space. Site A's
242gateway machine,
243.BR alice ,
244has the addresses 10.0.1.1 and 200.0.1.1; site B's gateway is
245.B bob
246and has addresses 10.0.2.1 and 200.0.2.1.
247.PP
248This isn't quite complicated enough. Each of
249.B alice
250and
251.B bob
252needs an extra IP address which we'll use when setting up the
253point-to-point link. These addresses need to be routable, at least
254within the virtual private network: unfortunately, you can't just use
255the same pair everywhere. We'll assign
256.B alice
257the point-to-point address 192.168.0.1, and
258.B bob
259the address 192.168.0.2.
260.hP 1.
261Install
262.B tripe
263on both of the gateway hosts. Create the directory
264.BR /var/lib/tripe .
265.hP 2.
266On
267.BR alice ,
268make
269.B /var/lib/tripe
270the current directory and generate a Diffie-Hellman group:
271.RS
74eb47db 272.VS
273key add \-adh\-param \-LS \-b2048 \-B256 \e
274 \-eforever \-tparam tripe\-dh\-param
275.VE
d6623498 276(See
277.BR key (1)
278from the Catacomb distribution for details about the
279.B key
280command.) Also generate a private key for
281.BR alice :
282.VS
283key add \-adh \-pparam \-talice \e
284 \-e"now + 1 year" tripe\-dh
285.VE
286Extract the group parameters and
287.BR alice 's
288public key to
289.I separate
290files, and put the public key in
291.BR keyring.pub :
74eb47db 292.VS
293key extract param param
37075862 294key extract \-f\-secret alice.pub alice
d6623498 295key \-kkeyring.pub merge alice.pub
74eb47db 296.VE
d6623498 297Send the files
298.B param
299and
300.B alice.pub
301to
302.B bob
303in some secure way (e.g., in PGP-signed email, or by using SSH), so that
304you can be sure they've not been altered in transit.
305.RE
306.hP 3.
307On
308.B bob
309now, make
310.B /var/lib/tripe
311the current directory, and import the key material from
312.BR alice :
313.RS
74eb47db 314.VS
315key merge param
d6623498 316key \-kkeyring.pub merge alice.pub
74eb47db 317.VE
d6623498 318Generate a private key for
319.B bob
320and extract the public half, as before:
74eb47db 321.VS
d6623498 322key add \-adh \-pparam \-tbob \e
323 \-e"now + 1 year" tripe\-dh
383f2a0b 324key extract \-f\-secret bob.pub bob
d6623498 325key \-kkeyring.pub merge bob.pub
74eb47db 326.VE
d6623498 327and send
328.B bob.pub
329back to
330.B alice
331using some secure method.
332.RE
333.hP 4
334On
335.BR alice ,
336merge
337.B bob 's
338key into the public keyring. Now, on each host, run
339.RS
340.VS
341key \-kkeyring.pub fingerprint
342.VE
343and check that the hashes match. If the two sites have separate
344administrators, they should read the hashes to each other over the
345telephone (assuming that they can recognize each other's voices).
346.RE
347.hP 5.
348Start the
349.B tripe
350servers up. Run
351.RS
352.VS
353tripectl \-slD \-S\-P23169
354.VE
355on each of
356.B alice
357and
358.BR bob .
359(The
360.RB ` \-P23169 '
361forces the server to use UDP port 23169: use some other number if 23169
362is inappropriate for your requirements. I chose it by reducing the
363RIPEMD160 hash of
364.RB ` tripe\-port\-number\e0 '
365modulo 2\*(ss16\*(se.)
366.RE
367.hP 6.
368To get
369.B alice
370talking to
371.BR bob ,
372run this shell script (or one like it):
373.RS
374.VS
375#! /bin/sh
74eb47db 376
d6623498 377tripectl add bob 200.0.2.1 23169
378ifname=`tripectl ifname bob`
379ifconfig $ifname \e
380 192.168.0.1 \e
381 pointopoint 192.168.0.2
382route add -net \e
383 10.0.2.0 netmask 255.255.255.0 \e
384 gw 192.168.0.2
385.VE
386Read
387.BR ifconfig (8)
388and
389.BR route (8)
390to find out about your system's variants of these commands. The
391versions shown above assume a Linux system.
392Run a similar script on
393.BR bob ,
394to tell its
395.B tripe
396server to talk to
397.BR alice .
398.RE
399.hP 7.
400Congratulations. The two servers will exchange keys and begin sending
401packets almost immediately. You've set up a virtual private network.
74eb47db 402.SS "About the name"
403The program's name is
404.BR tripe ,
405all in lower-case. The name of the protocol it uses is `TrIPE', with
406four capital letters and one lower-case. The name stands for `Trivial
407IP Encryption'.
408.SH "BUGS"
74eb47db 409The code hasn't been audited. It may contain security bugs. If you
410find one, please inform the author
411.IR immediately .
412.SH "SEE ALSO"
413.BR key (1),
414.BR tripectl (1),
415.BR tripe\-admin (5).
416.PP
417.IR "The Trivial IP Encryption Protocol" ,
418.IR "The Wrestlers Protocol" .
419.SH "AUTHOR"
420Mark Wooding, <mdw@nsict.org>