Нема описа
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.

etc_openvpn_server.conf.j2 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. #################################################
  2. # Sample OpenVPN 2.0 config file for #
  3. # multi-client server. #
  4. # #
  5. # This file is for the server side #
  6. # of a many-clients <-> one-server #
  7. # OpenVPN configuration. #
  8. # #
  9. # OpenVPN also supports #
  10. # single-machine <-> single-machine #
  11. # configurations (See the Examples page #
  12. # on the web site for more info). #
  13. # #
  14. # This config should work on Windows #
  15. # or Linux/BSD systems. Remember on #
  16. # Windows to quote pathnames and use #
  17. # double backslashes, e.g.: #
  18. # "C:\\Program Files\\OpenVPN\\config\\foo.key" #
  19. # #
  20. # Comments are preceded with '#' or ';' #
  21. #################################################
  22. # Which local IP address should OpenVPN
  23. # listen on? (optional)
  24. ;local a.b.c.d
  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. port 1194
  31. # TCP or UDP server?
  32. ;proto tcp
  33. 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. ;dev tap
  49. dev tun
  50. # Windows needs the TAP-Win32 adapter name
  51. # from the Network Connections panel if you
  52. # have more than one. On XP SP2 or higher,
  53. # you may need to selectively disable the
  54. # Windows firewall for the TAP adapter.
  55. # Non-Windows systems usually don't need this.
  56. ;dev-node MyTap
  57. # SSL/TLS root certificate (ca), certificate
  58. # (cert), and private key (key). Each client
  59. # and the server must have their own cert and
  60. # key file. The server and all clients will
  61. # use the same ca file.
  62. #
  63. # See the "easy-rsa" directory for a series
  64. # of scripts for generating RSA certificates
  65. # and private keys. Remember to use
  66. # a unique Common Name for the server
  67. # and each of the client certificates.
  68. #
  69. # Any X509 key management system can be used.
  70. # OpenVPN can also use a PKCS #12 formatted key file
  71. # (see "pkcs12" directive in man page).
  72. ca ca.crt
  73. cert server.crt
  74. key server.key # This file should be kept secret
  75. # Diffie hellman parameters.
  76. # Generate your own with:
  77. # openssl dhparam -out dh1024.pem 1024
  78. # Substitute 2048 for 1024 if you are using
  79. # 2048 bit keys.
  80. dh dh1024.pem
  81. # Configure server mode and supply a VPN subnet
  82. # for OpenVPN to draw client addresses from.
  83. # The server will take 10.8.0.1 for itself,
  84. # the rest will be made available to clients.
  85. # Each client will be able to reach the server
  86. # on 10.8.0.1. Comment this line out if you are
  87. # ethernet bridging. See the man page for more info.
  88. server 10.8.0.0 255.255.255.0
  89. # Maintain a record of client <-> virtual IP address
  90. # associations in this file. If OpenVPN goes down or
  91. # is restarted, reconnecting clients can be assigned
  92. # the same virtual IP address from the pool that was
  93. # previously assigned.
  94. ifconfig-pool-persist ipp.txt
  95. # Configure server mode for ethernet bridging.
  96. # You must first use your OS's bridging capability
  97. # to bridge the TAP interface with the ethernet
  98. # NIC interface. Then you must manually set the
  99. # IP/netmask on the bridge interface, here we
  100. # assume 10.8.0.4/255.255.255.0. Finally we
  101. # must set aside an IP range in this subnet
  102. # (start=10.8.0.50 end=10.8.0.100) to allocate
  103. # to connecting clients. Leave this line commented
  104. # out unless you are ethernet bridging.
  105. ;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
  106. # Configure server mode for ethernet bridging
  107. # using a DHCP-proxy, where clients talk
  108. # to the OpenVPN server-side DHCP server
  109. # to receive their IP address allocation
  110. # and DNS server addresses. You must first use
  111. # your OS's bridging capability to bridge the TAP
  112. # interface with the ethernet NIC interface.
  113. # Note: this mode only works on clients (such as
  114. # Windows), where the client-side TAP adapter is
  115. # bound to a DHCP client.
  116. ;server-bridge
  117. # Push routes to the client to allow it
  118. # to reach other private subnets behind
  119. # the server. Remember that these
  120. # private subnets will also need
  121. # to know to route the OpenVPN client
  122. # address pool (10.8.0.0/255.255.255.0)
  123. # back to the OpenVPN server.
  124. ;push "route 192.168.10.0 255.255.255.0"
  125. ;push "route 192.168.20.0 255.255.255.0"
  126. # To assign specific IP addresses to specific
  127. # clients or if a connecting client has a private
  128. # subnet behind it that should also have VPN access,
  129. # use the subdirectory "ccd" for client-specific
  130. # configuration files (see man page for more info).
  131. # EXAMPLE: Suppose the client
  132. # having the certificate common name "Thelonious"
  133. # also has a small subnet behind his connecting
  134. # machine, such as 192.168.40.128/255.255.255.248.
  135. # First, uncomment out these lines:
  136. ;client-config-dir ccd
  137. ;route 192.168.40.128 255.255.255.248
  138. # Then create a file ccd/Thelonious with this line:
  139. # iroute 192.168.40.128 255.255.255.248
  140. # This will allow Thelonious' private subnet to
  141. # access the VPN. This example will only work
  142. # if you are routing, not bridging, i.e. you are
  143. # using "dev tun" and "server" directives.
  144. # EXAMPLE: Suppose you want to give
  145. # Thelonious a fixed VPN IP address of 10.9.0.1.
  146. # First uncomment out these lines:
  147. ;client-config-dir ccd
  148. ;route 10.9.0.0 255.255.255.252
  149. # Then add this line to ccd/Thelonious:
  150. # ifconfig-push 10.9.0.1 10.9.0.2
  151. # Suppose that you want to enable different
  152. # firewall access policies for different groups
  153. # of clients. There are two methods:
  154. # (1) Run multiple OpenVPN daemons, one for each
  155. # group, and firewall the TUN/TAP interface
  156. # for each group/daemon appropriately.
  157. # (2) (Advanced) Create a script to dynamically
  158. # modify the firewall in response to access
  159. # from different clients. See man
  160. # page for more info on learn-address script.
  161. ;learn-address ./script
  162. # If enabled, this directive will configure
  163. # all clients to redirect their default
  164. # network gateway through the VPN, causing
  165. # all IP traffic such as web browsing and
  166. # and DNS lookups to go through the VPN
  167. # (The OpenVPN server machine may need to NAT
  168. # or bridge the TUN/TAP interface to the internet
  169. # in order for this to work properly).
  170. ;push "redirect-gateway def1 bypass-dhcp"
  171. push "redirect-gateway def1"
  172. push "dhcp-option DNS 10.8.0.1"
  173. # Certain Windows-specific network settings
  174. # can be pushed to clients, such as DNS
  175. # or WINS server addresses. CAVEAT:
  176. # http://openvpn.net/faq.html#dhcpcaveats
  177. # The addresses below refer to the public
  178. # DNS servers provided by opendns.com.
  179. ;push "dhcp-option DNS 208.67.222.222"
  180. ;push "dhcp-option DNS 208.67.220.220"
  181. # Uncomment this directive to allow different
  182. # clients to be able to "see" each other.
  183. # By default, clients will only see the server.
  184. # To force clients to only see the server, you
  185. # will also need to appropriately firewall the
  186. # server's TUN/TAP interface.
  187. client-to-client
  188. # Uncomment this directive if multiple clients
  189. # might connect with the same certificate/key
  190. # files or common names. This is recommended
  191. # only for testing purposes. For production use,
  192. # each client should have its own certificate/key
  193. # pair.
  194. #
  195. # IF YOU HAVE NOT GENERATED INDIVIDUAL
  196. # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
  197. # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
  198. # UNCOMMENT THIS LINE OUT.
  199. ;duplicate-cn
  200. # The keepalive directive causes ping-like
  201. # messages to be sent back and forth over
  202. # the link so that each side knows when
  203. # the other side has gone down.
  204. # Ping every 10 seconds, assume that remote
  205. # peer is down if no ping received during
  206. # a 120 second time period.
  207. keepalive 10 120
  208. # For extra security beyond that provided
  209. # by SSL/TLS, create an "HMAC firewall"
  210. # to help block DoS attacks and UDP port flooding.
  211. #
  212. # Generate with:
  213. # openvpn --genkey --secret ta.key
  214. #
  215. # The server and each client must have
  216. # a copy of this key.
  217. # The second parameter should be '0'
  218. # on the server and '1' on the clients.
  219. ;tls-auth ta.key 0 # This file is secret
  220. # Select a cryptographic cipher.
  221. # This config item must be copied to
  222. # the client config file as well.
  223. ;cipher BF-CBC # Blowfish (default)
  224. ;cipher AES-128-CBC # AES
  225. ;cipher DES-EDE3-CBC # Triple-DES
  226. # Enable compression on the VPN link.
  227. # If you enable it here, you must also
  228. # enable it in the client config file.
  229. comp-lzo
  230. # The maximum number of concurrently connected
  231. # clients we want to allow.
  232. ;max-clients 100
  233. # It's a good idea to reduce the OpenVPN
  234. # daemon's privileges after initialization.
  235. #
  236. # You can uncomment this out on
  237. # non-Windows systems.
  238. ;user nobody
  239. ;group nogroup
  240. # The persist options will try to avoid
  241. # accessing certain resources on restart
  242. # that may no longer be accessible because
  243. # of the privilege downgrade.
  244. persist-key
  245. persist-tun
  246. # Output a short status file showing
  247. # current connections, truncated
  248. # and rewritten every minute.
  249. status openvpn-status.log
  250. # By default, log messages will go to the syslog (or
  251. # on Windows, if running as a service, they will go to
  252. # the "\Program Files\OpenVPN\log" directory).
  253. # Use log or log-append to override this default.
  254. # "log" will truncate the log file on OpenVPN startup,
  255. # while "log-append" will append to it. Use one
  256. # or the other (but not both).
  257. ;log openvpn.log
  258. ;log-append openvpn.log
  259. # Set the appropriate level of log
  260. # file verbosity.
  261. #
  262. # 0 is silent, except for fatal errors
  263. # 4 is reasonable for general usage
  264. # 5 and 6 can help to debug connection problems
  265. # 9 is extremely verbose
  266. verb 3
  267. # Silence repeating messages. At most 20
  268. # sequential messages of the same message
  269. # category will be output to the log.
  270. ;mute 20