You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

493 lines
16 KiB

  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 dh2048.pem 2048
  67. # Substitute 2048 for 1024 if you are using
  68. # 1024 bit keys.
  69. option dh /etc/openvpn/dh2048.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. # For additional privacy, a shared secret key
  203. # can be used for both authentication (as in tls_auth)
  204. # and encryption of the TLS control channel.
  205. #
  206. # Generate a shared secret with:
  207. # openvpn --genkey --secret ta.key
  208. #
  209. # The server and each client must have
  210. # a copy of this key.
  211. #
  212. # tls_auth and tls_crypt should NOT
  213. # be combined, as tls_crypt implies tls_auth.
  214. # Use EITHER tls_crypt, tls_auth, or neither option.
  215. # option tls_crypt "/etc/openvpn/ta.key"
  216. # Set the minimum required TLS protocol version
  217. # for all connections.
  218. #
  219. # Require at least TLS 1.1
  220. # option tls_version_min "1.1"
  221. # Require at least TLS 1.2
  222. # option tls_version_min "1.2"
  223. # Require TLS 1.2, or the highest version supported
  224. # on the system
  225. # option tls_version_min "1.2 'or-highest'"
  226. # List the preferred ciphers to use for the data channel.
  227. # Run openvpn --show-ciphers to see all supported ciphers.
  228. # list data_ciphers 'AES-256-GCM'
  229. # list data_ciphers 'AES-128-GCM'
  230. # list data_ciphers 'CHACHA20-POLY1305'
  231. # Set a fallback cipher in order to be compatible with
  232. # peers that do not support cipher negotiation.
  233. #
  234. # Use AES-256-CBC as fallback
  235. # option data_ciphers_fallback 'AES-128-CBC'
  236. # Use AES-128-CBC as fallback
  237. # option data_ciphers_fallback 'AES-256-CBC'
  238. # Use Triple-DES as fallback
  239. # option data_ciphers_fallback 'DES-EDE3-CBC'
  240. # Use BF-CBC as fallback
  241. # option data_ciphers_fallback 'BF-CBC'
  242. # OpenVPN versions 2.4 and later will attempt to
  243. # automatically negotiate the most secure cipher
  244. # between the client and server, regardless of a
  245. # configured "option cipher" (see below).
  246. # Automatic negotiation is recommended.
  247. #
  248. # Uncomment this option to disable this behavior,
  249. # and force all OpenVPN peers to use the configured
  250. # cipher option instead (not recommended).
  251. # option ncp_disable
  252. # Enable compression on the VPN link.
  253. # If you enable it here, you must also
  254. # enable it in the client config file.
  255. #
  256. # Compression is not recommended, as compression and
  257. # encryption in combination can weaken the security
  258. # of the connection.
  259. #
  260. # LZ4 requires OpenVPN 2.4+ client and server
  261. # option compress lz4
  262. # Control how OpenVPN handles peers using compression
  263. #
  264. # Do not allow any connections using compression
  265. # option allow_compression 'no'
  266. # Allow incoming compressed packets, but do not send compressed packets to other peers
  267. # This can be useful when migrating old configurations with compression activated
  268. # option allow_compression 'asym'
  269. # Both incoming and outgoing packets may be compressed
  270. # option allow_compression 'yes'
  271. # The maximum number of concurrently connected
  272. # clients we want to allow.
  273. # option max_clients 100
  274. # The persist options will try to avoid
  275. # accessing certain resources on restart
  276. # that may no longer be accessible because
  277. # of the privilege downgrade.
  278. option persist_key 1
  279. option persist_tun 1
  280. option user nobody
  281. # Output a short status file showing
  282. # current connections, truncated
  283. # and rewritten every minute.
  284. option status /tmp/openvpn-status.log
  285. # By default, log messages will go to the syslog (or
  286. # on Windows, if running as a service, they will go to
  287. # the "\Program Files\OpenVPN\log" directory).
  288. # Use log or log-append to override this default.
  289. # "log" will truncate the log file on OpenVPN startup,
  290. # while "log-append" will append to it. Use one
  291. # or the other (but not both).
  292. # option log /tmp/openvpn.log
  293. # option log_append /tmp/openvpn.log
  294. # Set the appropriate level of log
  295. # file verbosity.
  296. #
  297. # 0 is silent, except for fatal errors
  298. # 4 is reasonable for general usage
  299. # 5 and 6 can help to debug connection problems
  300. # 9 is extremely verbose
  301. option verb 3
  302. # Silence repeating messages. At most 20
  303. # sequential messages of the same message
  304. # category will be output to the log.
  305. # option mute 20
  306. ##############################################
  307. # Sample client-side OpenVPN 2.0 uci config #
  308. # for connecting to multi-client server. #
  309. ##############################################
  310. config openvpn sample_client
  311. # Set to 1 to enable this instance:
  312. option enabled 0
  313. # Specify that we are a client and that we
  314. # will be pulling certain config file directives
  315. # from the server.
  316. option client 1
  317. # Use the same setting as you are using on
  318. # the server.
  319. # On most systems, the VPN will not function
  320. # unless you partially or fully disable
  321. # the firewall for the TUN/TAP interface.
  322. # option dev tap
  323. option dev tun
  324. # Are we connecting to a TCP or
  325. # UDP server? Use the same setting as
  326. # on the server.
  327. # option proto tcp
  328. option proto udp
  329. # The hostname/IP and port of the server.
  330. # You can have multiple remote entries
  331. # to load balance between the servers.
  332. list remote "my_server_1 1194"
  333. # list remote "my_server_2 1194"
  334. # Choose a random host from the remote
  335. # list for load_balancing. Otherwise
  336. # try hosts in the order specified.
  337. # option remote_random 1
  338. # Keep trying indefinitely to resolve the
  339. # host name of the OpenVPN server. Very useful
  340. # on machines which are not permanently connected
  341. # to the internet such as laptops.
  342. option resolv_retry infinite
  343. # Most clients don't need to bind to
  344. # a specific local port number.
  345. option nobind 1
  346. # Try to preserve some state across restarts.
  347. option persist_key 1
  348. option persist_tun 1
  349. option user nobody
  350. # If you are connecting through an
  351. # HTTP proxy to reach the actual OpenVPN
  352. # server, put the proxy server/IP and
  353. # port number here. See the man page
  354. # if your proxy server requires
  355. # authentication.
  356. # retry on connection failures:
  357. # option http_proxy_retry 1
  358. # specify http proxy address and port:
  359. # option http_proxy "192.168.1.100 8080"
  360. # Wireless networks often produce a lot
  361. # of duplicate packets. Set this flag
  362. # to silence duplicate packet warnings.
  363. # option mute_replay_warnings 1
  364. # SSL/TLS parms.
  365. # See the server config file for more
  366. # description. It's best to use
  367. # a separate .crt/.key file pair
  368. # for each client. A single ca
  369. # file can be used for all clients.
  370. option ca /etc/openvpn/ca.crt
  371. option cert /etc/openvpn/client.crt
  372. option key /etc/openvpn/client.key
  373. # Verify server certificate by checking
  374. # that the certicate has the key usage
  375. # field set to "server". This is an
  376. # important precaution to protect against
  377. # a potential attack discussed here:
  378. # http://openvpn.net/howto.html#mitm
  379. #
  380. # To use this feature, you will need to generate
  381. # your server certificates with the nsCertType
  382. # field set to "server". The build_key_server
  383. # script in the easy_rsa folder will do this.
  384. # option remote_cert_tls server
  385. # If a tls_auth key is used on the server
  386. # then every client must also have the key.
  387. # option tls_auth "/etc/openvpn/ta.key 1"
  388. # If a tls_crypt key is used on the server
  389. # every client must also have the key.
  390. # option tls_crypt "/etc/openvpn/ta.key"
  391. # Set the minimum required TLS protocol version
  392. # for all connections.
  393. #
  394. # Require at least TLS 1.1
  395. # option tls_version_min "1.1"
  396. # Require at least TLS 1.2
  397. # option tls_version_min "1.2"
  398. # Require TLS 1.2, or the highest version supported
  399. # on the system
  400. # option tls_version_min "1.2 'or-highest'"
  401. # List the preferred ciphers for the data channel.
  402. # list data_ciphers 'AES-256-GCM'
  403. # list data_ciphers 'AES-128-GCM'
  404. # list data_ciphers 'CHACHA20-POLY1305'
  405. # Set a fallback cipher if you connect to a peer that does
  406. # not support cipher negotiation.
  407. # Use AES-256-CBC as fallback
  408. # option data_ciphers_fallback 'AES-128-CBC'
  409. # Use AES-128-CBC as fallback
  410. # option data_ciphers_fallback 'AES-256-CBC'
  411. # Use Triple-DES as fallback
  412. # option data_ciphers_fallback 'DES-EDE3-CBC'
  413. # Use BF-CBC as fallback
  414. # option data_ciphers_fallback 'BF-CBC'
  415. # Enable compression on the VPN link.
  416. # Don't enable this unless it is also
  417. # enabled in the server config file.
  418. #
  419. # Compression is not recommended, as compression and
  420. # encryption in combination can weaken the security
  421. # of the connection.
  422. #
  423. # LZ4 requires OpenVPN 2.4+ on server and client
  424. # option compress lz4
  425. # Set log file verbosity.
  426. option verb 3
  427. # Silence repeating messages
  428. # option mute 20