svc/conntrack.in: Process peer patterns in order.
[tripe] / svc / conntrack.8.in
... / ...
CommitLineData
1.\" -*-nroff-*-
2.\".
3.\" Manual for the conntrack service
4.\"
5.\" (c) 2010 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 it under
13.\" the terms of the GNU General Public License as published by the Free
14.\" Software Foundation; either version 3 of the License, or (at your
15.\" option) any later version.
16.\"
17.\" TrIPE is distributed in the hope that it will be useful, but WITHOUT
18.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20.\" for more details.
21.\"
22.\" You should have received a copy of the GNU General Public License
23.\" along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
24.
25.\"--------------------------------------------------------------------------
26.so ../common/defs.man \"@@@PRE@@@
27.
28.\"--------------------------------------------------------------------------
29.TH conntrack 8tripe "8 January 2007" "Straylight/Edgeware" "TrIPE: Trivial IP Encryption"
30.
31.\"--------------------------------------------------------------------------
32.SH "NAME"
33.
34conntrack \- tripe service to start/stop peers depending on external connectivity
35.
36.\"--------------------------------------------------------------------------
37.SH "SYNOPSIS"
38.
39.B conntrack
40.RB [ \-a
41.IR socket ]
42.RB [ \-d
43.IR dir ]
44.RB [ \-f
45.IR file ]
46.br
47\& \c
48.RB [ \-\-daemon ]
49.RB [ \-\-debug ]
50.RB [ \-\-startup ]
51.
52.\"--------------------------------------------------------------------------
53.SH "DESCRIPTION"
54.
55The
56.B conntrack
57service watches D-Bus network management services like
58.BR NetworkManager (8),
59.BR ConnMan
60.RB ( connmand (8)),
61and Nokia's
62.BR ICd ,
63bringing peers up and down automatically. It's designed to be useful on
64a mobile device, such as a laptop; I expect servers to stay where
65they're put and be configured statically.
66.SS "Configuration"
67The
68.B conntrack
69service reads a configuration file, by default
70.BR conntrack.conf ,
71explaining which peers to bring up under which circumstances. The
72configuration file is automatically re-read if it's changed.
73.PP
74The
75configuration is split into sections, each describing a
76.IR "peer group" .
77A section begins with the peer group name in square brackets:
78.IP
79.BI [ group ]
80.PP
81The group name is entirely arbitrary, and affects nothing else. This is
82followed by peer definitions, each of which looks like this:
83.IP
84.I tag
85.B =
86.RI [ remote-addr ]
87.IB network / mask
88.PP
89This means that the peer
90.I tag
91should be selected if the host's current IP address is within the
92network indicated by
93.IB network / mask \fR.
94Here,
95.I network
96is an IP address in dotted-quad form, and
97.I mask
98is a netmask, either in dotted-quad form, or as a number of 1-bits.
99Only one peer in each group may be connected at any given time; if a
100change is needed, any existing peer in the group is killed before
101connecting the new one. If no match is found in a particular group,
102then no peers in the group are connected. Strange and unhelpful things
103will happen if you put the same peer in several different groups.
104.PP
105The tags
106.B down
107and
108.BI down/ anything
109are special and mean that no peer from the group should be active. This
110is useful for detecting a `home' network, where a VPN is unnecessary
111(or, worse, break routing completely).
112.PP
113The notion of `current IP address' is somewhat vague. The
114.B conntrack
115service calculates it as the source address that the host would put on
116an IP packet sent to an arbitrarily chosen remote address. The default
117remote address is 1.2.3.4 (which is unlikely ever to be assigned); this
118should determine an IP address on the network interface closest to the
119default gateway. You can influence this process in two ways. Firstly,
120you can change the default remote address used by adding a line
121.IP
122.B "test-addr ="
123.I remote-addr
124.PP
125before the first peer group section. Secondly, you can specify a
126particular
127.I remote-addr
128to use when checking whether a particular peer is applicable.
129.PP
130The peer definitions in each group are checked in the order given, and
131searching stops as soon as a match is found.
132.PP
133Peers are connected using the
134.BR connect (8)
135service:
136.IP
137.B SVCSUBMIT connect active
138.I peer
139.SS "Command line"
140In addition to the standard options described in
141.BR tripe-service (7),
142the following command-line options are recognized.
143.TP
144.BI "\-f, \-\-config=" file
145Use
146.I file
147as the configuration file. In the absence of this option, the
148file named
149.B conntrack.conf
150in the current working directory is used instead.
151.
152.\"--------------------------------------------------------------------------
153.SH "SERVICE COMMAND REFERENCE"
154.
155.\"* 10 Service commands
156The commands provided by the service are as follows.
157.SP
158.BI "up " reason\fR...
159Informs the service that the network connection has been established:
160peer groups should be connected. The
161.I reason
162is quoted in the status notification.
163.SP
164.BI "down " reason\fR...
165Informs the service that the network connection has been lost:
166peer groups should be disconnected. The
167.I reason
168is quoted in the status notification.
169.
170.\"--------------------------------------------------------------------------
171.SH "NOTIFICATIONS"
172.
173.\"* 30 Notification broadcasts (NOTE codes)
174All notifications issued by
175.B conntrack
176begin with the tokens
177.BR "USER conntrack" .
178.SP
179.BI "USER conntrack dbus-connection " status
180The service's connection to D-Bus has changed state. The
181.I status
182is one of the following.
183.RS
184.TP
185.B startup
186Initially trying to connect.
187.TP
188.B connected
189Successfully established a connection to the bus.
190.TP
191.B lost
192A connection has been lost.
193.TP
194.BI state= label
195The service's internal state machine is confused.
196.RE
197.SP
198.BI "USER conntrack " up \fR| down " " group = peer\fR... " " reason\fR...
199The network connection has apparently gone up or down, and
200.B conntrack
201is about to kill and/or connect peers accordingly: for each group, the
202selected peer is listed; if a group is not listed, then either the group
203is to be brought down, or no matching peer was found. The
204.I reason
205is one of the following.
206.RS
207.TP
208.BI "connman initially-" state
209ConnMan was detected on startup, and is in the given
210.I state
211\(en see below.
212.TP
213.BI "connman " state
214ConnMan has transitioned to
215.IR state .
216The possible states are:
217.B offline
218(the network is turned off by user request);
219.B idle
220(no network interfaces are active);
221.B ready
222(an interface is up but not fully configured); and
223.B online
224(an interface is up and configured).
225.TP
226.BI "icd connected " iap
227Maemo ICd has acquired an active network connection, identified by
228.IR iap .
229.TP
230.B "icd idle"
231Maemo ICd has lost its active network connection.
232.TP
233.BI "icd initially-connected " iap
234Maemo ICd was detected on startup, and has an active network connection
235identified by
236.IR iap .
237.TP
238.B "icd initially-disconnected"
239Maemo ICd was detected on startup, and has no active network connection.
240.TP
241.B interval-timer
242A change was detected during
243.BR conntrack 's
244periodic status check. This usually means that the network connection
245was reconfigured manually without informing
246.BR conntrack .
247.TP
248.BI "manual " reason\fR...
249The connection status was changed manually, using the
250.B up
251or
252.B down
253service command.
254.TP
255.B "nm connected"
256NetworkManager has acquired an active network connection.
257.TP
258.B "nm default-connection-change"
259NetworkManager has changed its default route.
260.TP
261.B "nm disconnected"
262NetworkManager has lost its active network connection.
263.TP
264.B "nm initially-connected"
265NetworkManager was detected on startup, and has an active network
266connection.
267.TP
268.B "nm initially-disconnected"
269NetworkManager was detected on startup, and has no active network
270connection.
271.RE
272.
273.\"--------------------------------------------------------------------------
274.SH "WARNINGS"
275.
276.\"* 40 Warning broadcasts (WARN codes)
277All warnings issued by
278.B conntrack
279begin with the tokens
280.BR "USER conntrack" .
281.SP
282.BI "USER conntrack config-file-error " exception " " error-text
283The configuration file is invalid. The
284.I exception
285token names a Python exception; the
286.I error-text
287describes the problem encountered, though it may not be very useful.
288.SP
289.BI "USER conntrack connect-failed " peer " " tokens\fR...
290An attempt to connect the named
291.I peer
292failed; the error message is given by the
293.IR tokens .
294.
295.\"--------------------------------------------------------------------------
296.SH "SUMMARY"
297.
298.\"= summary
299.
300.\"--------------------------------------------------------------------------
301.SH "SEE ALSO"
302.
303.BR tripe-service (7),
304.BR peers.in (5),
305.BR watch (8),
306.BR tripe (8).
307.
308.\"--------------------------------------------------------------------------
309.SH "AUTHOR"
310.
311Mark Wooding, <mdw@distorted.org.uk>
312.
313.\"----- That's all, folks --------------------------------------------------