Ja, genau, im Prinzip geht jetzt alles wieder von vorne los, wir vergessen den Kram mit dem DynDNS und machen unsere keyVM wieder auf und gehen durch das gesamte Prozedere, und zwar einmal für jeden VPN-Server den wir aufsetzen wollen, und zwar inklusive einer neuen CA. ( das ist zwar nicht unbedingt nötig, aber einfacher zu händeln ) Nur den ta.key verwenden wir übergreifend für alle Server dengleichen.

D.h. wir haben nach jeder Schlüsselrunde einen Ordner:

Servername ( z.B. Zentrale, Filiale1, Filiale2, HomeOffice1, usw )

dort finden wir jeweils die zugehörigen Schlüssel:

ca.crt
server.key
server.crt
dh2048.pem
client.key (zen.key)
client.crt (zen.crt)

Wir wissen schon, dort sind noch mehr Dateien nach einer Schlüsselrunde, aber nur diese brauchen wir und ! wir erinnern uns:

ca.key verlässt niemals die KEY-SIGNING-MACHINE, hier unsere keyVM.
Sehr empfehlenswert ist es weiterhin die client-Zertificate korrekt zu benamsen, also zentrale.crt, zentrale.key, fil1.crt usw.
Damit taucht dann dieser Name später auch in den Logs auf und vermeidet Missverständnisse.
Bereiten wir das Übertragen der Schlüsselordner vor:

root@keyVM:/etc/easy-rsa# cp -r zentrale zen
root@keyVM:/etc/easy-rsa# rm zen/ca.key zen/alles-ausser-siehe-oben

usw.
lösche alles was nicht gebraucht wird….
Bringen wir diese Schlüssel inkl. Ordnern nun via scp auf unseren Verwaltungsrechner:

ich@meinPC:~# mkdir ~/new.vpn
ich@meinPC:~# cd new.vpn
ich@meinPC:~/new.vpn# mkdir zen fil1 fil2 ho1 ho2 ho3
ich@meinPC:~/new.vpn# ls
zen fil1 fil2 ho1 ho2 ho3

Nun für jeden Ordner:

ich@meinPC:~/new.vpn# scp -R root@keyVM:/etc/easy-rsa/zen/* ./zen/

usw, auch wieder für jeden Ordner.
Jetzt haben wir für jeden Server einen eigenen Schlüsselsatz in einem eigenen Ordner. Die bereinigten Ordner auf der keyVM können wir jetzt löschen und die keyVM wieder runterfahren.

Nun übertragen wir die Ordner auf den VPN-Server ins Verzeichnis /etc/openvpn und löschen danach dort die nicht benötigten client-Schlüssel.

ich@meinPC:~/new.vpn# scp -R -P 549 ./zen root@[vpnserver]:/etc/openvpn# rm zen/client.* ( bzw zen.* )

MERKE: scp möchte als Optionsschalter Großbuchstaben, also -R für rekursiv und -P für Port. Warum das denn? JO, hab ich mich auch schon oft gefragt….

Warum eigentlich so ein Aufwand mit sovielen Schlüsseln?

Nun, ich habe ja angekündigt das Beispiel mal aufzublasen. Was davon nötig ist und was nicht, das ist natürlich Deine Entscheidung.
Aber ich sage mal so:
Stell Dir vor, ho1 ist die Disposition im HomeOffice, hat 3 Mitarbeiter und alle 3 müssen auf die gleichen Ressourcen zugreifen, ho2 ist die Buchhaltung im HomeOffice und hat 2 Mitarbeiter die auf ganz andere Ressourcen zugreifen müssen und ho3 ist der Aussendienst mit 62 Mitarbeitern die auch alle auf die gleichen Ressourcen zugreifen müssen, einen Teil der Disposition brauchen, aber in der Buchhaltung nichts zu suchen haben.

Natürlich bekommt der Server für ho1 jetzt 3 client-Schlüssel, ho2 2 client-Schlüssel und ho3 62.

Vielleicht möchte der Chef, nachdem Du ihn von der Notwendigkeit der 20€ überzeugt hast, nun auch einen Zugang, chef1, und der darf damit von zuhause alles, und dazu noch vom Büro aus nach Hause drucken und seine GaragenCam guggen. Vielleicht hast Du ihn aber auch genau mit dieser Aussicht überzeugt…

Vielleicht willst Du aber auch nur Dein Ferienhaus mit LTE-Anschluss in Dein Netzwerk einbinden und brauchst nichts weiter als einen Server mit zwei client-Schlüsseln.

