Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Wlan mit OpenVPN schützen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page Previous  1, 2, 3, 4, 5  Next  
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation
View previous topic :: View next topic  
Author Message
AustrianCoder
Apprentice
Apprentice


Joined: 11 Oct 2003
Posts: 258
Location: �sterreich

PostPosted: Sun May 01, 2005 10:43 am    Post subject: Reply with quote

Hallo zusammen. Nachdem das OpenVPN 2.0 ebuild im portage ist, möchte ich diesen Sonntag gerne das VPN zum laufen bringen. Doch ich scheitere schon an OpenSSL :oops:

So, dann hier mal die Änderungen in der OpenSSL config:

Quote:

[ CA_default ]

dir = ./demoCA # Where everything is kept
certs = $dir/certs # Where the issued certs are kept
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
#unique_subject = no # Set to 'no' to allow creation of
# several ctificates with same subject.
new_certs_dir = $dir/newcerts # default place for new certs.

###certificate = $dir/cacert.pem # The CA certificate
certificate = my-ca.crt
serial = $dir/serial # The current serial number
#crlnumber = $dir/crlnumber # the current crl number must be
# commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
###private_key = $dir/private/cakey.pem# The private key
private_key = my-ca.key
RANDFILE = $dir/private/.rand # private random number file

x509_extensions = usr_cert # The extentions to add to the cert

# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default # Subject Name options
cert_opt = ca_default # Certificate field options

# Extension copying option: use with caution.
# copy_extensions = copy

# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions = crl_ext

default_days = 3650 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = md5 # which md to use.
preserve = no # keep passed DN ordering

# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_match


So nun Schritt für Schritt was ich nun mache.... (putty log)
Quote:

x-factor ssl # ls
certs misc openssl.cnf private privkey.pem
x-factor ssl # openssl req -nodes -new -x509 -keyout my-ca.key -out my-ca.crt -days 3650
Generating a 2048 bit RSA private key
..................................................+++
..............................................................................................+++
writing new private key to 'my-ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [*******]:
Locality Name (eg, city) [*******]:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) [*******]:
Email Address []:
x-factor ssl # openssl req -nodes -new -keyout server.key -out server.csr
Generating a 2048 bit RSA private key
................................+++
.+++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [*******]:
Locality Name (eg, city) [*******]:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) [*******]:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
x-factor ssl # openssl ca -out server.crt -in server.csr
Using configuration from /etc/ssl/openssl.cnf
./demoCA/index.txt: No such file or directory
unable to open './demoCA/index.txt'
20782:error:02001002:system library:fopen:No such file or directory:bss_file.c:278:fopen('./demoCA/index.txt','r')
20782:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:280:


So.. nun steh ich an... wer kann mir nun einen Tipp geben?
Merci
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Sun May 01, 2005 11:27 am    Post subject: Reply with quote

Du hast das aktuelle CA-Dir als relativen Pfad angegeben (./demoCA) daher ist es wichtig in welchem Verzeichnis du dich gerade befindest.
Du solltest dir am besten vorher ein Verzeichnis anlegen (z.b. /usr/ssl/myCA) und das dann als absoluten Pfad eintragen.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
AustrianCoder
Apprentice
Apprentice


Joined: 11 Oct 2003
Posts: 258
Location: �sterreich

PostPosted: Sun May 01, 2005 11:43 am    Post subject: Reply with quote

Hmm.. habe nun das in der openssl.cnf:

dir = /usr/ssl/myCA

Das Verzeichnis existiert auch, doch es wird da nichts gepseichert:

Quote:

x-factor ssl # openssl req -nodes -new -keyout server.key -out server.csr
Generating a 2048 bit RSA private key
.........+++
..................................................................................................................................+++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
...
...

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
x-factor ssl # openssl ca -out server.crt -in server.csr
Using configuration from /etc/ssl/openssl.cnf
/usr/ssl/myCA/index.txt: No such file or directory
unable to open '/usr/ssl/myCA/index.txt'
20885:error:02001002:system library:fopen:No such file or directory:bss_file.c:278:fopen('/usr/ssl/myCA/index.txt','r')
20885:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:280:
x-factor ssl # ls /usr/ssl/myCA


