badvpn-client.8 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. .TH badvpn-client 8 "21 June 2011"
  2. .SH NAME
  3. badvpn-client \- VPN node daemon for the BadVPN peer-to-peer VPN system
  4. .SH SYNOPSIS
  5. .B badvpn-client
  6. .RS
  7. .RB "[" --help "]"
  8. .br
  9. .RB "[" --version "]"
  10. .br
  11. .RB "[" --logger " <stdout/syslog>]"
  12. .br
  13. (logger=syslog?
  14. .br
  15. .RS
  16. .br
  17. .RB "[" --syslog-facility " <string>]"
  18. .br
  19. .RB "[" --syslog-ident " <string>]"
  20. .br
  21. .RE
  22. )
  23. .br
  24. .RB "[" --loglevel " <0-5/none/error/warning/notice/info/debug>]"
  25. .br
  26. .RB "[" --channel-loglevel " <channel-name> <0-5/none/error/warning/notice/info/debug>] ..."
  27. .br
  28. .RB "[" --threads " <integer>]"
  29. .br
  30. .RB "[" --ssl " " --nssdb " <string> " --client-cert-name " <string>]"
  31. .br
  32. .RB "[" --server-name " <string>]"
  33. .br
  34. .BR --server-addr " <addr>"
  35. .br
  36. .RB "[" --tapdev " <name>]"
  37. .br
  38. .RB "[" --scope " <scope_name>] ..."
  39. .br
  40. [
  41. .br
  42. .RS
  43. .BR --bind-addr " <addr>"
  44. .br
  45. .RB "(transport-mode=udp? " --num-ports " <num>)"
  46. .br
  47. .RB "[" --ext-addr " <addr / {server_reported}:port> <scope_name>] ..."
  48. .br
  49. .RE
  50. ]
  51. .br
  52. .BR --transport-mode " <udp/tcp>"
  53. .br
  54. (transport-mode=udp?
  55. .br
  56. .RS
  57. .BR --encryption-mode " <blowfish/aes/none>"
  58. .br
  59. .BR --hash-mode " <md5/sha1/none>"
  60. .br
  61. .RB "[" --otp " <blowfish/aes> <num> <num-warn>]"
  62. .br
  63. .RB "[" --fragmentation-latency " <milliseconds>]"
  64. .br
  65. .RE
  66. )
  67. .br
  68. (transport-mode=tcp?
  69. .br
  70. .RS
  71. .RB "(ssl? [" --peer-ssl "])"
  72. .br
  73. .RB "[" --peer-tcp-socket-sndbuf " <bytes / 0>]"
  74. .br
  75. .RE
  76. )
  77. .br
  78. .RB "[" --send-buffer-size " <num-packets>]"
  79. .br
  80. .RB "[" --send-buffer-relay-size " <num-packets>]"
  81. .br
  82. .RB "[" --max-macs " <num>]"
  83. .br
  84. .RB "[" --max-groups " <num>]"
  85. .br
  86. .RB "[" --igmp-group-membership-interval " <ms>]"
  87. .br
  88. .RB "[" --igmp-last-member-query-time " <ms>]"
  89. .br
  90. .RE
  91. .SH INTRODUCTION
  92. .P
  93. This page documents the BadVPN client, a daemon for a node in a BadVPN VPN network.
  94. For a general description of BadVPN, see
  95. .BR badvpn (7).
  96. .SH DESCRIPTION
  97. .P
  98. The BadVPN client is a daemon that runs on a VPN node. It opens the TAP device, connects to
  99. the server, then keeps running while attempting to establish data connection to peers and
  100. tranferring data between the TAP device and the peers. Once it initializes, the program only
  101. terminates if it loses connection to the server, or if a signal is received.
  102. .SH OPTIONS
  103. .P
  104. The BadVPN client is configured entirely from command line.
  105. .TP
  106. .BR --help
  107. Print version and command line syntax and exit.
  108. .TP
  109. .BR --version
  110. Print version and exit.
  111. .TP
  112. .BR --logger " <stdout/syslog>"
  113. Select where to log messages. Default is stdout. Syslog is not available on Windows.
  114. .TP
  115. .BR --syslog-facility " <string>"
  116. When logging to syslog, set the logging facility. The facility name must be in lower case.
  117. .TP
  118. .BR --syslog-ident " <string>"
  119. When logging to syslog, set the ident.
  120. .TP
  121. .BR --loglevel " <0-5/none/error/warning/notice/info/debug>"
  122. Set the default logging level.
  123. .TP
  124. .BR --channel-loglevel " <channel-name> <0-5/none/error/warning/notice/info/debug>"
  125. Set the logging level for a specific logging channel.
  126. .TP
  127. .BR --threads " <integer>"
  128. Hint for the number of additional threads to use for potentionally long computations (such as
  129. encryption and OTP generation). If zero (0) (default), additional threads will be disabled and all
  130. computations will be done in the event loop. If negative (<0), a guess will be made, possibly
  131. based on the number of CPUs. If positive (>0), the given number of threads will be used.
  132. .TP
  133. .BR --ssl
  134. Use TLS. Requires --nssdb and --server-cert-name.
  135. .TP
  136. .BR --nssdb " <string>"
  137. When using TLS, the NSS database to use. Probably something like sql:/some/folder.
  138. .TP
  139. .BR --client-cert-name " <string>"
  140. When using TLS, the name of the certificate to use. The certificate must be readily accessible.
  141. .TP
  142. .BR --server-name " <string>"
  143. Set the name of the server used for validating the server's certificate. The server name defaults
  144. to the the name in the server address (or a numeric address).
  145. .TP
  146. .BR --server-addr " <addr>"
  147. Set the address for the server to listen on. See below for address format.
  148. .TP
  149. .BR --tapdev " <name>"
  150. Set the TAP device to use. See below on how to configure the device. A TAP device is a virtual card
  151. in the operating system, but rather than receiving from and sending frames to a piece of hardware,
  152. a program (this one) opens it to read from and write frames into. If the VPN network is set up correctly,
  153. the TAP devices on the VPN nodes will act as if they were all connected into a network switch.
  154. .TP
  155. .BR --scope " <scope_name>"
  156. Add an address scope allowed for connecting to peers. May be specified multiple times to add multiple
  157. scopes. The order of the scopes is irrelevant. Note that it must actually be possible to connect
  158. to addresses in the given scope; when another peer binds for us to connect to, we choose the first
  159. external address whose scope we recognize, and do not attempt further external addresses, even if
  160. establishing the connection fails.
  161. .TP
  162. .BR --bind-addr " <addr>"
  163. Add an address to allow binding on. See below for address format. When attempting to bind in order
  164. for some peer to connect to us, the addresses will be tried in the order they are specified. If UDP
  165. data transport is being used, a --num-ports option must follow to specify how many continuous ports
  166. to allow binding to. For the address to be useful, one or more --ext-addr options must follow.
  167. Note that when two peers need to establish a data connection, it is arbitrary which one will attempt
  168. to bind first.
  169. .TP
  170. .BR --num-ports " <num>"
  171. When using UDP transport, set the number of continuous ports for a previously specified bind address.
  172. Must follow a previous --bind-addr option.
  173. .TP
  174. .BR --ext-addr " <addr / {server_reported}:port> <scope_name>"
  175. Add an external address for a previously specified bind address. Must follow a previous --bind-addr
  176. option. May be specified multiple times to add multiple external addresses. See below for address
  177. format. Additionally, the IP address part can be {server_reported} to use the IPv4 address as the
  178. server sees us. The external addresses are tried by the connecting peer in the order they are specified.
  179. Note that the connecting peer only attempts to connect to the first address whose scope it recognizes
  180. and does not try other addresses. This means that all addresses must work for be able to communicate.
  181. .TP
  182. .BR --transport-mode " <udp/tcp>"
  183. Sets the transport protocol for data connections. UDP is recommended and works best for most networks.
  184. TCP can be used instead if the underlying network has high packet loss which your virtual network
  185. cannot tolerate. Must match on all peers.
  186. .TP
  187. .BR --encryption-mode " <blowfish/aes/none>"
  188. When using UDP transport, sets the encryption mode. None means no encryption, other options mean
  189. a specific cipher. Note that encryption is only useful if clients use TLS to connect to the server.
  190. The encryption mode must match on all peers.
  191. .TP
  192. .BR --hash-mode " <md5/sha1/none>"
  193. When using UDP transport, sets the hashing mode. None means no hashes, other options mean a specific
  194. type of hash. Note that hashing is only useful if encryption is used as well. The hash mode must
  195. match on all peers.
  196. .TP
  197. .BR --otp " <blowfish/aes> <num> <num-warn>"
  198. When using UDP transport, enables one-time passwords. The first argument specifies a block cipher
  199. used to generate passwords from a seed. The second argument specifies how many passwords are
  200. generated from a single seed. The third argument specifies after how many passwords used up for
  201. sending packets an attempt is made to negotiate a new seed with the other peer. num must be >0,
  202. and num-warn must be >0 and <=num. The difference (num - num-warn) should be large enough to allow
  203. a new seed to be negotiated before the sender runs out of passwords. Negotiating a seed involves
  204. the sending peer sending it to the receiving peer via the server and the receiving peer confirming
  205. it via the server. Note that one-time passwords are only useful if clients use TLS to connect to the
  206. server. The OTP option must match on all peers, except for num-warn.
  207. .TP
  208. .BR --fragmentation-latency " <milliseconds>"
  209. When using UDP transport, sets the maximum latency to sacrifice in order to pack frames into data
  210. packets more efficiently. If it is >=0, a timer of that many milliseconds is used to wait for further
  211. frames to put into an incomplete packet since the first chunk of the packet was written. If it is
  212. <0, packets are sent out immediately. Defaults to 0, which is the recommended setting.
  213. .TP
  214. .BR --peer-ssl
  215. When using TCP transport, enables TLS for data connections. Requires using TLS for server connection.
  216. For this to work, the peers must trust each others' cerificates, and the cerificates must grant the
  217. TLS server usage context. This option must match on all peers.
  218. .TP
  219. .BR --peer-tcp-socket-sndbuf " <bytes / 0>"
  220. Sets the value of the SO_SNDBUF socket option for peer TCP sockets (zero to not set). Lower values
  221. will improve fairness when data from multiple sources (local and relaying) is being sent to a
  222. given peer, but may result in lower bandwidth if the network's bandwidth-delay product to too big.
  223. .TP
  224. .BR --send-buffer-size " <num-packets>"
  225. Sets the minimum size of the peers' send buffers for sending frames originating from this system, in
  226. number of packets.
  227. .TP
  228. .BR --send-buffer-relay-size " <num-packets>"
  229. Sets the minimum size of the peers' send buffers for relaying frames from other peers, in number of
  230. packets.
  231. .TP
  232. .BR --max-macs " <num>"
  233. Sets the maximum number of MAC addresses to remember for a peer. When the number is exceeded, the least
  234. recently used slot will be reused.
  235. .TP
  236. .BR --max-groups " <num>"
  237. Sets the maximum number of IGMP group memberships to remember for a peer. When the number is exceeded,
  238. the least recently used slot will be reused.
  239. .TP
  240. .BR --igmp-group-membership-interval " <ms>"
  241. Sets the Group Membership Interval parameter for IGMP snooping, in milliseconds.
  242. .TP
  243. .BR --igmp-last-member-query-time " <ms>"
  244. Sets the Last Member Query Time parameter for IGMP snooping, in milliseconds.
  245. .SH "EXIT CODE"
  246. .P
  247. If initialization fails, exits with code 1. Otherwise runs until termination is requested or server connection
  248. is broken and exits with code 1.
  249. .SH "ADDRESS FORMAT"
  250. .P
  251. Addresses have the form ipaddr:port, where ipaddr is either an IPv4 address (name or numeric), or an
  252. IPv6 address enclosed in brackets [] (name or numeric again).
  253. .SH "TAP DEVICE CONFIGURATION"
  254. .P
  255. To use this program, you first have to configure a TAP network device that will act as an endpoint for
  256. the virtual network. The configuration depends on your operating system.
  257. .P
  258. Note that the client program does not configure the TAP device in any way; it only reads and writes
  259. frames from/to it. You are responsible for configuring it (e.g. putting it up and setting its IP address).
  260. .P
  261. .B Linux
  262. .P
  263. You need to enable the kernel configuration option CONFIG_TUN. If you enabled it as a module, you may
  264. have to load it (`modprobe tun`) before you can create the device.
  265. .P
  266. Then you should create a persistent TAP device for the VPN client program to open. This can be done with
  267. either the
  268. .B tunctl
  269. or the
  270. .B openvpn
  271. program. The device will be associated with a user account that will have permission to use it, which should
  272. be the same user as the client program will run as (not root!). To create the device with tunctl, use `tunctl -u <user> -t tapN`,
  273. and to create it with openvpn, use `openvpn --mktun --user <user> --dev tapN`, where N is a number that identifies the
  274. TAP device.
  275. .P
  276. Once the TAP device is created, pass `--tapdev tapN` to the client program to make it use this device. Note that the
  277. device will not be preserved across a shutdown of the system; consult your OS documentaton if you want to automate
  278. the creation or configuration of the device.
  279. .P
  280. .B Windows
  281. .P
  282. Windows does not come with a TAP driver. The client program uses the TAP-Win32 driver, which is part of OpenVPN.
  283. You need to install the OpenVPN open source (!) version, and in the installer enable at least the
  284. `TAP Virtual Ethernet Adapter` and `Add Shortcuts to Start Menu` options.
  285. You can get the installer at
  286. .br
  287. <http://openvpn.net/index.php/open-source/downloads.html>.
  288. .P
  289. The OpenVPN installer automatically creates one TAP device on your system when it's run for the first time.
  290. To create another device, use `Programs -> OpenVPN -> Utilities -> Add a new TAP virtual ethernet adapter`.
  291. You may have to install OpenVPN once again to make this shortcut appear.
  292. .P
  293. Once you have a TAP device, you can configure it like a physical network card. You can recognize TAP devices
  294. by their `Device Name` field.
  295. .P
  296. To use the device, pass `--tapdev "<driver_name>:<interface_name>"` to the client program, where <driver_name> is the name of
  297. the TAP driver (tap0901 for OpenVPN 2.1 and 2.2) (case sensitive), and <interface_name> is the (human) name of the TAP
  298. network interface (e.g. `Local Area Connection 2`).
  299. .SH "EXAMPLES"
  300. .P
  301. For examples of using BadVPN, see
  302. .BR badvpn (7).
  303. .SH "SEE ALSO"
  304. .BR badvpn-server (8),
  305. .BR badvpn (7)
  306. .SH COPYRIGHT
  307. Copyright (C) 2010 Ambroz Bizjak. BadVPN is free software; you can redistribute it and/or
  308. modify it under the terms of the GNU General Public License version 2 as published by the
  309. Free Software Foundation.
  310. .SH AUTHORS
  311. Ambroz Bizjak <ambrop7@gmail.com>