server.conf.tmpl 9.4 KB

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