x-factor ssl # pwd
/etc/ssl
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Thu May 19, 2005 9:35 pm    Post subject: Reply with quote

huhu,

ist es eigentlich wurst was für einen wlan router man seither hatte? ich habe hier einen wrt54gs rumstehen von linksys, könnte ich den für solche aktionen auch gebrauchen?

cheerios,
toskala
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Sumpfdrache
Apprentice
Apprentice


Joined: 19 Jun 2004
Posts: 169

PostPosted: Thu May 19, 2005 10:10 pm    Post subject: Reply with quote

Wie ist das denn, wenn mein Accesspoint am Switch hängt und als Default-Gateway meinen Router hat, dann sollte das grundsätzlich (mit entsprechenden Modifikationen) doch auch gehen, oder?
_________________
Die Erkenntnis war wie ein Betonblock, der in den Treibsand seines Bewußtseins sank.
Back to top
View user's profile Send private message
Neo_0815
l33t
l33t


Joined: 24 Feb 2003
Posts: 815
Location: Leipzig

PostPosted: Tue May 24, 2005 12:08 pm    Post subject: Reply with quote

toskala wrote:
huhu,

ist es eigentlich wurst was für einen wlan router man seither hatte? ich habe hier einen wrt54gs rumstehen von linksys, könnte ich den für solche aktionen auch gebrauchen?

cheerios,
toskala


Jup, kannst du. Müßtest nur ein entsprechnendes Image zimmern das den Support hat und dann per Firmware Update aufspielen, man kann das ja bei der Linksys Reihe.
Das Freifunk Projekt machts ja auch so.

Gruß
_________________
[img:76661e22b8]http://www.biersekte.de/biersektebanner.gif[/img:76661e22b8]
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Tue May 24, 2005 1:05 pm    Post subject: Reply with quote

Neo_0815 wrote:
toskala wrote:
huhu,

ist es eigentlich wurst was für einen wlan router man seither hatte? ich habe hier einen wrt54gs rumstehen von linksys, könnte ich den für solche aktionen auch gebrauchen?

cheerios,
toskala


Jup, kannst du. Müßtest nur ein entsprechnendes Image zimmern das den Support hat und dann per Firmware Update aufspielen, man kann das ja bei der Linksys Reihe.
Das Freifunk Projekt machts ja auch so.

Gruß


ah, okay, ich verwende den nämlich derzeit mit openwrt. gibt es denn da fertige images? also ich meine klar, ich könnte die bridge entkoppeln, so dass er ein reiner AP ist, aber gibts da anleitungen wie man das genau mit einem wrt54gs macht?
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Neo_0815
l33t
l33t


Joined: 24 Feb 2003
Posts: 815
Location: Leipzig

PostPosted: Tue May 24, 2005 1:50 pm    Post subject: Reply with quote

Da bin ich überfragt im Moment, aber geben wird es sie denke ich mal bestimmt.

Gruß
_________________
[img:76661e22b8]http://www.biersekte.de/biersektebanner.gif[/img:76661e22b8]
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Wed May 25, 2005 9:43 am    Post subject: Reply with quote

Sumpfdrache wrote:
Wie ist das denn, wenn mein Accesspoint am Switch hängt und als Default-Gateway meinen Router hat, dann sollte das grundsätzlich (mit entsprechenden Modifikationen) doch auch gehen, oder?


Nun, was in deinem AP eingetragen ist, ist relativ egal, da dieser ja nicht für's routen zuständig ist. Die Einstellungen dort beziehen sich nur auf das Webinterface bzw. den HTTP-Server der dahinter steckt.
Wenn du nun ein Packet verschickst, dann wird das ja vom AP auf MAC-Ebene versendet und nicht auf IP-Ebene.

Allerdings muss dein Router ein Linux-Router sein (oder vergleichbares) denn dort muss dann OpenVPN drauf laufen.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
Sumpfdrache
Apprentice
Apprentice


Joined: 19 Jun 2004
Posts: 169

PostPosted: Wed May 25, 2005 3:08 pm    Post subject: Reply with quote

Anarcho wrote:

