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