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.

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