Nun, was in deinem AP eingetragen ist, ist relativ egal, da dieser ja nicht für's routen zuständig ist. Die Einstellungen dort beziehen sich nur auf das Webinterface bzw. den HTTP-Server der dahinter steckt.
Wenn du nun ein Packet verschickst, dann wird das ja vom AP auf MAC-Ebene versendet und nicht auf IP-Ebene.

Allerdings muss dein Router ein Linux-Router sein (oder vergleichbares) denn dort muss dann OpenVPN drauf laufen.

Ah ja. Na ja hab da (Accesspoint) Default-GW gesehen und Default-GW gedacht...
Der Router "dahinter" ist natürlich ein linuxoider. Dachte halt ich käm um die dritte Netzwerkkarte rum, aber das komm ich ja auch, weil ich ja für die AP-Mac (die ja nunmal auf meinen Router zugreifen muß, sonst surf ich über jemand anderen :lol: ) filtern kann, na ja sag ich jetzt mal so...*grübel*

...ich denk mal drüber fest nach und meld mich denn wieder :D
_________________
Die Erkenntnis war wie ein Betonblock, der in den Treibsand seines Bewußtseins sank.
Back to top
View user's profile Send private message
LL0rd
l33t
l33t


Joined: 24 May 2004
Posts: 652
Location: Schlundcity

PostPosted: Thu May 26, 2005 12:26 am    Post subject: Reply with quote

hmm..... anscheinend habe ich das gleiche Problem, wie AustrianCoder

Code:
openssl ca -out server.crt -in server.csr
Using configuration from /etc/ssl/openssl.cnf
/etc/ssl/myCA/index.txt: No such file or directory
unable to open '/etc/ssl/myCA/index.txt'
2314:error:02001002:system library:fopen:No such file or directory:bss_file.c:278:fopen('/etc/ssl/myCA/index.txt','r')
2314:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:280:


was ist das denn und wie kann ich es beheben?
_________________
Alte Mathematiker sterben nicht - sie verlieren nur einige ihrer Funktionen.
Back to top
View user's profile Send private message
Neo_0815
l33t
l33t


Joined: 24 Feb 2003
Posts: 815
Location: Leipzig

PostPosted: Sun May 29, 2005 9:11 am    Post subject: Reply with quote

LL0rd wrote:
hmm..... anscheinend habe ich das gleiche Problem, wie AustrianCoder

Code:
openssl ca -out server.crt -in server.csr
Using configuration from /etc/ssl/openssl.cnf
/etc/ssl/myCA/index.txt: No such file or directory
unable to open '/etc/ssl/myCA/index.txt'
2314:error:02001002:system library:fopen:No such file or directory:bss_file.c:278:fopen('/etc/ssl/myCA/index.txt','r')
2314:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:280:


was ist das denn und wie kann ich es beheben?


http://www.pseudonym.org/ssl/ssl_env.html

Lies dort gleich den ersten Absatz, da steht was die index.txt ist und auch wie man es behebt, Suchmaschinen helfen ab und an auch mal ...

Gruß
_________________
[img:76661e22b8]http://www.biersekte.de/biersektebanner.gif[/img:76661e22b8]
Back to top
View user's profile Send private message
LL0rd
l33t
l33t


Joined: 24 May 2004
Posts: 652
Location: Schlundcity

PostPosted: Sun May 29, 2005 9:24 am    Post subject: Reply with quote

Jau, ich habs schon hinbekommen.....

doch leider hat mir google dabei auch nicht weitergeholfen ;) (Aber touch :D )
_________________
Alte Mathematiker sterben nicht - sie verlieren nur einige ihrer Funktionen.
Back to top
View user's profile Send private message
Neo_0815
l33t
l33t


Joined: 24 Feb 2003
Posts: 815
Location: Leipzig

PostPosted: Sun May 29, 2005 2:32 pm    Post subject: Reply with quote

Boah, wie googlest du denn ... "openssl index.txt" suchen und gleich der erste Treffer ists, man oh man.

Gruß
_________________
[img:76661e22b8]http://www.biersekte.de/biersektebanner.gif[/img:76661e22b8]
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1753
Location: PB, Germany

PostPosted: Fri Jun 03, 2005 7:31 pm    Post subject: Reply with quote

