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.

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