[NAS Typ:] TS-110
[Firmware:] 3.1.2 build 1014
[Getestet:] ja
[Sonstige Modifikationen:] keine
[TIMELOG - Dieses Howto wurde am:]
[*]Fr 11. Dez 2009
[*]Mo 16. Aug 2010
geupdated.
Hallo liebe Forenbesucher,
habe mehrfach gelesen, daß es bei der Inbetriebnahme von openvpn auf dem NAS Probleme gab. Ich habe selbst gerade als Newbie auf diesen Geräten eine letztendlich erfolgreiche Installation durchgezogen. Da ich von David hilfreich mit Tips unterstützt wurde, möchte ich die erarbeiteten Kentnisse nutzen und alle Interessierten daran teilhaben lassen.
Ich werde versuchen auf alle Details, die zu dieser Installation nötig sind einzugehen. Allerdings werde ich die restlichen Maßnahmen wie Platteneinbau etc. zu denen schon entsprechende Beschreibungen existieren überspringen.
Ziel dieser Installation war die Anbindung des NAS an einen Gentoo-Server mit entsprechender Openvpn-Serverinstallation. Das ganze sollte sich in die vorhandene Umgebung einfügen, ohne zusätzlichen Aufwand zu produzieren. Dazu war eine gebrückte Anbindung über ein TAP-Device im gleichen Subnet wie der Server gefordert. Bestimmte Übertragungen lassen sich auf diesem Wege um einiges eleganter lösen als in einer gerouteten Verbindung. Beide Seiten des Tunnels liegen hinter entsprechenden Routern/Firewalls. In diesem Fall kamen Fritze zum Einsatz.
1. Vorbereitende Maßnahmen
# Aktuelle Firmware von http://www.qnap.com/download_d…1&p_mn=136&ct_name=Latest installieren
-dazu Firmware an eine Speicherstelle downloaden
-über Überblick->Systemadministration->Firmware-Aktualisierung->durchsuchen von dieser Speicherstelle installieren
# ssh-Dienst freischalten
-über Überblick->Netzwerkdienst->TelNet/SSH SSH-Verbindung über port 22 zulassen
# Installation des IPKG-Paketes über die Administrationsoberfläche
- über Überblick->Anwendungen->QPKG-Plugins->QPKG abrufen
- IPKG (Itsy Package Management System) an eine Speicherstelle downloaden
- über Überblick->Anwendungen->QPKG-Plugins->Installation->durchsuchen und von dieser Speicherstelle
- mit dem Knopf <installieren> auf dem NAS implementieren
# Mit ipkg über Konsole <mc> installieren
- mit ssh auf dem NAS einloggen
- /opt/bin/ipkg update
- /opt/bin/ipkg install mc -tmp-dir=/share/HDA_DATA/
- um ihn laufen zu lassen /opt/bin/mc
# Mit ipkg über Konsole <bridge-Utilities> installieren
- /opt/bin/ipkg install bridge-utils
# Mit ipkg über Konsole <openvpn> auf dem NAS installieren
- /opt/bin/ipkg install openvpn
# den Speicherbereich ins tmp-config-Verzeichnis mounten
- mount -t ext2 /dev/mtdblock5 /tmp/config
# die start.sh (s.u.) zur autorun.sh dorthin verlinken
- ln -sf /share/HDA_DATA/.qpkg/Optware/etc/openvpn/start.sh /tmp/config/autorun.sh
# und lauffähig machen
- chmod +x /tmp/config/autorun.sh
# mount abschließen
- umount /tmp/config
2. Inhalt der Datei /share/HDA_DATA/.qpkg/Optware/etc/openvpn/start.sh
#!/bin/sh################################################################################################### autorun.sh to prepare qnap NAS (here tested with ts-110) to start different initial scripts# with additional security not to hang the system during tests using a USB-Stick to block# starting those scripts if necessary ;-)## There's absolutely no chance to get it going without the first section, because the /opt # structure is completed by the system a f t e r finshed working on the autorun file. # Up to that point additional software started won't find it's libraries and won't work correctly.# Thanks to David (Terz) for these hints and ideas e.g.:# http://forum.qnapclub.de/ucp.php?i=pm&mode=view&f=0&p=6218&sid=2d8a4df616faa21558c54a4c90c3100d## If You link this scripts to autorun.sh file it can be edited without circumstances of doing# mount -t ext2 /dev/mtdblock5 /tmp/config a n d# umount /tmp/config## c/o peter meins 2009################################################################################################### id of the block-stick -> adapt it to Yours ( use lsusb :)MNUSBStick="ID 090c:1000"# first section - delete old fragments of /optrm -rf /opt# and give a new link to /optln -sf /share/HDA_DATA/.qpkg/Optware /opt# search-paths </opt/bin>, </opt/sbin> to the profile, because# a pure export will only work on this task and its childrenecho "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile# alias setup for midnight commander to bloom in blue# of course only if U use it . . .echo 'alias mc="mc -c"' >> /etc/profile# only execute if blocking USBstick is not plugged in to prevent hang-ups during test-phaseif (lsusb | grep "$MNUSBStick"); then # message to admin in log echo "no additional software gonna be started" > /share/HDA_DATA/.qpkg/Optware/etc/openvpn/log/boot.log # no more excitement exit 1else # start environment for openvpn /share/HDA_DATA/.qpkg/Optware/etc/openvpn/vpnstart.sh start & # keep on going with what U want to edfi# that's itexit 0################################################################################################### eop start.sh/*This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
[Updated 16. Aug. 2010 --- start]
Wer keine externen Laufwerke benutzt und sich nicht auf einen bestimmten USB-Stick zum Blockieren der VPN-Ladevorgänge festlegen will, kann diese Version benutzen. Die Verhindert das Laden des VPN, wenn irgendein Device an den USB-Port angeschlossen wird. Man kann da noch ein wenig rumtricksen, weil die Vergleichszeile der lsusb-Ausgabe einfach in die <NoStick>-Variable des u.s. Sources kopiert wird. Welche Vergleichszeilen dort genommen werden obliegt also Euch. Hier diese Version:
#!/bin/sh################################################################################################### autorun.sh to prepare qnap NAS (here tested with ts-110) to start different initial scripts# with additional security not to hang the system during tests using a USB-Stick to block# starting those scripts if necessary ;-)## There's absolutely no chance to get it going without the first section, because the /opt# structure is completed by the system a f t e r finshed working on the autorun file.# Up to that point additional software started won't find it's libraries and won't work correctly.# Thanks to David (Terz) for these hints and ideas e.g.:# http://forum.qnapclub.de/ucp.php?i=pm&mode=view&f=0&p=6218&sid=2d8a4df616faa21558c54a4c90c3100d## If You link this scripts to autorun.sh file it can be edited without circumstances of doing# mount -t ext2 /dev/mtdblock5 /tmp/config a n d# ln -sf /share/HDA_DATA/.qpkg/Optware/etc/openvpn/start.sh /tmp/config/autorun.sh# chmod +x /tmp/config/autorun.sh# umount /tmp/config## c/o peter meins 2009/2010################################################################################################### expence of lsusb w/o usb-stick -> adapt it to Yours ( use lsusb :)# and copy result to var <NoStick> right hereNoStick='Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc.Bus 001 Device 001: ID 1d6b:0002'# take off new line and spacesNoStick=$(echo "$NoStick" | tr -d "\n" | tr -d ' ')# first section - delete old fragments of /optrm -rf /opt# and give a new link to /optln -sf /share/HDA_DATA/.qpkg/Optware /opt# search-paths </opt/bin>, </opt/sbin> to the profile, because# a pure export will only work on this task and its childrenecho "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile# alias setup for midnight commander to bloom in blue# of course only if U use it . . .echo 'alias mc="mc -c"' >> /etc/profile# make file writeablechmod 2777 /share/HDA_DATA/Qmultimedia/# read the momentary situation and trim the resultRightNow=`lsusb | tr -d "\n" | tr -d ' '`if [ "$RightNow" == "$NoStick" ]; then # no stick present # start environment for openvpn /share/HDA_DATA/.qpkg/Optware/etc/openvpn/vpnstart.sh start & # keep on going with what U want to edelse # a stick present -> no action # message to admin in log echo "no additional software gonna be started" > /share/HDA_DATA/.qpkg/Optware/etc/openvpn/log/boot.log # no more excitement exit 1fi# that's itexit 0################################################################################################### eop start.sh/*This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
[Updated 16. Aug. 2010 --- end]
3. Die Startdatei /share/HDA_DATA/.qpkg/Optware/etc/openvpn/vpnstart.sh
für das Openvpn, die durch die Startdatei, die per Link auf die autorun.sh zeigt (s.o.) aufgerufen wird. Sie ist selbsterklärend und nimmt sämtliche Maßnahmen für den Start vor.
[Updated 16. Aug. 2010 --- start]
Diese Version wurde unter der Maßgabe der Firmware 3.1.2 build 1014 entworfen:
[Updated 16. Aug. 2010 --- end]
#!/bin/sh########################################################################################## preparing start of openvpn-client on qnap NAS being called by autorun.sh.# It will connect to an openvpn server ( tested with gentoo :)# Location in /share/HDA_DATA/.qpkg/Optware/etc/openvpn/vpnstart.sh# depending on nas-type ( here tested: TS 110 )# This will create a tap-device and bridge it together with et0 to br0# The same subnet like on server-side is used. # Can be adapted in connection-variables-section.# # c/o peter meins 2009########################################################################################## parameter-declarations## search-pathsPS="/bin/ps"GREP="/bin/grep"MKDIR="/bin/mkdir"RM="/bin/rm"PING="/bin/ping"INSMOD="/sbin/insmod"LSMOD="/sbin/lsmod"IFCONFIG="/sbin/ifconfig"ROUTE="/sbin/route"OPENVPN="/share/HDA_DATA/.qpkg/Optware/sbin/openvpn"BRCTL="/opt/sbin/brctl"KILLALL="/usr/bin/killall"## connection-variablesbr="br0"eth="eth0"tap="tap0"eth_ip="10.1.1.101"eth_netmask="255.255.255.0"eth_gateway="10.1.1.200"MNLogDir="/share/HDA_DATA/.qpkg/Optware/etc/openvpn/log"MNLogFile=$MNLogDir"/boot.log"MNFlagFile="/mnt/HDA_ROOT/.config/uLinux.conf"MNTimeOut=0MNDebug=1 # 0 to mute########################################################################################## Routine zur Logbucherstellung beim Boot des NAS########################################################################################## Function log()log(){ local logtext="$1" # ether no debug-message or debug-message and debug-flag set if ( test $# -lt 2 ) || ( ( test $# -eq "2" ) && (($MNDebug)) ); then # Protokollierung if !(test $MNLogFile = ""); then echo -n $(date +%c)' : ' >> $MNLogFile if (test "$logtext" = ""); then echo $0 >> $MNLogFile elif (test "$logtext" = "-"); then echo "--------------------------------------------------" >> $MNLogFile else echo $logtext >> $MNLogFile fi fi # all right to log-file chmod 777 $MNLogFile fi}# eoFunction#########################################################################################case "$1" in start) log "last vpn-check" -debug # create log-dir $MKDIR -p $MNLogDir # und alte log-Datei löschen $RM $MNLogFile log "preparing boot of openvpn" # wait for boot with timeout of 10 min. log "waiting for boot to be finished" -debug MNTimeOut=120 # the ts-110 has a sys-file with a Booting-flag-variable # showing value 1 while babe is crawling until ($GREP "Booting = 0" $MNFlagFile); do sleep 5 ((MNTimeOut--)) if [ "$MNTimeOut" -le "0" ]; then log "Timeout: Boot not finished" -debug exit 1 fi done log "booting finished" -debug # load modul for tun $INSMOD /usr/local/modules/tun.ko > /dev/null 2>&1 if ($LSMOD | $GREP tun); then log "found tun-modul" -debug else log "no tun-modul" -debug exit 1 fi # load modul for bridge $INSMOD /usr/local/modules/bridge.ko > /dev/null 2>&1 if ($LSMOD | $GREP bridge); then log "found bridge-modul" -debug else log "no bridge-modul" -debug exit 1 fi log "system ready all modules present" -debug # waiting for bin-file to be ready with timeout of 5 min. MNTimeOut=60 until [ -x $OPENVPN ]; do sleep 5 ((MNTimeOut--)) if ( "$MNTimeOut" -le "0" ); then log "Timeout: Bin file not available" -debug exit 1 fi done log "bin file available to do the job" -debug # create a tap-device if not present if !($IFCONFIG -a | $GREP tap0); then # we need a tap-device for a brigded system -> lets do it $OPENVPN --mktun --dev tap0 # if something went wrong if [ ! $? ] ; then log "creating tap-device went wrong!" -debug exit 1 fi # check it with timeout of 5 min. before giving up MNTimeOut=60 until ($IFCONFIG -a | $GREP tap0); do sleep 5 ((MNTimeOut--)) if [ "$MNTimeOut" -le "0" ]; then log "Timeout: Tap-device not created" -debug exit 1 fi done log "tap0 device created" -debug fi # create the bridge if not present if !($IFCONFIG -a | $GREP br0); then # add a bridge $BRCTL addbr $br log "bridge $br created" -debug # add eth in $BRCTL addif $br $eth log "eth-device $eth tied to the bridge" -debug # add tap in $BRCTL addif $br $tap log "tap-device $tap tied to the bridge" -debug # set them to promisc-mode $IFCONFIG $tap 0.0.0.0 promisc up $IFCONFIG $eth 0.0.0.0 promisc up log "both devices set into the promisc-mode" -debug # put the address back to the bridge $IFCONFIG $br $eth_ip netmask $eth_netmask log "given ethernet-ip $eth_ip to the bridge" -debug # and give default gateway to the bridge $ROUTE add default gw $eth_gateway $br log "set default route $eth_gateway to bridge $br" -debug fi # here's a bridge so everything worked out if ($IFCONFIG -a | $GREP br0); then # starting OpenVPN $OPENVPN --config /share/HDA_DATA/.qpkg/Optware/etc/openvpn/openvpn.conf --daemon # check the whole thing if ($PS ax | $GREP openvpn | $GREP -v grep > /dev/null 2>&1); then log "openvpn ready to go" -debug else log "openvpn not started" -debug exit 1 fi else # or damned not log "no bridge $br available" -debug exit 1 fi ;; stop) # nothing to do if [ -n "`pidof openvpn`" ]; then $KILLALL openvpn 2>/dev/null fi ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/vpnstart.sh {start|stop|restart}" exit 1esacexit 0############################################ eof vpnstart.sh/*This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
[Updated 16. Aug. 2010 --- start]
Neuere Firmware (TS-110_3.3.1_Build0720.img) habe ich getestet und installiert. Dafür hab ich dem Lösungsvorschlag von http://forum.qnapclub.de/viewtopic.php?f=33&t=7421&start=10 folgend die vpnstart.sh so modifiziert:
#!/bin/sh######################################################################################################################################## preparing start of openvpn-client on qnap NAS being called by autorun.sh.# It will connect to an openvpn server ( tested with gentoo :)# Location in /share/HDA_DATA/.qpkg/Optware/etc/openvpn/vpnstart.sh# depending on nas-type ( here tested: TS 110 )# This will create a tap-device and bridge it together with et0 to br0# The same subnet like on server-side is used.# Can be adapted in connection-variables-section.## c/o peter meins 2009########################################################################################## parameter-declarations## search-pathsPS="/bin/ps"GREP="/bin/grep"MKDIR="/bin/mkdir"RM="/bin/rm"PING="/bin/ping"INSMOD="/sbin/insmod"LSMOD="/sbin/lsmod"IFCONFIG="/sbin/ifconfig"ROUTE="/sbin/route"OPENVPN="/share/HDA_DATA/.qpkg/Optware/sbin/openvpn"BRCTL="/opt/sbin/brctl"KILLALL="/usr/bin/killall"## connection-variablesbr="br0"eth="eth0"tap="tap0"eth_ip="10.1.1.105"eth_netmask="255.255.255.0"eth_gateway="10.1.1.205"MNLogDir="/share/HDA_DATA/.qpkg/Optware/etc/openvpn/log"MNLogFile=$MNLogDir"/boot.log"MNFlagFile="/mnt/HDA_ROOT/.config/uLinux.conf"MNTimeOut=0MNDebug=1 # 0 to mute########################################################################################## Routine zur Logbucherstellung beim Boot des NAS########################################################################################## Function log()log(){ local logtext="$1" # ether no debug-message or debug-message and debug-flag set if ( test $# -lt 2 ) || ( ( test $# -eq "2" ) && (($MNDebug)) ); then # Protokollierung if !(test $MNLogFile = ""); then echo -n $(date +%c)' : ' >> $MNLogFile if (test "$logtext" = ""); then echo $0 >> $MNLogFile elif (test "$logtext" = "-"); then echo "--------------------------------------------------" >> $MNLogFile else echo $logtext >> $MNLogFile fi fi # all right to log-file chmod 777 $MNLogFile fi}# eoFunction#########################################################################################case "$1" in start) log "last vpn-check" -debug # create log-dir $MKDIR -p $MNLogDir # und alte log-Datei löschen $RM $MNLogFile log "preparing boot of openvpn" # wait for boot with timeout of 10 min. log "waiting for boot to be finished" -debug MNTimeOut=120 # the ts-110 has a sys-file with a Booting-flag-variable # showing value 1 while babe is crawling until ($GREP "Booting = 0" $MNFlagFile); do sleep 5 ((MNTimeOut--)) if [ "$MNTimeOut" -le "0" ]; then log "Timeout: Boot not finished" -debug exit 1 fi done log "booting finished" -debug # load modul for tun $INSMOD /usr/local/modules/tun.ko > /dev/null 2>&1 if ($LSMOD | $GREP tun); then log "found tun-modul" -debug else log "no tun-modul" -debug exit 1 fi # have a look at # http://forum.qnapclub.de/viewtopic.php?f=33&t=7421&sid=0f1efd2ed6785297d39793fb4f04910f&start=10 # to verify that the stp-module has to be loaded # load modul stp $INSMOD /usr/local/modules/stp.ko > /dev/null 2>&1 if ($LSMOD | $GREP stp); then log "found stp-module" -debug else log "no stp-module" -debug exit 1 fi # load modul bridge $INSMOD /usr/local/modules/bridge.ko > /dev/null 2>&1 if ($LSMOD | $GREP bridge); then log "found bridge-module" -debug else log "no bridge-module" -debug exit 1 fi log "system ready all modules present" -debug # waiting for bin-file to be ready with timeout of 5 min. MNTimeOut=60 until [ -x $OPENVPN ]; do sleep 5 ((MNTimeOut--)) if ( "$MNTimeOut" -le "0" ); then log "Timeout: Bin file not available" -debug exit 1 fi done log "bin file available to do the job" -debug # create the bridge if not present if !($IFCONFIG -a | $GREP br0); then # add a bridge $BRCTL addbr $br MNTimeOut=60 until ($IFCONFIG -a | $GREP $br); do sleep 5 ((MNTimeOut--)) if ( "$MNTimeOut" -le "0" ); then log "Timeout: Bridge-device not available" -debug exit 1 fi done log "bridge $br created" -debug # add eth in $BRCTL addif $br $eth log "eth-device $eth tied to the bridge" -debug # set it to promisc-mode $IFCONFIG $eth 0.0.0.0 promisc up log "tap-device set into the promisc-mode" -debug # put the address back to the bridge $IFCONFIG $br $eth_ip netmask $eth_netmask log "given ethernet-ip $eth_ip to the bridge" -debug # and give default gateway to the bridge $ROUTE add default gw $eth_gateway $br log "set default route $eth_gateway to bridge $br" -debug # internet available MNTimeOut=10 until (ping -c 1 www.google.de); do sleep 5 ((MNTimeOut--)) if ( "$MNTimeOut" -le "0" ); then log "the internet could'nt be reached" -debug exit 1 fi done log "Internet available" -debug # going to call openvpn log "going to call ovpn" -debug # starting OpenVPN $OPENVPN --config /share/HDA_DATA/.qpkg/Optware/etc/openvpn/openvpn.conf --daemon # check the whole thing if ($PS ax | $GREP openvpn | $GREP -v grep > /dev/null 2>&1); then log "openvpn ready to go" -debug else log "openvpn not started" -debug exit 1 fi fi # checkfor tap-device with timeout of 5 min. before giving up MNTimeOut=60 until ($IFCONFIG -a | $GREP tap0); do sleep 5 ((MNTimeOut--)) if [ "$MNTimeOut" -le "0" ]; then log "Timeout: Tap-device not created" -debug exit 1 fi done log "tap0 device created" -debug # add tap in $BRCTL addif $br $tap log "tap-device $tap tied to the bridge" -debug # set it to promisc-mode $IFCONFIG $tap 0.0.0.0 promisc up log "tap-device set into the promisc-mode" -debug # ready 2 go log "openvpn ready to go" -debug ;; stop) # nothing to do if [ -n "`pidof openvpn`" ]; then $KILLALL openvpn 2>/dev/null fi ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/vpnstart.sh {start|stop|restart}" exit 1esacexit 0############################################ eof vpnstart.sh/*This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
[Updated 16. Aug. 2010 --- end]
4. Die Konfigurationsdatei von Openvpn /share/HDA_DATA/.qpkg/Optware/etc/openvpn/openvpn.conf
clientdev tapproto udpfloatnobindremote servmin.homelinux.org 1194resolv-retry infinitepersist-keypersist-tunca /share/HDA_DATA/.qpkg/Optware/etc/openvpn/keys/ca.crtcert /share/HDA_DATA/.qpkg/Optware/etc/openvpn/keys/client2.crtkey /share/HDA_DATA/.qpkg/Optware/etc/openvpn/keys/client2.keycomp-lzolog /share/HDA_DATA/.qpkg/Optware/etc/openvpn/log/client.logverb 3status /share/HDA_DATA/.qpkg/Optware/etc/openvpn/log/client-status.logtls-auth /share/HDA_DATA/.qpkg/Optware/etc/openvpn/keys/ta.key 1tls-clientfragment 1300mssfix
5. Die Keys
Es gibt ausreichend Beschreibungen zum Generieren der benötigten Verschlüsselungskeys. Die Beschreibung spar ich mir. Die Teile generieren und dann so platzieren
[~] # ls -l /share/HDA_DATA/.qpkg/Optware/etc/openvpn/keys-rwxr-xr-x 1 admin administ 1074 Sep 27 2007 ca.crt*-rwxr-xr-x 1 admin administ 3613 Oct 14 00:57 client2.crt*-rwxr-xr-x 1 admin administ 887 Oct 14 00:56 client2.key*-rwxr-xr-x 1 admin administ 636 Mar 5 2008 ta.key*
[Updated 16. Aug. 2010 --- start]
6. Server Konfiguration
Es gab noch einige Fragen in den Posts zum Thema Openvpn-Server. Ich habe nicht versucht, das NAS als Openvpn-Server einzusetzen, gehe aber davon aus, daß es dabei keine Probleme geben sollte. Als Idee für die Konfiguration hier meine Gentoo-Server-Konfig, die mit dem NAS-Client einwandfrei zusammenarbeitet:
#######################################################################
# Konfiguration für OpenVPN 2.0
# Multi-Client<->Server
#
# Original liegt in /scripts/gentoo/init.d/openvpn/server
# und basiert auf der Initialisierung einer Brigde, die vor
# dem OpenVPN-Server gestartet werden muß. Das entsprechende
# Script heißt /scripts/gentoo/etc/init.d/bridge
# c/o Peter Meins 03.10.07
#######################################################################
mode server
dev tap0
fast-io
port 1194
proto udp
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key # This file should be kept secret
dh /etc/openvpn/keys/dh1024.pem
tls-server
tls-auth /etc/openvpn/keys/ta.key 0
float
client-to-client
keepalive 10 120
comp-lzo
max-clients 4
user nobody
group nobody
persist-key
persist-tun
status /etc/openvpn/openvpn-status.log
log /etc/openvpn/openvpn.log
verb 3
fragment 1300
mssfix
Alles anzeigen
[Updated 16. Aug. 2010 --- end]
7. Firewall löchern
Nicht vergessen den Port 1194 auf beiden Seiten in den Routern freizuschalten, damit die Tunnelenden ihren Kram beim Router loswerden und sich sehen können.
Das Schöne am gebridgten VPN ist, daß sich alle Rechner in beiden Netzen ohne weitere Maßnahmen wie Routing sehen (pingen) können und sogar ein Game(chen) ist drin.
[Updated 16. Aug. 2010 --- start]
Eigendlich ist der gebridgte Lösungsansatz fast leichter zu realisieren als der geroutete, deshalb ist es schon erstaunlich, daß er weit seltener genutzt wird. Man bedenke, es gibt auch die Möglichkeit trotz Bridging verschiedene Netze zu nutzen und nur einigen Arbeitsstationen doppelte IPs (aus beiden Netzen) zu geben, damit sie miteinander kommunizieren können. Der Phantasie sind hier keine Grenzen gesetzt (und das alles ohne Routen :roll:) .
[Updated 16. Aug. 2010 --- end]
8. In der Hoffnung geholfen zu haben - viel Spaß damit
piet
p.s. übrigens die Startdatei beinhaltet einen kleinen Trick mit nem USB-Stick, der wenn er gesteckt wird, eine Abarbeitung der openvpn-Aufrufroutine verhindert. Das ermöglicht die nachträgliche Änderung der Startroutine für den Fall, daß man sich durch Fehler oder Schleifchen eingesperrt hat :shock: sozusagen der Dosenöffner in der Dose. Das erspart Normalsterblichen ohne serielle Konsole den Umbau der Festplatte in einen anderen Rechner, um den Fehler zu beheben.