Jetzt hab ich es nach einem Tag Arbeit fast geschafft, scheitere aber an der Verbindung:
Der Server meldet beim Verbinden des Clients
Code:
TLS ERROR: first response local/remote key_method mismatch, local key_method=1, op=P_CONTROL_HARD_RESET_CLIENT_V2
Der Client beendet nach einiger Zeit:
Code:
WARNING: file 'client.key' is group or others accessible
LZO compression initialized
TUN/TAP device tap0 opened
GID set to nobody
UID set to nobody
UDPv4 link local (bound): [undef]:1194
 UDPv4 link remote: 192.168.168.202:5000
read UDPv4 [ECONNREFUSED]: Connection refused (code=111)
read UDPv4 [ECONNREFUSED]: Connection refused (code=111)
[...]
read UDPv4 [ECONNREFUSED]: Connection refused (code=111)Fri Jun  3 21:09:15 2005 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
TLS Error: TLS handshake failed
SIGUSR1[soft,tls-error] received, process restarting
WARNING: you are using user/group/chroot without persist-key/persist-tun -- this may cause restarts to fail
WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
WARNING: file 'client.key' is group or others accessible
LZO compression initialized
Note: Cannot open TUN/TAP dev /dev/net/tun: Permission denied (errno=13)
Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Cannot allocate TUN/TAP dev dynamically
Exiting

Meine Umgebung ist ein openvpn-1.6 Server auf Mandrake mit einem neuen openvpn-2.0 client auf Gentoo.
Ist dabei etwas zu beachten? Auf dem Server mußte ich in der local.conf neben duplicate-cn auch folgende Zeile auskommentieren, weil er sie nicht kennt:
Code:
#mode server
Weil die Anleitung bei mir nicht ganz gepaßt hat, hab ich bei Mandrake mit einem Perl-skript CA.pl die Dateien erstellt:
Code:
usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify

Anmerkung zur Howto:
- server local.conf -> mode server: paßt bei meinem openvpn-1.6 nicht
- das rc-skript sucht standardmäßig in /etc/openvpn nach .conf, nicht /etc/openvpn/wireless
- client local.conf -> laptop.crt: sollte client.crt lauten, wie im Schritt vorher

Anarcho wrote:
Dachte halt ich käm um die dritte Netzwerkkarte rum

Also ich verwende den WLAN-Router auch als Router: Feste IP am WAN-Port, dann an Switch. Die iptables-Regeln stelle ich zwischen WAN und LAN des Routers ein, so daß nur VPN über den Accesspoint möglich ist. Ist das sicher? So hab ich mir das 3. Interface am Linux-Router gespart, und nutze die Funktion des WLAN-Routers.

Ttrotzdem danke für die howto.

Gruß,
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Sat Jun 04, 2005 8:54 am    Post subject: Reply with quote

Quote:
- server local.conf -> mode server: paßt bei meinem openvpn-1.6 nicht
- das rc-skript sucht standardmäßig in /etc/openvpn nach .conf, nicht /etc/openvpn/wireless


Das es nicht mit OpenVPN 1.6 läuft hatte ich aber erwähnt, daher damals auch OpenVPN 2.0 Beta
und mein Init-script unter gentoo sucht in den unterverzeichnissen.

Quote:
- client local.conf -> laptop.crt: sollte client.crt lauten, wie im Schritt vorher

Ist korrigiert.

Quote:
Dachte halt ich käm um die dritte Netzwerkkarte rum
das ist nicht von mir, bitte korrigiere doch deinen Thread.

Zu deinem Problem:

Seit openVPN 2.0 haben sich die Standardports geändert. Hast du beim Server und Client den Port eingestellt?
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
padarasa
n00b
n00b


Joined: 22 Apr 2005
Posts: 41

PostPosted: Wed Jun 15, 2005 10:01 pm    Post subject: Reply with quote

Hi,

also ich habe mein VPN nun so weit, dass es *fast* funktioniert. Irgendetwas stimmt bei meinen iptables-Regeln nicht:

Mit dem Laptop ohne VPN kann ich den Server nicht mehr anpingen, keine ssh-Verbindung mehr aufbauen usw... Aber: Ich kann immernoch ins Internet?
Soblad ich das VPN und net.tap0 starte kann ich den Server wieder anpingen usw.

