badvpn-client.8 12 KB

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