openvpn.config 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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. # LZ4 requires OpenVPN 2.4+ client and server
  215. # option compress lz4
  216. # LZO is compatible with most OpenVPN versions
  217. # (set "compress lzo" on 2.4+ clients, and "comp-lzo yes" on older clients)
  218. option compress lzo
  219. # The maximum number of concurrently connected
  220. # clients we want to allow.
  221. # option max_clients 100
  222. # The persist options will try to avoid
  223. # accessing certain resources on restart
  224. # that may no longer be accessible because
  225. # of the privilege downgrade.
  226. option persist_key 1
  227. option persist_tun 1
  228. option user nobody
  229. # Output a short status file showing
  230. # current connections, truncated
  231. # and rewritten every minute.
  232. option status /tmp/openvpn-status.log
  233. # By default, log messages will go to the syslog (or
  234. # on Windows, if running as a service, they will go to
  235. # the "\Program Files\OpenVPN\log" directory).
  236. # Use log or log-append to override this default.
  237. # "log" will truncate the log file on OpenVPN startup,
  238. # while "log-append" will append to it. Use one
  239. # or the other (but not both).
  240. # option log /tmp/openvpn.log
  241. # option log_append /tmp/openvpn.log
  242. # Set the appropriate level of log
  243. # file verbosity.
  244. #
  245. # 0 is silent, except for fatal errors
  246. # 4 is reasonable for general usage
  247. # 5 and 6 can help to debug connection problems
  248. # 9 is extremely verbose
  249. option verb 3
  250. # Silence repeating messages. At most 20
  251. # sequential messages of the same message
  252. # category will be output to the log.
  253. # option mute 20
  254. ##############################################
  255. # Sample client-side OpenVPN 2.0 uci config #
  256. # for connecting to multi-client server. #
  257. ##############################################
  258. config openvpn sample_client
  259. # Set to 1 to enable this instance:
  260. option enabled 0
  261. # Specify that we are a client and that we
  262. # will be pulling certain config file directives
  263. # from the server.
  264. option client 1
  265. # Use the same setting as you are using on
  266. # the server.
  267. # On most systems, the VPN will not function
  268. # unless you partially or fully disable
  269. # the firewall for the TUN/TAP interface.
  270. # option dev tap
  271. option dev tun
  272. # Are we connecting to a TCP or
  273. # UDP server? Use the same setting as
  274. # on the server.
  275. # option proto tcp
  276. option proto udp
  277. # The hostname/IP and port of the server.
  278. # You can have multiple remote entries
  279. # to load balance between the servers.
  280. list remote "my_server_1 1194"
  281. # list remote "my_server_2 1194"
  282. # Choose a random host from the remote
  283. # list for load_balancing. Otherwise
  284. # try hosts in the order specified.
  285. # option remote_random 1
  286. # Keep trying indefinitely to resolve the
  287. # host name of the OpenVPN server. Very useful
  288. # on machines which are not permanently connected
  289. # to the internet such as laptops.
  290. option resolv_retry infinite
  291. # Most clients don't need to bind to
  292. # a specific local port number.
  293. option nobind 1
  294. # Try to preserve some state across restarts.
  295. option persist_key 1
  296. option persist_tun 1
  297. option user nobody
  298. # If you are connecting through an
  299. # HTTP proxy to reach the actual OpenVPN
  300. # server, put the proxy server/IP and
  301. # port number here. See the man page
  302. # if your proxy server requires
  303. # authentication.
  304. # retry on connection failures:
  305. # option http_proxy_retry 1
  306. # specify http proxy address and port:
  307. # option http_proxy "192.168.1.100 8080"
  308. # Wireless networks often produce a lot
  309. # of duplicate packets. Set this flag
  310. # to silence duplicate packet warnings.
  311. # option mute_replay_warnings 1
  312. # SSL/TLS parms.
  313. # See the server config file for more
  314. # description. It's best to use
  315. # a separate .crt/.key file pair
  316. # for each client. A single ca
  317. # file can be used for all clients.
  318. option ca /etc/openvpn/ca.crt
  319. option cert /etc/openvpn/client.crt
  320. option key /etc/openvpn/client.key
  321. # Verify server certificate by checking
  322. # that the certicate has the nsCertType
  323. # field set to "server". This is an
  324. # important precaution to protect against
  325. # a potential attack discussed here:
  326. # http://openvpn.net/howto.html#mitm
  327. #
  328. # To use this feature, you will need to generate
  329. # your server certificates with the nsCertType
  330. # field set to "server". The build_key_server
  331. # script in the easy_rsa folder will do this.
  332. # option ns_cert_type server
  333. # If a tls_auth key is used on the server
  334. # then every client must also have the key.
  335. # option tls_auth "/etc/openvpn/ta.key 1"
  336. # Select a cryptographic cipher.
  337. # If the cipher option is used on the server
  338. # then you must also specify it here.
  339. # option cipher x
  340. # Enable compression on the VPN link.
  341. # Don't enable this unless it is also
  342. # enabled in the server config file.
  343. # LZ4 requires OpenVPN 2.4+ on server and client
  344. # option compress lz4
  345. # LZO is compatible with most OpenVPN versions
  346. option compress lzo
  347. # Set log file verbosity.
  348. option verb 3
  349. # Silence repeating messages
  350. # option mute 20