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