source: packages/net/openvpn/files/openvpn.config @ 29167

Last change on this file since 29167 was 29167, checked in by nico, 4 years ago

packages/openvpn: use new service functions, change 'enable' option to 'enabled' like most other services are using

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