Meine Konfiguration:
Server: eth0 -> Inet ; eth1 -> 192.168.0.1 (kabel) ; eth2 -> 192.168.2.1 (wlan bzw. vpn)

Mein Firewallscript:

Code:


# Interface-name (Device der aktuellen Verbindung, z.B. ppp0)
DEV_INET=$1

# local-IP-address (IP-Adresse, die wir vom Provider zuegwiesen bekommen
# haben
IP_INET=$4

# remote-IP-address (unsere Gegenstelle beim Provider)
IP_GATEWAY=$5

IPTABLES=/usr/sbin/iptables

echo 0 > /proc/sys/net/ipv4/ip_forward

modprobe ip_tables &> /dev/null
modprobe ip_conntrack &> /dev/null
modprobe ip_conntrack_ftp &> /dev/null
modprobe ipt_state &> /dev/null
modprobe iptable_nat &> /dev/null
modprobe ipt_REJECT &> /dev/null
modprobe ipt_MASQUERADE  &> /dev/null

$IPTABLES -F
$IPTABLES -X
$IPTABLES -F -t filter
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -t filter -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X

$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

$IPTABLES -t nat -A POSTROUTING -o $DEV_INET -j MASQUERADE

$IPTABLES -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

$IPTABLES -A INPUT -i $DEV_INET -m state --state NEW,INVALID -j REJECT
$IPTABLES -A FORWARD -i $DEV_INET -m state --state NEW,INVALID -j REJECT

iptables -t filter -A INPUT --protocol udp --dport 5000 -j ACCEPT -i eth2
iptables -t filter -A INPUT -j REJECT -i eth2

echo 1 > /proc/sys/net/ipv4/ip_forward