Ganz egal, aus diesem Beispiel sollst Du alles ableiten können!
Fuck Corona, oder?

So, weiter, wir haben alle Server-Schlüssel;

server.key
server.crt
dh2048.pem
ca.crt

auf dem VPN-Server. Jetzt erstellen wir auf dem VPN-Server noch den

ta.key

holen uns den auf unseren Verwaltungsrechner ( die clients brauchen den ja auch ) und dann kann es mit den Servern weitergehen:

Wir erstellen für jeden Server eine .conf im Verzeichnis /etc/openvpn:

root@[vpnserver]:/etc/openvpn# nano zen.conf

#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients <-> one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine <-> single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# "C:\\Program Files\\OpenVPN\\config\\foo.key" #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################


# Which local IP address should OpenVPN
# listen on? (optional)
local 85.xx.xx.xx     Unsere feste IP-Adresse


# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1191            siehe unsere Liste; zen lauscht auf Port 1191


# TCP or UDP server?
;proto tcp
proto udp           Protokoll udp


# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun0     erstelle dazu tun0


# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap


# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca /etc/openvpn/servers/zen/ca.crt
cert /etc/openvpn/servers/zen/server.crt
key /etc/openvpn/servers/zen/server.key  # This file should be kept secret
Hier sehen wir die Schlüssel im entsprechenden Ordner, deshalb dürfen die Server-Schlüssel auch alle gleich heissen.

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh2048.pem 2048
dh /etc/openvpn/servers/zen/dh2048.pem
dito

# Network topology
# Should be subnet (addressing via IP)
# unless Windows clients v2.0.9 and lower have to
# be supported (then net30, i.e. a /30 per client)
# Defaults to net30 (not recommended)
;topology subnet


# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.1.1.0 255.255.255.0     das Subnetz des Servers zen, siehe Liste


# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt hier ist Servers Notizzettel


# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
Hier haben wir die Routingeinträge die bei der Anmeldung vom Client an ihn übergeben werden
;push "route 10.1.1.0 255.255.255.0"    zuerst die VPN-Routen, hier Route zu zen, für zen nicht nötig
push "route 10.1.2.0 255.255.255.0"    hier Route zu fi1
push "route 10.1.3.0 255.255.255.0"    hier Route zu fi2
push "route 10.1.4.0 255.255.255.0"    hier Route zu ho1
push "route 10.1.5.0 255.255.255.0"    hier Route zu ho2
push "route 10.1.6.0 255.255.255.0"    hier Route zu ho3
push "route 10.0.3.0 255.255.255.0"    hier Route zum lokalen Subnetz fi1
push "route 10.0.4.0 255.255.255.0"    hier Route zum lokalen Subnetz fi2
push "route 192.168.8.0 255.255.255.0" hier Route zum plasterouter Subnetz fi1
push "route 192.168.79.0 255.255.255.0"hier Route zum plasterouter Subnetz fi2
# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).


# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
Damit die oben übergebenen Routen auch geroutet werden können, muss der VPN natürlich wissen wer für welche Routen zuständig ist, die VPN-Routen 10.1.xx kennt er natürlich, von den Subnetzen dahinter weiss er aber noch nichts.
client-config-dir ccd  in diesem Verzeichnis stehen die Clients mit ihren Subnetzen, dazu kommen wir gleich
route 10.0.0.0 255.255.255.0 dieser VPN-Server routet dieses Subnetz über den Client der in ccd dafür gesetzt wird
route 10.0.1.0 255.255.255.0 dito 
route 10.0.2.0 255.255.255.0 dito

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222" diese Option kann gesetzt werden, wenn der Client den lokalen Nameserver nutzen soll
;push "dhcp-option DNS 208.67.220.220"
Beispiel: ho2 soll auf die Verzeichnisdienste von zen zugreifen. Ohne diese Option muss jeder in ho2 die IP-Adressen der Dienste kennen und nutzen. Ein
push "dhcp-option DNS 10.0.0.1" in der ho2.conf würde den Clients von ho2 erlauben auf den Nameserver von zen zuzugreifen und den Verzeichnisdienst mit ldap://server2.erstes.netz erreichen können. Vorausgesetzt natürlich eine korrekte rulesDatei auf allen beteiligten Gateways, kommen wir noch zu.....

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client Kommt ganz auf die Anwendung an, Deine Entscheidung


# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn in der Regel nein, das hier ist so eher die Nummer: ho2 hat einen neuen Mitarbeiter und ich bin zu faul einen neuen Schlüssel zu machen....


# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120


remote-cert-tls client
# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
tls-auth /etc/openvpn/servers/ta.key 0 # This file is secret
siehe hier: servers/ alle Server und Clients dürfen den gleichen Schlüssel verwenden. Warum?
1. ta.key ist nicht von der CA signiert
2. Das ist eine zusätzliche Sicherheitsoption, hier wird die Servermaschine authentifiziert

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
# Note that 2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC
auth SHA512
# Enable compression on the VPN link and push the
# option to the client (2.4+ only, for earlier
# versions see below)
#compress lz4-v2
#push "compress lz4-v2"


# For compression compatible with older clients use comp-lzo
# If you enable it here, you must also
# enable it in the client config file.
#comp-lzo
auth-nocache
# The maximum number of concurrently connected
# clients we want to allow.
max-clients 1   klar oder? 1 für zen, aber vieleicht 3 für ho1 oder 62 für ho3


# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.!!
user nobody
group nogroup


# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun


# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.zen.log Jedem Server sein eigener Status bitte


# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
log         openvpn-zen.log  Jedem Server sein eigener Log bitte


# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 4


# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
mute 10


# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1

Damit haben wir unsere erste server.conf erstellt, alle weiteren sind im Prinzip Klone davon mit den Änderungen gemäß Liste, also

root@[vpnserver]:/etc/openvpn# cp zen.conf fi1.conf
root@[vpnserver]:/etc/openvpn# nano fi1.conf

#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients <-> one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine <-> single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# "C:\\Program Files\\OpenVPN\\config\\foo.key" #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################
Ändern und anpassen:

# Which local IP address should OpenVPN
# listen on? (optional)
local 85.xx.xx.xx Unsere feste IP-Adresse bleibt natürlich gleich


# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1192 siehe unsere Liste; fi1 lauscht auf Port 1192


# TCP or UDP server?
;proto tcp
proto udp


# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun1 und für fi1 erstelle dazu tun1


# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap


# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca /etc/openvpn/servers/fi1/ca.crt
cert /etc/openvpn/servers/fi1/server.crt
key /etc/openvpn/servers/fi1/server.key  # This file should be kept secret
Hier sehen wir die Schlüssel im entsprechenden Ordner, deshalb dürfen die Server-Schlüssel auch alle gleich heissen.

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh2048.pem 2048
dh /etc/openvpn/servers/fi1/dh2048.pem
dito

# Network topology
# Should be subnet (addressing via IP)
# unless Windows clients v2.0.9 and lower have to
# be supported (then net30, i.e. a /30 per client)
# Defaults to net30 (not recommended)
;topology subnet


# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.1.2.0 255.255.255.0 das Subnetz des Servers fi1, siehe Liste


# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
push "route 10.1.1.0 255.255.255.0" zuerst die VPN-Routen, hier Route zu zen
;push "route 10.1.2.0 255.255.255.0" hier Route zu fi1, für fi1 nicht nötig
;push "route 10.1.3.0 255.255.255.0" hier Route zu fi2, brauch fi1 nicht, alles liegt in zen
;push "route 10.1.4.0 255.255.255.0" hier Route zu ho1, dito
;push "route 10.1.5.0 255.255.255.0" hier Route zu ho2
;push "route 10.1.6.0 255.255.255.0" hier Route zu ho3
;push "route 10.0.3.0 255.255.255.0" hier Route zum lokalen Subnetz fi1
;push "route 10.0.4.0 255.255.255.0" hier Route zum lokalen Subnetz fi2
;push "route 192.168.8.0 255.255.255.0" hier Route zum plasterouter Subnetz fi1
;push "route 192.168.79.0 255.255.255.0"hier Route zum plasterouter Subnetz fi2
push "route 10.0.0.0 255.255.255.0" fi1 braucht aber die Route zu zen/loc
push "route 10.0.1.0 255.255.255.0" und vielleicht zu zen/cid ?
;push "route 10.0.2.0 255.255.255.0" und eher nicht zu zen/net
# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).


# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
Damit die oben übergebenen Routen auch geroutet werden können, muss der VPN natürlich wissen wer für welche Routen zuständig ist, die VPN-Routen 10.1.xx kennt er natürlich, von den Subnetzen dahinter weiss er aber noch nichts.
client-config-dir ccd
route 10.0.3.0 255.255.255.0 siehe Liste, fi1/loc
route 192.168.8.0 255.255.255.0 siehe Liste, fi1/net
;route 10.0.2.0 255.255.255.0 

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222" setzen wir jetzt, fi1 soll den lokalen Nameserver von zen nutzen
;push "dhcp-option DNS 208.67.220.220"
push "dhcp-option DNS 10.0.0.1"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client


# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn


# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120


remote-cert-tls client
# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
tls-auth /etc/openvpn/servers/ta.key 0 # This file is secret


# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
# Note that 2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC
auth SHA512
# Enable compression on the VPN link and push the
# option to the client (2.4+ only, for earlier
# versions see below)
#compress lz4-v2
#push "compress lz4-v2"


# For compression compatible with older clients use comp-lzo
# If you enable it here, you must also
# enable it in the client config file.
#comp-lzo
auth-nocache
# The maximum number of concurrently connected
# clients we want to allow.
max-clients 1


# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user nobody
group nogroup


# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun


# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.fi1.log Jedem Server sein eigener Status bitte


# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
log         openvpn-fi1.log Jedem Server sein eigener Log bitte


# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 4


# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
mute 10


# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1

Das Prinzip sollte jetzt klar sein, .conf kopieren und anpassen für jeden Server. Dann einen Schritt weiter in das Verzeichnis ccd

root@[vpnserver]:/etc/openvpn/ccd# nano zen

ifconfig-push 10.1.1.6 10.1.1.5  gib client zen immer diese (zwei) IP-Adresse(n)
iroute 10.0.0.0 255.255.255.0    client zen routet dieses Subnetz
iroute 10.0.1.0 255.255.255.0    und dieses
iroute 10.0.2.0 255.255.255.0    und dieses

Damit weiss der VPN-Server jetzt für welche Routen Client zen zuständig ist. Wer diese Routen bekommt, entscheidest Du in der jeweiligen server.conf

Jetzt fehlt noch die Shorewall Konfiguration um den Server starten zu können:

root@[vpnserver]:/etc/shorewall# nano rules

#       SSH Access to the Server
#               
#ACCEPT net fw tcp 555
SSHKnock        net             fw             tcp   555,11599,11600,11601


# ACCEPT fw net for updates
#
ACCEPT          fw              net            tcp    21,80,443,587
ACCEPT          fw              net            udp    53,123
#
#
# DNS settings for the VPN
#
#DNS(ACCEPT)     fi1             zen
#
#
#
############################################################################
########################### VPN Section ####################################
############################################################################
#
#
########       zen zone     ########
#
#
ACCEPT          net             fw              udp     1191
#
#
#
########       fi1 zone     ########
#
#
ACCEPT          net             fw             udp     1192
#
########       fi2 zone     ########
#
#
ACCEPT          net             fw             udp     1193
#
########       ho1 zone     ########
#
#
ACCEPT          net             fw             udp     1194
#
########       ho2 zone     ########
#
#
ACCEPT          net             fw             udp     1195
#
########       ho3 zone     ########
#
#
ACCEPT          net             fw             udp     1196
#

Damit starten wir Shorewall einmal neu, der Eintrag für DNS fi1 zu zen ist noch kommentiert, damit Shorewall nicht meckert und einfach nur die Ports aufmacht. Dann starten wir die openvpn-server einen nach dem anderen in einem neuen Fenster testweise:

root@[vpnserver]:/etc/openvpn# openvpn zen.conf

mit ip a sehen wir im ersten Fenster ob die tun Schnittstelle wie gewünscht aufgemacht wird. Wenn ja, stoppen wir den Prozess mit ctrl + c und nehmen uns den nächsten Server vor. Laufen alle wie gewünscht, setzen wir alle auf enabled:

root@[vpnserver]:/etc/openvpn# systemctl daemon-reload
root@[vpnserver]:/etc/openvpn# systemctl enable [email protected]
root@[vpnserver]:/etc/openvpn# systemctl start [email protected]
usw…

Als Ergebnis müssen nach einem

ip a

alle tun Schnittstellen aufgeführt werden.
Dann können wir sie als Schnittstellen und Zonen für Shorewall eintragen:

root@[vpnserver]:/etc/shorewall# nano interfaces

zen NET_ZEN dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun0
fi1 NET_FI1 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun1
fi2 NET_FI2 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun2
ho1 NET_HO1 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun3
ho2 NET_HO2 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun4
ho3 NET_HO3 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,routeback,physical=tun5

root@[vpnserver]:/etc/shorewall# nano zones

zen ipv4
fi1 ipv4
fi2 ipv4
ho1 ipv4
ho2 ipv4
ho3 ipv4

Neustart Shorewall und wir können an die Clients gehen:

next > Hereinspaziert