openvpn.config 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. package openvpn
  2. #################################################
  3. # Sample to include a custom config file. #
  4. #################################################
  5. config openvpn custom_config
  6. # Set to 1 to enable this instance:
  7. option enabled 0
  8. # Include OpenVPN configuration
  9. option config /etc/openvpn/my-vpn.conf
  10. #################################################
  11. # Sample OpenVPN 2.0 uci config for #
  12. # multi-client server. #
  13. #################################################
  14. config openvpn sample_server
  15. # Set to 1 to enable this instance:
  16. option enabled 0
  17. # Which local IP address should OpenVPN
  18. # listen on? (optional)
  19. # option local 0.0.0.0
  20. # Which TCP/UDP port should OpenVPN listen on?
  21. # If you want to run multiple OpenVPN instances
  22. # on the same machine, use a different port
  23. # number for each one. You will need to
  24. # open up this port on your firewall.
  25. option port 1194
  26. # TCP or UDP server?
  27. # option proto tcp
  28. option proto udp
  29. # "dev tun" will create a routed IP tunnel,
  30. # "dev tap" will create an ethernet tunnel.
  31. # Use "dev tap0" if you are ethernet bridging
  32. # and have precreated a tap0 virtual interface
  33. # and bridged it with your ethernet interface.
  34. # If you want to control access policies
  35. # over the VPN, you must create firewall
  36. # rules for the the TUN/TAP interface.
  37. # On non-Windows systems, you can give
  38. # an explicit unit number, such as tun0.
  39. # On Windows, use "dev-node" for this.
  40. # On most systems, the VPN will not function
  41. # unless you partially or fully disable
  42. # the firewall for the TUN/TAP interface.
  43. # option dev tap
  44. option dev tun
  45. # SSL/TLS root certificate (ca), certificate
  46. # (cert), and private key (key). Each client
  47. # and the server must have their own cert and
  48. # key file. The server and all clients will
  49. # use the same ca file.
  50. #
  51. # See the "easy-rsa" directory for a series
  52. # of scripts for generating RSA certificates
  53. # and private keys. Remember to use
  54. # a unique Common Name for the server
  55. # and each of the client certificates.
  56. #
  57. # Any X509 key management system can be used.
  58. # OpenVPN can also use a PKCS #12 formatted key file
  59. # (see "pkcs12" directive in man page).
  60. option ca /etc/openvpn/ca.crt
  61. option cert /etc/openvpn/server.crt
  62. # This file should be kept secret:
  63. option key /etc/openvpn/server.key
  64. # Diffie hellman parameters.
  65. # Generate your own with:
  66. # openssl dhparam -out dh1024.pem 1024
  67. # Substitute 2048 for 1024 if you are using
  68. # 2048 bit keys.
  69. option dh /etc/openvpn/dh1024.pem
  70. # Configure server mode and supply a VPN subnet
  71. # for OpenVPN to draw client addresses from.
  72. # The server will take 10.8.0.1 for itself,
  73. # the rest will be made available to clients.
  74. # Each client will be able to reach the server
  75. # on 10.8.0.1. Comment this line out if you are
  76. # ethernet bridging. See the man page for more info.
  77. option server "10.8.0.0 255.255.255.0"
  78. # Maintain a record of client <-> virtual IP address
  79. # associations in this file. If OpenVPN goes down or
  80. # is restarted, reconnecting clients can be assigned
  81. # the same virtual IP address from the pool that was
  82. # previously assigned.
  83. option ifconfig_pool_persist /tmp/ipp.txt
  84. # Configure server mode for ethernet bridging.
  85. # You must first use your OS's bridging capability
  86. # to bridge the TAP interface with the ethernet
  87. # NIC interface. Then you must manually set the
  88. # IP/netmask on the bridge interface, here we
  89. # assume 10.8.0.4/255.255.255.0. Finally we
  90. # must set aside an IP range in this subnet
  91. # (start=10.8.0.50 end=10.8.0.100) to allocate
  92. # to connecting clients. Leave this line commented
  93. # out unless you are ethernet bridging.
  94. # option server_bridge "10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100"
  95. # Push routes to the client to allow it
  96. # to reach other private subnets behind
  97. # the server. Remember that these
  98. # private subnets will also need
  99. # to know to route the OpenVPN client
  100. # address pool (10.8.0.0/255.255.255.0)
  101. # back to the OpenVPN server.
  102. # list push "route 192.168.10.0 255.255.255.0"
  103. # list push "route 192.168.20.0 255.255.255.0"
  104. # To assign specific IP addresses to specific
  105. # clients or if a connecting client has a private
  106. # subnet behind it that should also have VPN access,
  107. # use the subdirectory "ccd" for client-specific
  108. # configuration files (see man page for more info).
  109. # EXAMPLE: Suppose the client
  110. # having the certificate common name "Thelonious"
  111. # also has a small subnet behind his connecting
  112. # machine, such as 192.168.40.128/255.255.255.248.
  113. # First, uncomment out these lines:
  114. # option client_config_dir /etc/openvpn/ccd
  115. # list route "192.168.40.128 255.255.255.248"
  116. # Then create a file ccd/Thelonious with this line:
  117. # iroute 192.168.40.128 255.255.255.248
  118. # This will allow Thelonious' private subnet to
  119. # access the VPN. This example will only work
  120. # if you are routing, not bridging, i.e. you are
  121. # using "dev tun" and "server" directives.
  122. # EXAMPLE: Suppose you want to give
  123. # Thelonious a fixed VPN IP address of 10.9.0.1.
  124. # First uncomment out these lines:
  125. # option client_config_dir /etc/openvpn/ccd
  126. # list route "10.9.0.0 255.255.255.252"
  127. # list route "192.168.100.0 255.255.255.0"
  128. # Then add this line to ccd/Thelonious:
  129. # ifconfig-push "10.9.0.1 10.9.0.2"
  130. # Suppose that you want to enable different
  131. # firewall access policies for different groups
  132. # of clients. There are two methods:
  133. # (1) Run multiple OpenVPN daemons, one for each
  134. # group, and firewall the TUN/TAP interface
  135. # for each group/daemon appropriately.
  136. # (2) (Advanced) Create a script to dynamically
  137. # modify the firewall in response to access
  138. # from different clients. See man
  139. # page for more info on learn-address script.
  140. # option learn_address /etc/openvpn/script
  141. # If enabled, this directive will configure
  142. # all clients to redirect their default
  143. # network gateway through the VPN, causing
  144. # all IP traffic such as web browsing and
  145. # and DNS lookups to go through the VPN
  146. # (The OpenVPN server machine may need to NAT
  147. # the TUN/TAP interface to the internet in
  148. # order for this to work properly).
  149. # CAVEAT: May break client's network config if
  150. # client's local DHCP server packets get routed
  151. # through the tunnel. Solution: make sure
  152. # client's local DHCP server is reachable via
  153. # a more specific route than the default route
  154. # of 0.0.0.0/0.0.0.0.
  155. # list push "redirect-gateway"
  156. # Certain Windows-specific network settings
  157. # can be pushed to clients, such as DNS
  158. # or WINS server addresses. CAVEAT:
  159. # http://openvpn.net/faq.html#dhcpcaveats
  160. # list push "dhcp-option DNS 10.8.0.1"
  161. # list push "dhcp-option WINS 10.8.0.1"
  162. # Uncomment this directive to allow different
  163. # clients to be able to "see" each other.
  164. # By default, clients will only see the server.
  165. # To force clients to only see the server, you
  166. # will also need to appropriately firewall the
  167. # server's TUN/TAP interface.
  168. # option client_to_client 1
  169. # Uncomment this directive if multiple clients
  170. # might connect with the same certificate/key
  171. # files or common names. This is recommended
  172. # only for testing purposes. For production use,
  173. # each client should have its own certificate/key
  174. # pair.
  175. #
  176. # IF YOU HAVE NOT GENERATED INDIVIDUAL
  177. # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
  178. # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
  179. # UNCOMMENT THIS LINE OUT.
  180. # option duplicate_cn 1
  181. # The keepalive directive causes ping-like
  182. # messages to be sent back and forth over
  183. # the link so that each side knows when
  184. # the other side has gone down.
  185. # Ping every 10 seconds, assume that remote
  186. # peer is down if no ping received during
  187. # a 120 second time period.
  188. option keepalive "10 120"
  189. # For extra security beyond that provided
  190. # by SSL/TLS, create an "HMAC firewall"
  191. # to help block DoS attacks and UDP port flooding.
  192. #
  193. # Generate with:
  194. # openvpn --genkey --secret ta.key
  195. #
  196. # The server and each client must have
  197. # a copy of this key.
  198. # The second parameter should be '0'
  199. # on the server and '1' on the clients.
  200. # This file is secret:
  201. # option tls_auth "/etc/openvpn/ta.key 0"
  202. # Select a cryptographic cipher.
  203. # This config item must be copied to
  204. # the client config file as well.
  205. # Blowfish (default):
  206. # option cipher BF-CBC
  207. # AES:
  208. # option cipher AES-128-CBC
  209. # Triple-DES:
  210. # option cipher DES-EDE3-CBC
  211. # Enable compression on the VPN link.
  212. # If you enable it here, you must also
  213. # enable it in the client config file.
  214. option comp_lzo yes
  215. # The maximum number of concurrently connected
  216. # clients we want to allow.
  217. # option max_clients 100
  218. # The persist options will try to avoid
  219. # accessing certain resources on restart
  220. # that may no longer be accessible because
  221. # of the privilege downgrade.
  222. option persist_key 1
  223. option persist_tun 1
  224. option user nobody
  225. # Output a short status file showing
  226. # current connections, truncated
  227. # and rewritten every minute.
  228. option status /tmp/openvpn-status.log
  229. # By default, log messages will go to the syslog (or
  230. # on Windows, if running as a service, they will go to
  231. # the "\Program Files\OpenVPN\log" directory).
  232. # Use log or log-append to override this default.
  233. # "log" will truncate the log file on OpenVPN startup,
  234. # while "log-append" will append to it. Use one
  235. # or the other (but not both).
  236. # option log /tmp/openvpn.log
  237. # option log_append /tmp/openvpn.log
  238. # Set the appropriate level of log
  239. # file verbosity.
  240. #
  241. # 0 is silent, except for fatal errors
  242. # 4 is reasonable for general usage
  243. # 5 and 6 can help to debug connection problems
  244. # 9 is extremely verbose
  245. option verb 3
  246. # Silence repeating messages. At most 20
  247. # sequential messages of the same message
  248. # category will be output to the log.
  249. # option mute 20
  250. ##############################################
  251. # Sample client-side OpenVPN 2.0 uci config #
  252. # for connecting to multi-client server. #
  253. ##############################################
  254. config openvpn sample_client
  255. # Set to 1 to enable this instance:
  256. option enabled 0
  257. # Specify that we are a client and that we
  258. # will be pulling certain config file directives
  259. # from the server.
  260. option client 1
  261. # Use the same setting as you are using on
  262. # the server.
  263. # On most systems, the VPN will not function
  264. # unless you partially or fully disable
  265. # the firewall for the TUN/TAP interface.
  266. # option dev tap
  267. option dev tun
  268. # Are we connecting to a TCP or
  269. # UDP server? Use the same setting as
  270. # on the server.
  271. # option proto tcp
  272. option proto udp
  273. # The hostname/IP and port of the server.
  274. # You can have multiple remote entries
  275. # to load balance between the servers.
  276. list remote "my_server_1 1194"
  277. # list remote "my_server_2 1194"
  278. # Choose a random host from the remote
  279. # list for load_balancing. Otherwise
  280. # try hosts in the order specified.
  281. # option remote_random 1
  282. # Keep trying indefinitely to resolve the
  283. # host name of the OpenVPN server. Very useful
  284. # on machines which are not permanently connected
  285. # to the internet such as laptops.
  286. option resolv_retry infinite
  287. # Most clients don't need to bind to
  288. # a specific local port number.
  289. option nobind 1
  290. # Try to preserve some state across restarts.
  291. option persist_key 1
  292. option persist_tun 1
  293. option user nobody
  294. # If you are connecting through an
  295. # HTTP proxy to reach the actual OpenVPN
  296. # server, put the proxy server/IP and
  297. # port number here. See the man page
  298. # if your proxy server requires
  299. # authentication.
  300. # retry on connection failures:
  301. # option http_proxy_retry 1
  302. # specify http proxy address and port:
  303. # option http_proxy "192.168.1.100 8080"
  304. # Wireless networks often produce a lot
  305. # of duplicate packets. Set this flag
  306. # to silence duplicate packet warnings.
  307. # option mute_replay_warnings 1
  308. # SSL/TLS parms.
  309. # See the server config file for more
  310. # description. It's best to use
  311. # a separate .crt/.key file pair
  312. # for each client. A single ca
  313. # file can be used for all clients.
  314. option ca /etc/openvpn/ca.crt
  315. option cert /etc/openvpn/client.crt
  316. option key /etc/openvpn/client.key
  317. # Verify server certificate by checking
  318. # that the certicate has the nsCertType
  319. # field set to "server". This is an
  320. # important precaution to protect against
  321. # a potential attack discussed here:
  322. # http://openvpn.net/howto.html#mitm
  323. #
  324. # To use this feature, you will need to generate
  325. # your server certificates with the nsCertType
  326. # field set to "server". The build_key_server
  327. # script in the easy_rsa folder will do this.
  328. # option ns_cert_type server
  329. # If a tls_auth key is used on the server
  330. # then every client must also have the key.
  331. # option tls_auth "/etc/openvpn/ta.key 1"
  332. # Select a cryptographic cipher.
  333. # If the cipher option is used on the server
  334. # then you must also specify it here.
  335. # option cipher x
  336. # Enable compression on the VPN link.
  337. # Don't enable this unless it is also
  338. # enabled in the server config file.
  339. option comp_lzo yes
  340. # Set log file verbosity.
  341. option verb 3
  342. # Silence repeating messages
  343. # option mute 20