Wie gesagt, alle Serverdienste kann ich per WLAN ohne VPN nicht mehr erreichen (so wie sein soll), also nfs, ssh usw. Aber aus irgendwelchen Gründen kann ich ohne VPN trotzdem problemlos ins Internet.
Ich vermute, dass im obigen Script ein Fehler vorliegt - ich find ihn nun nicht :-(.
Vielleicht weiß ja jemand wo das Problem liegt und kann mir helfen *hoff*
Back to top
View user's profile Send private message
linpacman
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2004
Posts: 124

PostPosted: Sun Aug 14, 2005 2:25 pm    Post subject: Verbindung zu nfs Server bricht ab nach Start von OpenVPN Reply with quote

Hallo

Ich habe seit einiger Zeit mein WLAN zum Notebook mit Hilfe dieses Howtos durch OpenVPN geschützt. Bisher lief auch alles einwandfrei, jedoch habe ich jetzt die interne WLAN Karte, welche bisher als Access Point diente, gegen eine normale Netzwerkkarte getauscht und an diese einen Netgear Access Point angeschlossen.

Seitdem besteht das Problem, daß zwar sämtliche Verbindungen laufen, jedoch bricht die Verbindung zu einem nfs Server im Lan zusammen, sobald ein Datentransfer gestartet wird. Im Log steht nur: nfs server not responding, still trying
Breche ich den Transfer ab, wird der nfs Server wieder gefunden: nfs server OK

Ein Transfer vom Samba Server läuft nach wie vor ohne Probleme. Beende ich OpenVPN und verbinde mich direkt mit dem Access Point, läuft auch der nfs Transfer so wie es vorher auch durch den VPN Tunnel möglich war.

Woran kann das liegen oder wie kann ich den Fehler genauer einkreisen?
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Wed Aug 17, 2005 3:59 pm    Post subject: Reply with quote

padarasa wrote:
Hi,

also ich habe mein VPN nun so weit, dass es *fast* funktioniert. Irgendetwas stimmt bei meinen iptables-Regeln nicht:

Mit dem Laptop ohne VPN kann ich den Server nicht mehr anpingen, keine ssh-Verbindung mehr aufbauen usw... Aber: Ich kann immernoch ins Internet?
Soblad ich das VPN und net.tap0 starte kann ich den Server wieder anpingen usw.
[...]
Wie gesagt, alle Serverdienste kann ich per WLAN ohne VPN nicht mehr erreichen (so wie sein soll), also nfs, ssh usw. Aber aus irgendwelchen Gründen kann ich ohne VPN trotzdem problemlos ins Internet.
Ich vermute, dass im obigen Script ein Fehler vorliegt - ich find ihn nun nicht :-(.
Vielleicht weiß ja jemand wo das Problem liegt und kann mir helfen *hoff*


Du solltest die Default-regel für FORWARD auf DROP stellen und dann das interene LAN erlauben, statefull erlauben und alle über tap0 laufenden Verbindungen erlauben.
Hier mal mein firewall-script. Ist sicherlich auch nicht das Non-Plus-Ultra, aber für meine Zwecke reicht es:
Code:
#/bin/bash

# Flushing
iptables -F INPUT
iptables -F FORWARD
iptables -t nat -F POSTROUTING
iptables -F LOG_DROP
iptables -X LOG_DROP

echo 1 > /proc/sys/net/ipv4/ip_forward

if [ "$1" == "stop" ]; then
   iptables -P INPUT ACCEPT
   iptables -P FORWARD ACCEPT
   exit 0
fi

# define some variables
LAN=eth2
WLAN=eth1
INET=ppp0
VPNS="tap+"
AP_IP="192.168.1.245"

# Logging
iptables -N LOG_DROP
iptables -A LOG_DROP -j LOG --log-tcp-options --log-ip-options --log-prefix '[IPTABLES DROP] : '
iptables -A LOG_DROP -j DROP


### INPUT ####
# standart auf drop setzen
iptables -P INPUT DROP
# alle lokalen verbindungen erlauben
iptables -A INPUT -j ACCEPT -i $LAN
iptables -A INPUT -j ACCEPT -i lo
iptables -A INPUT -i $VPNS -j ACCEPT
#einzelne Ports nach aussen öffnen
iptables -A INPUT --protocol tcp --dport 50145 -j ACCEPT -i $INET   # für Azureus
iptables -A INPUT --protocol tcp --dport 80 -j ACCEPT -i $INET      # Apache
iptables -A INPUT --protocol tcp --dport 22 -j ACCEPT -i $INET      # SSH
iptables -A INPUT --protocol tcp --dport 25 -j ACCEPT -i $INET      # SMTP
# iptables -A INPUT --protocol tcp --dport 465 -j ACCEPT -i $INET   # SMTPs
iptables -A INPUT --protocol tcp --dport 993 -j ACCEPT -i $INET   # IMAPs
iptables -A INPUT --protocol udp --dport 993 -j ACCEPT -i $INET   # IMAPs
iptables -A INPUT --protocol tcp --dport 995 -j ACCEPT -i $INET   # POP3s
iptables -A INPUT --protocol udp --dport 995 -j ACCEPT -i $INET   # POP3s
iptables -A INPUT --protocol tcp --dport 9552 -j ACCEPT -i $INET   # mldonkey
iptables -A INPUT --protocol udp --dport 9556 -j ACCEPT -i $INET   # mldonkey
#iptables -A INPUT --protocol tcp --dport 22333 -j ACCEPT -i $INET   # mein C-Server
iptables -A INPUT --protocol icmp -j ACCEPT -i $INET         # Ping erlauben
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -i $INET   # aktive verbindungen erlauben
#iptables -A INPUT -i $WLAN -j ACCEPT # for testing only
iptables -A INPUT --protocol udp --dport 5000 -j ACCEPT -i $WLAN   # enable openvpn
#iptables -A INPUT --protocol tcp --dport 80 -j ACCEPT -i $WLAN -d 192.168.1.1 # enable local webserver to download files
#iptables -A INPUT -j LOG_DROP
iptables -A INPUT -j REJECT


### FORWARD ####
iptables -P FORWARD DROP
iptables -A FORWARD -i $LAN -j ACCEPT   # alle Verbindungen aus dem lokalen Netz erlauben
iptables -A FORWARD -i $VPNS -j ACCEPT   # alle Verbindungen von VPN Interfaces erlauben
iptables -A FORWARD -i lo -j ACCEPT   # localhost erlauben
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT -i $INET      # aktive verbindungen erlauben
iptables -A FORWARD -i $WLAN --protocol tcp --sport 80 -s $AP_IP -j ACCEPT   # Verbindungen vom LAN zum AP Webinterface erlauben



### NAT ####
# For internetsharing/Masquerading
iptables -t nat -A POSTROUTING -j MASQUERADE -o $INET   # DSL Masquerading
iptables -t nat -A POSTROUTING -j MASQUERADE -o tap1   # Masquerading fürs externe VPN Netz zur Onkochemie


Ich hoffe es ist einigermassen selbsterklärend. Sonst frag nach.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
linpacman
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2004
Posts: 124

PostPosted: Sat Aug 20, 2005 10:35 am    Post subject: Reply with quote

Ich habe den Fehler gefunden, wieso kein Datentransfer über den VPN Tunnel zu einem NFS Server möglich war. Es lag an der fragment Größe, welche ich nun in der Server und Client Config auf 1200 gesetzt habe. Nach der Änderung ist ein Transfer vom/zum NFS Server problemlos möglich.
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Thu Sep 15, 2005 9:06 pm    Post subject: Reply with quote

also soweit so gut. nun hab ich mir nen AP geholt alles feinstens confed und unter windows bekomme ich dann vom client in der dosbox folgende fehlermeldung, leider hab ich keine wirkliche idee warum, kann mir vielleicht jemand weiterhelfen?

cheerios,
toskala

die meldung des windows clients:
Code:

write UDPv4: No Route to Host (WSAEHOSTUNREACH) (code=10065)


die config files sehen wie folgt aus:

Code:
spiderman wireless # cat /etc/openvpn/wireless/local.conf
dev tap
ifconfig 10.1.0.1 255.255.255.0
mode server
tls-server
dh dh2048.pem
ca my-ca.crt
cert server.crt
key server.key
tun-mtu 1500
mssfix 1400
comp-lzo
tls-auth /etc/openvpn/wireless/wireless.key 0
duplicate-cn
chroot /etc/openvpn/wireless/newroot
user nobody
group nobody


Code:
spiderman wireless # cat /etc/dhcp/dhcpd.conf
# Netzwerk des VPN
subnet 10.1.0.0 netmask 255.255.255.0
{
        range 10.1.0.12 10.1.0.120;
        option domain-name-servers 145.253.2.203, 145.253.2.171;
        option routers 10.1.0.1;
        option broadcast-address 10.1.0.255;
}


Code:
spiderman wireless # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:02:17:8C:D6
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40554 errors:0 dropped:0 overruns:1 frame:0
          TX packets:43679 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5535901 (5.2 Mb)  TX bytes:17706601 (16.8 Mb)
          Interrupt:9 Base address:0xb800

eth2      Link encap:Ethernet  HWaddr 00:04:75:E6:26:67
          inet addr:10.10.10.10  Bcast:10.10.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1680 (1.6 Kb)  TX bytes:8988 (8.7 Kb)
          Interrupt:10 Base address:0xa400

tap0      Link encap:Ethernet  HWaddr 12:6C:D5:75:28:A9
          inet addr:10.1.0.1  Bcast:10.1.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)



und hier noch die firewall die ich seither immer verwendet habe.

Code:
#!/bin/bash

LOCALHOST=127.0.0.1
MYIP=192.168.0.1
INTERN=192.168.0.0/24
ALL=0.0.0.0/0

UNPRIV=1024:65535
PRIV=0:1023

IINTERFACE=ppp0

case "$1" in
    start)
        iptables -F INPUT
        iptables -F OUTPUT
        iptables -F FORWARD

        iptables -P INPUT DROP
        iptables -P OUTPUT ACCEPT
        iptables -P FORWARD ACCEPT

        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo 1 > /proc/sys/net/ipv4/tcp_syncookies
        echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
        echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses

        for f in /proc/sys/net/ipv4/conf/*/accept_redirects
        do
                echo 0 > $f
        done

        for f in /proc/sys/net/ipv4/conf/*/accept_source_route
        do
                echo 0 > $f
        done

        iptables -A INPUT -i lo -j ACCEPT

        iptables -A INPUT -p tcp -s $INTERN -d $INTERN -j ACCEPT
        iptables -A INPUT -p udp -s $INTERN -d $INTERN -j ACCEPT
        iptables -A INPUT -p icmp -s $INTERN -d $INTERN -j ACCEPT

        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

        iptables -A INPUT -p icmp --icmp-type echo-reply                -j ACCEPT       # type  0
        iptables -A INPUT -p icmp --icmp-type source-quench             -j ACCEPT       # type  4
        iptables -A INPUT -p icmp --icmp-type time-exceeded             -j ACCEPT       # type 11
        iptables -A INPUT -p icmp --icmp-type parameter-problem         -j ACCEPT       # type 12
        iptables -A INPUT -p icmp --icmp-type fragmentation-needed      -j ACCEPT       # type  3
        iptables -A INPUT -p icmp --icmp-type port-unreachable          -j ACCEPT       # type  3

        #openvpn regel
        iptables -A INPUT --protocol udp --dport 5000 -j ACCEPT -i eth2
        iptables -A INPUT -j DROP -i eth2

        iptables -A INPUT -j DROP

        iptables -t nat -A POSTROUTING -s $INTERN -o $IINTERFACE -j MASQUERADE
        ;;


    stop)
        iptables -F INPUT
        iptables -F OUTPUT
        iptables -F FORWARD
        iptables -A INPUT -j ACCEPT
        iptables -A OUTPUT -j ACCEPT
        iptables -A FORWARD -j DROP
        ;;

    *)
        echo Usage: firewall start/stop
