Import release 0.1.8
[secnet] / README
CommitLineData
558fa3fb
SE
1secnet - flexible VPN software
2
3* Introduction
4
5secnet allows large virtual private networks to be constructed
6spanning multiple separate sites. It is designed for the case where a
7private network connecting many hosts is 'hidden' behind a single
8globally-routable IP address, but can also be applied in other
9circumstances. It communicates entirely using UDP, and works well
10with gateways that implement network address translation.
11
12If you are installing secnet to join an existing VPN, you should read
13the 'INSTALL' file and your particular VPN's documentation now. You
14may need to refer back to this file for information on the netlink and
15comm sections of the configuration file.
16
17If you are thinking about setting up a new VPN of any size (from one
18providing complete links between multiple sites to a simple
19laptop-to-host link), read the section in this file on 'Creating a
20VPN'.
21
22* Creating a VPN
23
24XXX TODO
25
26* secnet configuration file format
27
28By default secnet on linux reads /etc/secnet/secnet.conf. The default
29may be different on other platforms.
30
31This file defines a dictionary (a mapping from keys to values) full of
32configuration information for secnet. Two keys must be defined in
33this file for secnet to start. One is "system", a dictionary
34containing systemwide control parameters. The other is "sites", a
35list of all the sites that you intend to communicate with.
36
37The configuration file has a very simple syntax; keys are defined as
38follows:
39
40key definition;
41or
42key = definition;
43
44(the "=" is optional)
45
46Keys must match the following regular expression:
47[[:alpha:]_][[:alnum:]\-_]*
48
49i.e. the first character must be an alpha or an underscore, and the
50remaining characters may be alphanumeric, '-' or '_'.
51
52Keys can be defined to be a comma-separated list of any of the
53following types:
54
55 a boolean
56 a string, in quotes
57 a number, in decimal
58 a dictionary of definitions, enclosed in { }
59 a "closure", followed by arguments
60 a path to a key that already exists, to reference that definition
61
62Note that dictionaries can be nested: a key in one dictionary can
63refer to another dictionary. When secnet looks for a key in a
64particular directory and can't find it, it looks in the dictionary's
65lexical 'parents' in turn until it finds it (or fails to find it at
66all and stops with an error).
67
68Definitions can refer to previous definitions by naming them with a
69path. Paths are key1/key2/key3... (starting from wherever we find
70key1, i.e. in the current dictionary or any of its parents), or
71alternatively /key1/key2/key3... (to start from the root).
72Definitions cannot refer to future definitions.
73
74Example:
75
76a=1;
77b=2;
78c={ d=3; e=a; };
79f={ a=4; g=c; };
80
81The following paths are valid:
82a is 1
83b is 2
84c is a dictionary:
85 c/d is 3
86 c/e is 1
87f is a dictionary:
88 f/a is 4
89 f/g is a dictionary:
90 f/g/d is 3
91 f/g/e is 1
92
93Note that f/g/e is NOT 4.
94
95In a future version of secnet it will also be permissible to list
96other dictionaries before a dictionary definition,
97eg. <defaults,otherdefaults>{definitions}. These will be searched in
98order for keys, before the lexical parent. (This is not yet
99implemented)
100
101Elements that are lists are inserted into lists in definitions, not
102referenced by them (i.e. you can't have lists of lists).
103
104Some closures may be followed by an argument list in ( ), and may
105return any number of whatever type they like (including other
106closures). Some types of closure (typically those returned from
107invokations of other closures) cannot be invoked.
108
109closure { definitions } is short for closure({definitions}).
110
111The main body of secnet, and all the additional modules, predefine
112some keys in the root dictionary. The main ones are:
113
114 yes, true, True, TRUE: the boolean value True
115 no, false, False, FALSE: the boolean value False
116 makelist: turns a dictionary (arg1) into a list of definitions
117 (ignoring the keys)
118 readfile: reads a file (arg1) and returns it as a string
119
120Keys defined by modules are described below, in the module
121documentation.
122
123Other configuration files can be included inline by writing "include
124filename" at the start of a line.
125
126After the configuration file is read, secnet looks for particular keys
127in configuration space to tell it what to do:
128
129 system: a dictionary which can contain the following keys:
130 log (log closure): a destination for system messages
131 userid (string): the userid for secnet to run as once it drops privileges
132 pidfile (string): where to store its PID
133
134 sites: a list of closures of type 'site', which define other tunnel
135 endpoints that secnet will attempt to communicate with
136
137* secnet command line options
138
139XXX TODO
140
141* secnet builtin modules
142
143** resolver
144
145Defines:
146 adns (closure => resolver closure)
147
3454dce4
SE
148adns: dict argument
149 config (string): optional, a resolv.conf for ADNS to use
150
558fa3fb
SE
151** random
152
153Defines:
154 randomsrc (closure => randomsrc closure)
155
3454dce4
SE
156randomsrc: string[,bool]
157 arg1: filename of random source
158 arg2: if True then source is blocking
159
558fa3fb
SE
160** udp
161
162Defines:
163 udp (closure => comm closure)
164
3454dce4
SE
165udp: dict argument
166 port (integer): UDP port to listen and send on
167 buffer (buffer closure): buffer for incoming packets
b2a56f7c 168 authbind (string): optional, path to authbind-helper program
3454dce4 169
042a8da9 170** log
558fa3fb
SE
171
172Defines:
173 logfile (closure => log closure)
b2a56f7c 174 syslog (closure => log closure)
558fa3fb 175
b2a56f7c
SE
176logfile: dict argument
177 filename (string): where to log to
178 class (string list): what type of messages to log
179 { "debug-config", M_DEBUG_CONFIG },
180 { "debug-phase", M_DEBUG_PHASE },
181 { "debug", M_DEBUG },
182 { "all-debug", M_DEBUG|M_DEBUG_PHASE|M_DEBUG_CONFIG },
183 { "info", M_INFO },
184 { "notice", M_NOTICE },
185 { "warning", M_WARNING },
186 { "error", M_ERROR },
187 { "security", M_SECURITY },
188 { "fatal", M_FATAL },
189 { "default", M_WARNING|M_ERROR|M_SECURITY|M_FATAL },
190 { "verbose", M_INFO|M_NOTICE|M_WARNING|M_ERROR|M_SECURITY|M_FATAL },
191 { "quiet", M_FATAL }
192
042a8da9
SE
193logfile will close and reopen its file upon receipt of SIGHUP.
194
b2a56f7c
SE
195syslog: dict argument
196 ident (string): include this string in every log message
197 facility (string): facility to log as
198 { "authpriv", LOG_AUTHPRIV },
199 { "cron", LOG_CRON },
200 { "daemon", LOG_DAEMON },
201 { "kern", LOG_KERN },
202 { "local0", LOG_LOCAL0 },
203 { "local1", LOG_LOCAL1 },
204 { "local2", LOG_LOCAL2 },
205 { "local3", LOG_LOCAL3 },
206 { "local4", LOG_LOCAL4 },
207 { "local5", LOG_LOCAL5 },
208 { "local6", LOG_LOCAL6 },
209 { "local7", LOG_LOCAL7 },
210 { "lpr", LOG_LPR },
211 { "mail", LOG_MAIL },
212 { "news", LOG_NEWS },
213 { "syslog", LOG_SYSLOG },
214 { "user", LOG_USER },
215 { "uucp", LOG_UUCP }
216
042a8da9
SE
217** util
218
219Defines:
220 sysbuffer (closure => buffer closure)
221
b2a56f7c
SE
222sysbuffer: integer[,dict]
223 arg1: buffer length
224 arg2: options:
225 lockdown (boolean): if True, mlock() the buffer
226
558fa3fb
SE
227** site
228
229Defines:
230 site (closure => site closure)
231
3454dce4
SE
232site: dict argument
233 local-name (string): this site's name for itself
234 name (string): the name of the site's peer
235 netlink (netlink closure)
236 comm (comm closure)
237 resolver (resolver closure)
238 random (randomsrc closure)
239 local-key (rsaprivkey closure)
240 address (string): optional, DNS name used to find our peer
241 port (integer): mandatory if 'address' is specified: the port used
242 to contact our peer
243 networks (string list): networks that our peer may claim traffic for
244 key (rsapubkey closure): our peer's public key
245 transform (transform closure): how to mangle packets sent between sites
246 dh (dh closure)
247 hash (hash closure)
248 key-lifetime (integer): max lifetime of a session key, in ms [one hour]
249 setup-retries (integer): max number of times to transmit a key negotiation
250 packet [5]
251 setup-timeout (integer): time between retransmissions of key negotiation
252 packets, in ms [1000]
253 wait-time (integer): after failed key setup, wait this long (in ms) before
254 allowing another attempt [20000]
255 renegotiate-time (integer): if we see traffic on the link after this time
256 then renegotiate another session key immediately [depends on key-lifetime]
257 keepalive (bool): if True then attempt always to keep a valid session key
258 log-events (string list): types of events to log for this site
259 unexpected: unexpected key setup packets (may be late retransmissions)
260 setup-init: start of attempt to setup a session key
261 setup-timeout: failure of attempt to setup a session key, through timeout
262 activate-key: activation of a new session key
263 timeout-key: deletion of current session key through age
264 security: anything potentially suspicious
265 state-change: steps in the key setup protocol
266 packet-drop: whenever we throw away an outgoing packet
267 dump-packets: every key setup packet we see
268 errors: failure of name resolution, internal errors
269 all: everything (too much!)
270 netlink-options (string list): options to pass to netlink device when
271 registering remote networks
272 soft: create 'soft' routes that go away when there's no key established
273 with the peer
274 allow-route: allow packets from our peer to be sent down other tunnels,
275 as well as to the host
276
558fa3fb
SE
277** transform
278
279Defines:
280 serpent256-cbc (closure => transform closure)
281
282** netlink
283
284Defines:
3454dce4
SE
285 null-netlink (closure => netlink closure)
286
287null-netlink: dict argument
288 name (string): name for netlink device, used in log messages
289 networks (string list): networks on the host side of the netlink device
290 exclude-remote-networks (string list): networks that may never be claimed
291 by any remote site using this netlink device
292 local-address (string): IP address of host's tunnel interface
293 secnet-address (string): IP address of this netlink device
c6f79b17 294 ptp-address (string): IP address of the other end of a point-to-point link
3454dce4
SE
295 mtu (integer): MTU of host's tunnel interface
296
c6f79b17
SE
297Only one of secnet-address or ptp-address may be specified. If
298point-to-point mode is in use then precisely one tunnel must register
299with the netlink device.
300
042a8da9
SE
301Netlink will dump its current routing table to the system/log on
302receipt of SIGUSR1.
303
3454dce4
SE
304** slip
305
306Defines:
558fa3fb 307 userv-ipif (closure => netlink closure)
3454dce4
SE
308
309userv-ipif: dict argument
310 userv-path (string): optional, where to find userv ["userv"]
311 service-user (string): optional, username for userv-ipif service ["root"]
312 service-name (string): optional, name of userv-ipif service ["ipif"]
313 buffer (buffer closure): buffer for assembly of host->secnet packets
314 plus generic netlink options, as for 'null-netlink'
315
316** tun
317
318Defines:
558fa3fb
SE
319 tun (closure => netlink closure) [only on linux-2.4]
320 tun-old (closure => netlink closure)
3454dce4
SE
321
322tun: dict argument
323 device (string): optional, path of TUN/TAP device file ["/dev/net/tun"]
324 interface (string): optional, name of tunnel network interface
325 ifconfig-path (string): optional, path to ifconfig command
326 route-path (string): optional, path to route command
327 buffer (buffer closure): buffer for host->secnet packets
328 plus generic netlink options, as for 'null-netlink'
329
330tun-old: dict argument
331 device (string): optional, path of TUN/TAP device file ["/dev/tun*"]
332 interface (string): optional, name of tunnel network interface
333 interface-search (bool): optional, whether to search for a free tunnel
334 interface (True if 'device' not specified, otherwise False)
335 ifconfig-path (string): optional, path to ifconfig command
336 route-path (string): optional, path to route command
337 plus generic netlink options, as for 'null-netlink'
558fa3fb 338
c6f79b17
SE
339 I recommend you don't specify the 'interface' option unless you're
340 doing something that requires the interface name to be constant.
341
558fa3fb
SE
342** rsa
343
344Defines:
345 rsa-private (closure => rsaprivkey closure)
346 rsa-public (closure => rsapubkey closure)
347
3454dce4
SE
348rsa-private: string[,bool]
349 arg1: filename of SSH private key file (version 1, no password)
350 arg2: whether to check that the key is usable [default True]
351
352rsa-public: string,string
353 arg1: encryption key (decimal)
354 arg2: modulus (decimal)
355
558fa3fb
SE
356** dh
357
358Defines:
359 diffie-hellman (closure => dh closure)
360
3454dce4
SE
361diffie-hellman: string,string[,bool]
362 arg1: modulus (hex)
363 arg2: generator (hex)
364 arg3: whether to check that the modulus is prime [default True]
365
558fa3fb
SE
366** md5
367
368Defines:
369 md5 (hash closure)
3454dce4
SE
370
371** sha1
372
373Defines:
374 sha1 (hash closure)
c6f79b17
SE
375
376** conffile
377
378Defines:
379 makelist (dictionary => list of definitions)
380 readfile (string => string)
381 map (closure,list => list)
382
383makelist: dictionary
384 returns a list consisting of the definitions in the dictionary. The keys
385 are discarded.
386
387readfile: string
388 reads the named file and returns its contents as a string
389
390map:
391 applies the closure specified as arg1 to each of the elements in the list.
392 Returns a list made up of the outputs of the closure.