Make "tinc add" idempotent.
[tinc] / doc / tinc.8.in
1 .Dd 2014-01-16
2 .Dt TINCCTL 8
3 .\" Manual page created by:
4 .\" Scott Lamb
5 .Sh NAME
6 .Nm tinc
7 .Nd tinc VPN control
8 .Sh SYNOPSIS
9 .Nm
10 .Op Fl cn
11 .Op Fl -config Ns = Ns Ar DIR
12 .Op Fl -net Ns = Ns Ar NETNAME
13 .Op Fl -pidfile Ns = Ns Ar FILENAME
14 .Op Fl -help
15 .Op Fl -version
16 .Op Ar COMMAND
17 .Sh DESCRIPTION
18 This is the control program of tinc, a secure virtual private network (VPN)
19 project.
20 .Nm
21 can start and stop
22 .Xr tincd 8 ,
23 and can to alter and inspect the state of a running VPN.
24 It can also be used to change the configuration,
25 or to import or export host configuration files from other nodes.
26
27 If
28 .Nm
29 is started with a
30 .Ar COMMAND ,
31 this command is immediately executed, after which
32 .Nm
33 exits.
34 If no
35 .Ar COMMAND
36 is given,
37 .Nm
38 will act as a shell;
39 it will display a prompt, and commands can be entered on the prompt.
40 If
41 .Nm
42 is compiled with libreadline, history and command completion are available on the prompt.
43 One can also pipe a script containing commands through
44 .Nm .
45 In that case, lines starting with a # symbol will be ignored.
46 .Sh OPTIONS
47 .Bl -tag -width indent
48 .It Fl n, -net Ns = Ns Ar NETNAME
49 Communicate with tincd(8) connected with
50 .Ar NETNAME .
51 .It Fl -pidfile Ns = Ns Ar FILENAME
52 Use the cookie from
53 .Ar FILENAME
54 to authenticate with a running tinc daemon.
55 If unspecified, the default is
56 .Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid.
57 .It Fl -help
58 Display short list of options.
59 .It Fl -version
60 Output version information and exit.
61 .El
62 .Sh ENVIRONMENT VARIABLES
63 .Bl -tag -width indent
64 .It Ev NETNAME
65 If no netname is specified on the command line with the
66 .Fl n
67 option, the value of this environment variable is used.
68 .El
69 .Sh COMMANDS
70 .Bl -tag -width indent
71 .It init Op Ar name
72 Create initial configuration files and RSA and Ed25519 keypairs with default length.
73 If no
74 .Ar name
75 for this node is given, it will be asked for.
76 .It get Ar variable
77 Print the current value of configuration variable
78 .Ar variable .
79 If more than one variable with the same name exists,
80 the value of each of them will be printed on a separate line.
81 .It set Ar variable Ar value
82 Set configuration variable
83 .Ar variable
84 to the given
85 .Ar value .
86 All previously existing configuration variables with the same name are removed.
87 To set a variable for a specific host, use the notation
88 .Ar host Ns Li . Ns Ar variable .
89 .It add Ar variable Ar value
90 As above, but without removing any previously existing configuration variables.
91 If the variable already exists with the given value, nothing happens.
92 .It del Ar variable Op Ar value
93 Remove configuration variables with the same name and
94 .Ar value .
95 If no
96 .Ar value
97 is given, all configuration variables with the same name will be removed.
98 .It edit Ar filename
99 Start an editor for the given configuration file.
100 You do not need to specify the full path to the file.
101 .It export
102 Export the host configuration file of the local node to standard output.
103 .It export-all
104 Export all host configuration files to standard output.
105 .It import Op Fl -force
106 Import host configuration data generated by the
107 .Nm
108 export command from standard input.
109 Already existing host configuration files are not overwritten unless the option
110 .Fl -force
111 is used.
112 .It exchange Op Fl -force
113 The same as export followed by import.
114 .It exchange-all Op Fl -force
115 The same as export-all followed by import.
116 .It invite Ar name
117 Prepares an invitation for a new node with the given
118 .Ar name ,
119 and prints a short invitation URL that can be used with the join command.
120 .It join Op Ar URL
121 Join an existing VPN using an invitation URL created using the invite command.
122 If no
123 .Ar URL
124 is given, it will be read from standard input.
125 .It start Op tincd options
126 Start
127 .Xr tincd 8 ,
128 optionally with the given extra options.
129 .It stop
130 Stop
131 .Xr tincd 8 .
132 .It restart Op tincd options
133 Restart
134 .Xr tincd 8 ,
135 optionally with the given extra options.
136 .It reload
137 Partially rereads configuration files. Connections to hosts whose host
138 config files are removed are closed. New outgoing connections specified
139 in
140 .Xr tinc.conf 5
141 will be made.
142 .It pid
143 Shows the PID of the currently running
144 .Xr tincd 8 .
145 .It generate-keys Op bits
146 Generate both RSA and Ed25519 keypairs (see below) and exit.
147 .It generate-ed25519-keys
148 Generate public/private Ed25519 keypair and exit.
149 .It generate-rsa-keys Op bits
150 Generate public/private RSA keypair and exit.
151 If
152 .Ar bits
153 is omitted, the default length will be 2048 bits.
154 When saving keys to existing files, tinc will not delete the old keys;
155 you have to remove them manually.
156 .It dump [reachable] nodes
157 Dump a list of all known nodes in the VPN.
158 If the keyword reachable is used, only lists reachable nodes.
159 .It dump edges
160 Dump a list of all known connections in the VPN.
161 .It dump subnets
162 Dump a list of all known subnets in the VPN.
163 .It dump connections
164 Dump a list of all meta connections with ourself.
165 .It dump graph | digraph
166 Dump a graph of the VPN in
167 .Xr dotty 1
168 format.
169 Nodes are colored according to their reachability:
170 red nodes are unreachable, orange nodes are indirectly reachable, green nodes are directly reachable.
171 Black nodes are either directly or indirectly reachable, but direct reachability has not been tried yet.
172 .It info Ar node | subnet | address
173 Show information about a particular node, subnet or address.
174 If an address is given, any matching subnet will be shown.
175 .It purge
176 Purges all information remembered about unreachable nodes.
177 .It debug Ar N
178 Sets debug level to
179 .Ar N .
180 .It log Op Ar N
181 Capture log messages from a running tinc daemon.
182 An optional debug level can be given that will be applied only for log messages sent to
183 .Nm tinc .
184 .It retry
185 Forces
186 .Xr tincd 8
187 to try to connect to all uplinks immediately.
188 Usually
189 .Xr tincd 8
190 attempts to do this itself,
191 but increases the time it waits between the attempts each time it failed,
192 and if
193 .Xr tincd 8
194 didn't succeed to connect to an uplink the first time after it started,
195 it defaults to the maximum time of 15 minutes.
196 .It disconnect Ar NODE
197 Closes the meta connection with the given
198 .Ar NODE .
199 .It top
200 If
201 .Nm
202 is compiled with libcurses support, this will display live traffic statistics
203 for all the known nodes, similar to the UNIX
204 .Xr top 1
205 command.
206 See below for more information.
207 .It pcap
208 Dump VPN traffic going through the local tinc node in
209 .Xr pcap-savefile 5
210 format to standard output,
211 from where it can be redirected to a file or piped through a program that can parse it directly,
212 such as
213 .Xr tcpdump 8 .
214 .It network Op Ar netname
215 If
216 .Ar netname
217 is given, switch to that network.
218 Otherwise, display a list of all networks for which configuration files exist.
219 .It fsck
220 This will check the configuration files for possible problems,
221 such as unsafe file permissions, missing executable bit on script,
222 unknown and obsolete configuration variables, wrong public and/or private keys, and so on.
223 .Pp
224 When problems are found, this will be printed on a line with WARNING or ERROR in front of it.
225 Most problems must be corrected by the user itself, however in some cases (like file permissions and missing public keys),
226 tinc will ask if it should fix the problem.
227 .El
228 .Sh EXAMPLES
229 Examples of some commands:
230 .Bd -literal -offset indent
231 tinc -n vpn dump graph | circo -Txlib
232 tinc -n vpn pcap | tcpdump -r -
233 tinc -n vpn top
234 .Pp
235 .Ed
236 Examples of changing the configuration using
237 .Nm :
238 .Bd -literal -offset indent
239 tinc -n vpn init foo
240 tinc -n vpn add Subnet 192.168.1.0/24
241 tinc -n vpn add bar.Address bar.example.com
242 tinc -n vpn add ConnectTo bar
243 tinc -n vpn export | gpg --clearsign | mail -s "My config" vpnmaster@example.com
244 .Ed
245 .Sh TOP
246 The top command connects to a running tinc daemon and repeatedly queries its per-node traffic counters.
247 It displays a list of all the known nodes in the left-most column,
248 and the amount of bytes and packets read from and sent to each node in the other columns.
249 By default, the information is updated every second.
250 The behaviour of the top command can be changed using the following keys:
251 .Bl -tag
252 .It Ic s
253 Change the interval between updates.
254 After pressing the
255 .Ic s
256 key, enter the desired interval in seconds, followed by enter.
257 Fractional seconds are honored.
258 Intervals lower than 0.1 seconds are not allowed.
259 .It Ic c
260 Toggle between displaying current traffic rates (in packets and bytes per second)
261 and cumulative traffic (total packets and bytes since the tinc daemon started).
262 .It Ic n
263 Sort the list of nodes by name.
264 .It Ic i
265 Sort the list of nodes by incoming amount of bytes.
266 .It Ic I
267 Sort the list of nodes by incoming amount of packets.
268 .It Ic o
269 Sort the list of nodes by outgoing amount of bytes.
270 .It Ic O
271 Sort the list of nodes by outgoing amount of packets.
272 .It Ic t
273 Sort the list of nodes by sum of incoming and outgoing amount of bytes.
274 .It Ic T
275 Sort the list of nodes by sum of incoming and outgoing amount of packets.
276 .It Ic b
277 Show amount of traffic in bytes.
278 .It Ic k
279 Show amount of traffic in kilobytes.
280 .It Ic M
281 Show amount of traffic in megabytes.
282 .It Ic G
283 Show amount of traffic in gigabytes.
284 .It Ic q
285 Quit.
286 .El
287 .Sh BUGS
288 If you find any bugs, report them to tinc@tinc-vpn.org.
289 .Sh SEE ALSO
290 .Xr tincd 8 ,
291 .Xr tinc.conf 5 ,
292 .Xr dotty 1 ,
293 .Xr pcap-savefile 5 ,
294 .Xr tcpdump 8 ,
295 .Xr top 1 ,
296 .Pa http://www.tinc-vpn.org/ ,
297 .Pa http://www.cabal.org/ .
298 .Pp
299 The full documentation for tinc is maintained as a Texinfo manual.
300 If the info and tinc programs are properly installed at your site,
301 the command
302 .Ic info tinc
303 should give you access to the complete manual.
304 .Pp
305 tinc comes with ABSOLUTELY NO WARRANTY.
306 This is free software, and you are welcome to redistribute it under certain conditions;
307 see the file COPYING for details.
308 .Sh AUTHORS
309 .An "Ivo Timmermans"
310 .An "Guus Sliepen" Aq guus@tinc-vpn.org
311 .Pp
312 And thanks to many others for their contributions to tinc!