esac

_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Thu Sep 15, 2005 9:24 pm    Post subject: Reply with quote

toskala wrote:
die meldung des windows clients:
Code:

write UDPv4: No Route to Host (WSAEHOSTUNREACH) (code=10065)


Das sieht nach nem generellen Netzwerkproblem aus. Entweder du bist nicht verbunden oder im falschen Adressraum.

Zeig dochmal die Einstellungen vom WindowsClient bzw. versuch mal den Server zu pingen ohne VPN.
Wenn ich das richtig gesehen habe erlaubst du ja ICMP.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Thu Sep 15, 2005 9:50 pm    Post subject: Reply with quote

hmm, naja, ich kann den server nicht pingen. die wlan karte hat laut ipconfig auch keine ip adresse bekommen *wunder*

muss ich vorher die wlan karte manuell auf dem AP einbuchen damit das ganze funktioniert?

also falls ja, spielt es denn eine rolle ob ich das mit dem windows werkzeug für drahtlose netze mache oder mit dem mitgelieferten intel software werkzeug?

ich werd das alles aber erst morgen wieder testen, ich muss früh raus und nu is schon kurz vor 00:00 *schauder* :)

cheerios,
toskala
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Thu Sep 15, 2005 10:33 pm    Post subject: Reply with quote

Also du musst natürlich vorher ganz normal mit dem AP verbunden sein. Das heisst etwaige Schlüssel (WEP/WPA) müssen eingerichtet sein, die SSID und der Channel ebenso. Dann brauchst du ne IP für das normale Interface sonst finden die OpenVPN Pakete ihren Weg ja nicht. Erst dann wird der VPN Tunnel aufgebaut und ab dann sollte dein Default-GW das andere Ende des Tunnels sein, damit alle Pakete über den Tunnel gehen.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Fri Sep 16, 2005 7:21 am    Post subject: Reply with quote

ah okay, dann steckt da wohl das problem.

aus irgendeinem stumpfen grund will sich dieses scheisstool was bei der wlan-karte dabei war, welches den windows konfig dialog abgestellt hat, nicht mit dem ap verbinden. also naja, trotz fest eingestellter ip adresse, also gleiches netz wie der ap auch is, behauptet das ding zwar "verbindung hergestellt" aber es vergibt eine IP aus dem bereich 169.irgendwas und das passt absolut gar nicht zu meinem netz.

also wenn ich das korrekt verstehe:
die wlan karte muss verbindung zum AP haben, den AP kann ich im besten fall pingen, und auf port 1194 oder eben 5000 lass ich auf der anderen IP den openvpn horchen?

falls dem so ist stehen mir ja noch lustige stunden bevor damit das windows dingens endlich die wlan karte ordentlich verbindet... *grummel* ich probier das gleich heut abend mal aus ;)
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum