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