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