Ticket #1129: r3.conf

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