9831ad15a1baedad750d4462e2f470ca9fbe97fb
[project/luci.git] / applications / luci-openvpn / root / etc / config / openvpn
1 #################################################
2 # Sample OpenVPN 2.0 config file for            #
3 # multi-client server.                          #
4 #################################################
5
6 config openvpn sample_server
7
8         # Set to 1 to enable this instance:
9         option enable 0
10
11         # Which local IP address should OpenVPN
12         # listen on? (optional)
13 #       option local 0.0.0.0
14
15         # Which TCP/UDP port should OpenVPN listen on?
16         # If you want to run multiple OpenVPN instances
17         # on the same machine, use a different port
18         # number for each one.  You will need to
19         # open up this port on your firewall.
20         option port 1194
21
22         # TCP or UDP server?
23 #       option proto tcp
24         option proto udp
25
26         # "dev tun" will create a routed IP tunnel,
27         # "dev tap" will create an ethernet tunnel.
28         # Use "dev tap0" if you are ethernet bridging
29         # and have precreated a tap0 virtual interface
30         # and bridged it with your ethernet interface.
31         # If you want to control access policies
32         # over the VPN, you must create firewall
33         # rules for the the TUN/TAP interface.
34         # On non-Windows systems, you can give
35         # an explicit unit number, such as tun0.
36         # On Windows, use "dev-node" for this.
37         # On most systems, the VPN will not function
38         # unless you partially or fully disable
39         # the firewall for the TUN/TAP interface.
40 #       option dev tap
41         option dev tun
42
43         # SSL/TLS root certificate (ca), certificate
44         # (cert), and private key (key).  Each client
45         # and the server must have their own cert and
46         # key file.  The server and all clients will
47         # use the same ca file.
48         #
49         # See the "easy-rsa" directory for a series
50         # of scripts for generating RSA certificates
51         # and private keys.  Remember to use
52         # a unique Common Name for the server
53         # and each of the client certificates.
54         #
55         # Any X509 key management system can be used.
56         # OpenVPN can also use a PKCS #12 formatted key file
57         # (see "pkcs12" directive in man page).
58         option ca ca.crt
59         option cert server.crt
60         # This file should be kept secret:
61         option key server.key
62
63         # Diffie hellman parameters.
64         # Generate your own with:
65         #   openssl dhparam -out dh1024.pem 1024
66         # Substitute 2048 for 1024 if you are using
67         # 2048 bit keys.
68         option dh dh1024.pem
69
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
79         # Maintain a record of client <-> virtual IP address
80         # associations in this file.  If OpenVPN goes down or
81         # is restarted, reconnecting clients can be assigned
82         # the same virtual IP address from the pool that was
83         # previously assigned.
84         option ifconfig_pool_persist ipp.txt
85
86         # Configure server mode for ethernet bridging.
87         # You must first use your OS's bridging capability
88         # to bridge the TAP interface with the ethernet
89         # NIC interface.  Then you must manually set the
90         # IP/netmask on the bridge interface, here we
91         # assume 10.8.0.4/255.255.255.0.  Finally we
92         # must set aside an IP range in this subnet
93         # (start=10.8.0.50 end=10.8.0.100) to allocate
94         # to connecting clients.  Leave this line commented
95         # out unless you are ethernet bridging.
96 #       option server_bridge "10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100"
97
98         # Push routes to the client to allow it
99         # to reach other private subnets behind
100         # the server.  Remember that these
101         # private subnets will also need
102         # to know to route the OpenVPN client
103         # address pool (10.8.0.0/255.255.255.0)
104         # back to the OpenVPN server.
105 #       list push "route 192.168.10.0 255.255.255.0"
106 #       list push "route 192.168.20.0 255.255.255.0"
107
108         # To assign specific IP addresses to specific
109         # clients or if a connecting client has a private
110         # subnet behind it that should also have VPN access,
111         # use the subdirectory "ccd" for client-specific
112         # configuration files (see man page for more info).
113
114         # EXAMPLE: Suppose the client
115         # having the certificate common name "Thelonious"
116         # also has a small subnet behind his connecting
117         # machine, such as 192.168.40.128/255.255.255.248.
118         # First, uncomment out these lines:
119 #       option client_config_dir ccd
120 #       list route "192.168.40.128 255.255.255.248"
121         # Then create a file ccd/Thelonious with this line:
122         #   iroute 192.168.40.128 255.255.255.248
123         # This will allow Thelonious' private subnet to
124         # access the VPN.  This example will only work
125         # if you are routing, not bridging, i.e. you are
126         # using "dev tun" and "server" directives.
127
128         # EXAMPLE: Suppose you want to give
129         # Thelonious a fixed VPN IP address of 10.9.0.1.
130         # First uncomment out these lines:
131 #       option client_config_dir ccd
132 #       list route "10.9.0.0 255.255.255.252"
133 #       list route "192.168.100.0 255.255.255.0"
134         # Then add this line to ccd/Thelonious:
135         #   ifconfig-push "10.9.0.1 10.9.0.2"
136
137         # Suppose that you want to enable different
138         # firewall access policies for different groups
139         # of clients.  There are two methods:
140         # (1) Run multiple OpenVPN daemons, one for each
141         #     group, and firewall the TUN/TAP interface
142         #     for each group/daemon appropriately.
143         # (2) (Advanced) Create a script to dynamically
144         #     modify the firewall in response to access
145         #     from different clients.  See man
146         #     page for more info on learn-address script.
147 #       option learn_address ./script
148
149         # If enabled, this directive will configure
150         # all clients to redirect their default
151         # network gateway through the VPN, causing
152         # all IP traffic such as web browsing and
153         # and DNS lookups to go through the VPN
154         # (The OpenVPN server machine may need to NAT
155         # the TUN/TAP interface to the internet in
156         # order for this to work properly).
157         # CAVEAT: May break client's network config if
158         # client's local DHCP server packets get routed
159         # through the tunnel.  Solution: make sure
160         # client's local DHCP server is reachable via
161         # a more specific route than the default route
162         # of 0.0.0.0/0.0.0.0.
163 #       list push "redirect-gateway"
164
165         # Certain Windows-specific network settings
166         # can be pushed to clients, such as DNS
167         # or WINS server addresses.  CAVEAT:
168         # http://openvpn.net/faq.html#dhcpcaveats
169 #       list push "dhcp-option DNS 10.8.0.1"
170 #       list push "dhcp-option WINS 10.8.0.1"
171
172         # Uncomment this directive to allow different
173         # clients to be able to "see" each other.
174         # By default, clients will only see the server.
175         # To force clients to only see the server, you
176         # will also need to appropriately firewall the
177         # server's TUN/TAP interface.
178 #       option client_to_client 1
179
180         # Uncomment this directive if multiple clients
181         # might connect with the same certificate/key
182         # files or common names.  This is recommended
183         # only for testing purposes.  For production use,
184         # each client should have its own certificate/key
185         # pair.
186         #
187         # IF YOU HAVE NOT GENERATED INDIVIDUAL
188         # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
189         # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
190         # UNCOMMENT THIS LINE OUT.
191 #       option duplicate_cn 1
192
193         # The keepalive directive causes ping-like
194         # messages to be sent back and forth over
195         # the link so that each side knows when
196         # the other side has gone down.
197         # Ping every 10 seconds, assume that remote
198         # peer is down if no ping received during
199         # a 120 second time period.
200         option keepalive "10 120"
201
202         # For extra security beyond that provided
203         # by SSL/TLS, create an "HMAC firewall"
204         # to help block DoS attacks and UDP port flooding.
205         #
206         # Generate with:
207         #   openvpn --genkey --secret ta.key
208         #
209         # The server and each client must have
210         # a copy of this key.
211         # The second parameter should be '0'
212         # on the server and '1' on the clients.
213         # This file is secret:
214 #       option tls_auth "ta.key 0"
215
216         # Select a cryptographic cipher.
217         # This config item must be copied to
218         # the client config file as well.
219         # Blowfish (default):
220 #       option cipher BF-CBC
221         # AES:
222 #       option cipher AES-128-CBC
223         # Triple-DES:
224 #       option cipher DES-EDE3-CBC
225
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         option comp_lzo 1
230
231         # The maximum number of concurrently connected
232         # clients we want to allow.
233 #       option max_clients 100
234
235         # The persist options will try to avoid
236         # accessing certain resources on restart
237         # that may no longer be accessible because
238         # of the privilege downgrade.
239         option persist_key 1
240         option persist_tun 1
241
242         # Output a short status file showing
243         # current connections, truncated
244         # and rewritten every minute.
245         option status openvpn-status.log
246
247         # By default, log messages will go to the syslog (or
248         # on Windows, if running as a service, they will go to
249         # the "\Program Files\OpenVPN\log" directory).
250         # Use log or log-append to override this default.
251         # "log" will truncate the log file on OpenVPN startup,
252         # while "log-append" will append to it.  Use one
253         # or the other (but not both).
254 #       option log         openvpn.log
255 #       option log_append  openvpn.log
256
257         # Set the appropriate level of log
258         # file verbosity.
259         #
260         # 0 is silent, except for fatal errors
261         # 4 is reasonable for general usage
262         # 5 and 6 can help to debug connection problems
263         # 9 is extremely verbose
264         option verb 3
265
266         # Silence repeating messages.  At most 20
267         # sequential messages of the same message
268         # category will be output to the log.
269 #       option mute 20
270
271
272 ##############################################
273 # Sample client-side OpenVPN 2.0 config file #
274 # for connecting to multi-client server.     #
275 ##############################################
276
277 config openvpn sample_client
278
279         # Set to 1 to enable this instance:
280         option enable 0
281
282         # Specify that we are a client and that we
283         # will be pulling certain config file directives
284         # from the server.
285         option client 1
286
287         # Use the same setting as you are using on
288         # the server.
289         # On most systems, the VPN will not function
290         # unless you partially or fully disable
291         # the firewall for the TUN/TAP interface.
292 #       option dev tap
293         option dev tun
294
295         # Are we connecting to a TCP or
296         # UDP server?  Use the same setting as
297         # on the server.
298 #       option proto tcp
299         option proto udp
300
301         # The hostname/IP and port of the server.
302         # You can have multiple remote entries
303         # to load balance between the servers.
304         list remote "my_server_1 1194"
305 #       list remote "my_server_2 1194"
306
307         # Choose a random host from the remote
308         # list for load_balancing.  Otherwise
309         # try hosts in the order specified.
310 #       option remote_random 1
311
312         # Keep trying indefinitely to resolve the
313         # host name of the OpenVPN server.  Very useful
314         # on machines which are not permanently connected
315         # to the internet such as laptops.
316         option resolv_retry infinite
317
318         # Most clients don't need to bind to
319         # a specific local port number.
320         option nobind 1
321
322         # Try to preserve some state across restarts.
323         option persist_key 1
324         option persist_tun 1
325
326         # If you are connecting through an
327         # HTTP proxy to reach the actual OpenVPN
328         # server, put the proxy server/IP and
329         # port number here.  See the man page
330         # if your proxy server requires
331         # authentication.
332         # retry on connection failures:
333 #       option http_proxy_retry 1
334         # specify http proxy address and port:
335 #       option http_proxy "192.168.1.100 8080"
336
337         # Wireless networks often produce a lot
338         # of duplicate packets.  Set this flag
339         # to silence duplicate packet warnings.
340 #       option mute_replay_warnings 1
341
342         # SSL/TLS parms.
343         # See the server config file for more
344         # description.  It's best to use
345         # a separate .crt/.key file pair
346         # for each client.  A single ca
347         # file can be used for all clients.
348         option ca ca.crt
349         option cert client.crt
350         option key client.key
351
352         # Verify server certificate by checking
353         # that the certicate has the nsCertType
354         # field set to "server".  This is an
355         # important precaution to protect against
356         # a potential attack discussed here:
357         #  http://openvpn.net/howto.html#mitm
358         #
359         # To use this feature, you will need to generate
360         # your server certificates with the nsCertType
361         # field set to "server".  The build_key_server
362         # script in the easy_rsa folder will do this.
363 #       option ns_cert_type server
364
365         # If a tls_auth key is used on the server
366         # then every client must also have the key.
367 #       option tls_auth "ta.key 1"
368
369         # Select a cryptographic cipher.
370         # If the cipher option is used on the server
371         # then you must also specify it here.
372 #       option cipher x
373
374         # Enable compression on the VPN link.
375         # Don't enable this unless it is also
376         # enabled in the server config file.
377         option comp_lzo 1
378
379         # Set log file verbosity.
380         option verb 3
381
382         # Silence repeating messages
383 #       option mute 20