Schrittbetrieb.
Zonenprüfung:
uci show firewall.@zone[0] von 0 bis 3, wobei es nur insgesamt drei geben dürfte.
Prüfung auf Forward:
uci show firewall.@forwarding[0] auch hier dürften nur drei geben.
Albert
Schrittbetrieb.
Zonenprüfung:
uci show firewall.@zone[0] von 0 bis 3, wobei es nur insgesamt drei geben dürfte.
Prüfung auf Forward:
uci show firewall.@forwarding[0] auch hier dürften nur drei geben.
Albert
Bei Firewall restart keine Fehlermeldung auf fehlende ipset?
Albert
Ist nun strongswan-mod-kernel-libipsec installiert oder nicht?
Sichere strongswan.conf und versuche es mit der aus Post 196.
Ist in /etc/strongswan.d/charon aes.conf vorhanden?
Wenn alles nicht hilft, dann müssen wir den Firewall mit uci im Schrittbetrieb inspizieren.
Ich bin für eine halbe Stunde weg.
Albert
Mit "option subnet '88.198.76.220 192.168.100.0/24'" auch nicht?
Möglich das Du in der /etc/ipsec.conf bei racoon auch noch rightsubnet=88.198.76.220/32 eintrage musst.
Albert
Die /etc/ipsec.secrets poste ich verständlicherweise nicht, aber ohne die würde ja der Tunner überhaupt nicht entstehen.
Schon klar, aber Syntax: @cougar.tvdr.de @racoon.tvdr.de : PSK "wurst" !?
Geht es wenn /etc/init.d/firewall stop ist?
Ist die /etc/ipsec.conf wirklich wie gehabt (ohne rightsubnet)?
War früher in der /etc/config/firewall racoon mit Adresse oder mit Adresse/Subnet eingetragen?
/etc/init.d/firewall stop
ipsec reload
ipsec restart
ipsec statusall
traceroute und ping
/etc/init.d/firewall start
traceroute und ping
Ich werde zum Kaffee geladen. Bis dann.
Albert
Das hatte ich nach dem Neuinstallation auch. Ein reboot hat das Problem gelöst.
Wenn nicht, dann zeige bitte die oben genannten Dateien.
Albert
Ich habe mal versuchsweise auf modp3072 umgestellt (sowohl auf racoon als auch auf cougar), aber damit kam der Tunnel nicht zustande. Muß ich da außer modp2048 zu modp3072 zu ändern noch etwas machen?
Dann lasse es so, wie gehabt, eine Orgie aus Versuchen bringt niemanden weiter. Die Wahrscheinlichkeit einer Attacke ist gegen null.
Ich arbeite gewöhnlich auf potenter Router-Hardware mit AES256, SHA256, DH Gruppen aus der neuen Spezifikation für Phase 1 IKEv2 und Phase 2 läuft mit MD5. Das ist aber nicht meine Empfehlung für Deine Hardware! Kann dazu führen, dass die Übertragungsgeschwindigkeit drastisch einbricht oder es treten unerklärliche Effekte auf.
Albert
Einige Parameter, die ich bisher nicht verwendet habe, die du aber angegeben hast, habe ich erstmal auskommentiert - ich möchte das Ganze zu simpel wie möglich halten.
Die Einträge ike und esp brauchst Du spätestens nach der Neuinstallation, weil strongswan-mod-kernel-libipsec für die "Suchautomatik" nicht mit installiert wird, wozu auch.
Das Mode aggressive=yes schaltest Du zu, wenn es bei der Tunnel mit dynamische IPs Probleme gibt, wie right=%panther.tvdr.de, sonst tut es das Mode main auch. Ob ikev1 oder ikev2, bzw. Kombi, dass ist Deine Sache.
Du arbeitest mit AES-128, dazu passt die PFS DH Gruppe modp2048 nicht. Besser wäre es die modp3072 zu nehmen (sofern vertretbar), damit Du in DH auch 128 security bits hast. Bei modp2048 sind es nur 103 bits und damit eine potentielle Schwachstelle in der Verschlüsselungskette. Wer einen brute-force plant dann wendet er das traditionell auf DH und nicht auf AES an. Wir wollen nicht, dass PFS nicht mehr für Perfect Forward Secrecy steht.
Der Tunnel zu panther ist offensichtlich schon bereit, die entsprechenden Änderungen auf panther wage ich aber remote nicht zu machen, um nicht Gefahr zu laufen, mich auszusperren.
Ein SSH Portforward von WAN kommend auf 127.0.0.1 verhindert das schon. Wenn Du fertig bist, dann entsorgst Du den wieder.
Albert
Das ist für die zwei Tunnel (racoon und panther) von cougar gesehen.
# ipsec.conf - strongSwan IPsec configuration file /etc/ipsec.conf
# basic configuration
config setup
# strictcrlpolicy=yes
# uniqueids = no
# Add connections here.
conn %default
left=%defaultroute
leftsubnet=192.168.1.0/24
leftid=@cougar.tvdr.de
leftfirewall=no
keyexchange=ikev1
aggressive=yes
authby=secret
ike=aes128-sha1-modp2048
esp=aes128-sha1-modp2048
auto=start
conn racoon
right=88.198.76.220
rightid=@racoon.tvdr.de
conn panther
right=%panther.tvdr.de
rightid=@panther.tvdr.de
rightsubnet=192.168.100.0/24
Display More
Den zweiten Subnet in der /etc/config/firewall unter (option subnet '88.xxx.xxx.220/32 192.168.100.0/24') eintragen.
Albert
Deine Anleitung ist genial einfach und ich bin froh, daß du ohne das dubiose firewall.sh Script auskommst :-).
Ich auch. Das Script ist, na ja.
Ich werde am WE den Router nochmal komplett neu aufsetzen und deine Anleitung durchspielen.
Das ist eine gute Idee.
Einen Tunnel zwischen cougar und panther hätte ich schon gerne, wobei ich bis jetzt davon ausgegangen bin, daß man das wohl mit entsprechenden Routing-Einträgen lösen könnte.
Das geht mit strongSwan so brutal einfach, dass man es nur als Eleganz bezeichnen kann.
In /etc/ipsec.conf tragen wir einen neuen conn nach panther ein und schlagen den zweiten Subnet in der /etc/config/firewall dazu (option subnet '88.xxx.xxx.220/32 192.168.100.0/24').
Ja, das ist alles.
Ach: strongswan-mod-kernel-libipsec, forget it! Auch die diff-s. Wenn Du es unbedingt brauchst, dann so:
# /etc/strongswan.conf
# strongswan.conf - strongSwan configuration file
#
# Refer to the strongswan.conf(5) manpage for details
#
# Configuration changes should be made in the included files
charon {
filelog {
/var/log/charon.log {
# add a timestamp prefix
time_format = %b %e %T
# prepend connection name, simplifies grepping
ike_name = yes
# overwrite existing files
append = no
# increase default loglevel for all daemon subsystems
default = 2
# flush each line to disk
flush_line = yes
}
stderr {
# more detailed loglevel for a specific subsystem, overriding the
# default loglevel.
ike = 2
knl = 3
}
}
load_modular = yes
plugins {
include strongswan.d/charon/*.conf
kernel-netlink {
fwmark = !0x42
}
socket-default {
fwmark = 0x42
}
kernel-libipsec {
allow_peer_ts = yes
}
}
}
Display More
Das Log ist sehr gesprächig. Wenn Du magst oder wenig Platz, dann ändern.
Wie auch immer, wenn Du neu installierst, dann sollten wir VORHER die /etc/ipsec.conf unter die Lupe nehmen!
Hättest Du Dir nicht für die Sache eine Woche ohne Fußball aussuchen können!?
Albert
Da fehlt vielleicht noch eine entsprechende FW-Regel.
So ist es.
Zusammenfassung:
1. OpenWRT in der VM Aufgesetzt, konfiguriert (Passwort, SSH, Interfaces, Zeit).
2. opkg update && opkg install strongswan-default ipset bringt alle benötigte Pakete.
3. /etc/strongswan.conf nicht geändert, /etc/ipsec.conf (leftfirewall=no !) und /etc/ipsec.secrets angepasst, Tunnel steht.
4. /etc/config/firewall und /etc/firewall.user erstellt, reboot.
#/etc/config/firewall
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option src_ip 'fe80::/10'
option src_port '547'
option dest_ip 'fe80::/10'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'vpn'
option network ' '
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option subnet '192.168.8.0/24'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'vpn'
option dest 'lan'
config forwarding
option src 'lan'
option dest 'vpn'
config forwarding
option src 'lan'
option dest 'wan'
config include
option path '/etc/firewall.user'
option reload 1
Display More
#/etc/firewall.user
iptables -t nat -A prerouting_wan_rule -m policy --dir in --pol ipsec -j ACCEPT
iptables -t nat -A postrouting_wan_rule -m policy --dir out --pol ipsec -j ACCEPT
iptables -A forwarding_rule -m policy --dir in --pol ipsec -m conntrack --ctstate N -j zone_vpn_forward
iptables -A input_wan_rule -m policy --dir in --pol ipsec -m conntrack --ctstate N -j ACCEPT
Das wäre mal eine aussagekräftige Anleitung, findest Du nicht? Wozu auf drei verschiedenen Internetseiten beschreiben, was nicht funktioniert?
Die /etc/config/firewall ist neu, tausche sie aus (IP ersetzen!). Sie behebt Deine restlichen Probleme.
Möchtest Du auch einen Tunnel von cougar nach panther?
Albert
Albert, du bist der Größte!!!
Wenn Du es meinst.
Was noch nicht geht ist racoon von einem Rechner im lokalen Netz (also "hinter" dem Router) anzusprechen:
Das geht bei mir. Wie sind die IP Einstellungen von Deinem MacBook-Pro? (MacBook!?)
Und auch von racoon aus kann ich keinen Rechner "hinter" dem Router (also z.B. 192.168.1.220) ansprechen.
Wenn du auch dafür noch eine Lösung finden könntest, dann wäre es perfekt!
Das muss ich noch testen. Ich setze in VM OpenWRT neu auf (dauert ca. 15 Minuten), denn es geht viel schlanker als angenommen, dann berichte ich.
Albert
Klaus, ich stufe es jetzt als Beta ein, aber teste selbst.
Wie bei der Rotorsteuerung wollte ich mich nicht geschlagen geben. So ist es mir gelungen, ohne den "Script" eine reine Zonen Forwarding mit einfachen Mitteln zu bewältigen.
1. Tunnel steht! (Geht ggf. viel einfacher. Wenn Du magst, dann schreibe ich was dazu.)
2. leftfirewall=no ! iptables Zonen Forward ohne störende Elemente.
3. Deine Änderungen (Diffs) behältst Du, geht aber auch eleganter.
Was Du noch brauchst, das steht hier:
login as: root
root@192.168.220.1's password:
BusyBox v1.23.2 (2015-07-25 06:35:11 CEST) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
CHAOS CALMER (15.05, r46767)
-----------------------------------------------------
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
* 3/4 oz Lime Juice unstrained into a goblet.
* 1 1/2 oz Orange Juice
* 1 tsp. Grenadine Syrup
-----------------------------------------------------
root@OpenWrt:~# cat /etc/config/firewall
#/etc/config/firewall
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option src_ip 'fe80::/10'
option src_port '547'
option dest_ip 'fe80::/10'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'vpn'
option network ' '
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option subnet '192.168.8.0/24'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'vpn'
option dest 'wan'
config forwarding
option src 'lan'
option dest 'wan'
config include
option path '/etc/firewall.user'
option reload 1
root@OpenWrt:~# cat /etc/firewall.user
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.
# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
iptables -t nat -A prerouting_wan_rule -m policy --dir in --pol ipsec -j ACCEPT
iptables -t nat -A postrouting_wan_rule -m policy --dir out --pol ipsec -j ACCEPT
iptables -A forwarding_rule -m policy --dir in --pol ipsec -m conntrack --ctstate N -j zone_vpn_forward
iptables -A input_wan_rule -m policy --dir in --pol ipsec -m conntrack --ctstate N -j ACCEPT
root@OpenWrt:~#
Display More
IP auf racoon setzen! Das war's schon.
Albert
Klaus, heute hatte ich ein wenig Zeit (Hotline geschoben). Soweit sind wir schon:
root@OpenWrt:/# ipsec restart
Stopping strongSwan IPsec...
Starting strongSwan 5.3.3 IPsec [starter]...
root@OpenWrt:/# ipsec statusall
Status of IKE charon daemon (strongSwan 5.3.3, Linux 3.18.20, x86_64):
uptime: 11 seconds, since Dec 09 18:48:47 2015
malloc: sbrk 225280, mmap 0, used 212256, free 13024
worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 2
loaded plugins: charon aes des rc2 sha1 sha2 md5 random nonce x509 revocation constraints pubkey pkcs1 pgp dnskey sshkey pem fips-prf gmp xcbc hmac attr kernel-netlink resolve socket-default stroke updown xauth-generic
Listening IP addresses:
192.168.220.1
79.xxx.xxx.118
Connections:
ms: %any...xxx.dyndns.org,0.0.0.0/0,::/0 IKEv1 Aggressive
ms: local: [cougar] uses pre-shared key authentication
ms: remote: [racoon] uses pre-shared key authentication
ms: child: 192.168.220.0/24 === 192.168.8.0/24 TUNNEL
Security Associations (1 up, 0 connecting):
ms[1]: ESTABLISHED 11 seconds ago, 79.xxx.xxx.118[cougar]...79.xxx.xxx.173[racoon]
ms[1]: IKEv1 SPIs: 8b89a581b1d31502_i* 46613ad86a57075c_r, pre-shared key reauthentication in 56 minutes
ms[1]: IKE proposal: AES_CBC_128/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_1024
ms{1}: INSTALLED, TUNNEL, reqid 1, ESP SPIs: c0026296_i 31a345cc_o
ms{1}: AES_CBC_128/HMAC_SHA1_96, 28 bytes_i, 0 bytes_o, rekeying in 14 minutes
ms{1}: 192.168.220.0/24 === 192.168.8.0/24
root@OpenWrt:/# traceroute 192.168.8.21
traceroute to 192.168.8.21 (192.168.8.21), 30 hops max, 46 byte packets
1 192.168.8.254 (192.168.8.254) 53.702 ms 53.536 ms 53.449 ms
2 192.168.8.21 (192.168.8.21) 53.158 ms 53.760 ms 54.332 ms
root@OpenWrt:/# ping 192.168.8.21
PING 192.168.8.21 (192.168.8.21): 56 data bytes
64 bytes from 192.168.8.21: seq=0 ttl=254 time=53.470 ms
64 bytes from 192.168.8.21: seq=1 ttl=254 time=53.430 ms
Display More
Traceroute und Ping von OpenWRT Console an die 30 km entfernter Drucker hinter einem Funkwerk Router.
Lasse mir noch ein paar Tage Zeit. Vielleicht gibt es diese Woche schon die endgültige Lösung.
Albert
Eine Fehlermeldung haben wir noch bei "52 ip6tables -F zone_vpn_ACCEPT". Das kannst Du mit ip6tables -N zone_vpn_ACCEPT aus der Post 174 bereinigen.
Eine kurze Inspektion zeigt aber logische Fehler (Reihenfolge / Zuordnung), auch wenn wir nahezu null Fehlermeldungen mehr bekommen. Daran müssen wir noch arbeiten. ;.)
Hilfreich wäre, wenn Du die aktuelle /etc/config/firewall und /etc/firewall.user zeigen würdest. Wenn ich sie in der VM einbaue, dann könnte ich mit LuCI die Abarbeitungsreihenfolge besser betrachten.
Es eilt nicht!
Albert
Sieht aus als kämen wir durchaus voran :-).
Was sonst?
Ich werde allerdings Freitag und Samstag nichts testen können. Melde mich ggf. am Sonntag wieder.
Klaus, lasse Dir Zeit. Das kommt mir durchaus gelegen.
Albert
Bleiben also nur noch die beiden Fehler bei 9 und 10, für die ich aber keine Erklärung finde.
Ach, "iptables -A zone_vpn_ACCEPT ...". Sie muss existieren bevor Bedingungen daran geknüpft werden.
Also entweder über die Console einmalig, oder wenn nicht persistent, dann am Anfang des Scriptes einbauen.
Albert
Bleiben also nur noch die beiden Fehler bei 9 und 10, für die ich aber keine Erklärung finde.
Hm, welche sind sie denn ?
Albert
Klaus, ich habe die Ausgabe doch noch genauer inspiziert. So schlecht sieht es nicht aus.
Die "config_get zone "cfg026e19" zone vpn" ist der fehlenden /etc/config/ipsec geschuldet, denke ich. Nimm sie aus der Post 100.
Für die:
trage erstmal einmalig auf der Console folgendes ein:
Bei -N gilt, was ich in der Post 177 unter VORSICHT geschrieben habe!
Danach ersetzt Du in der Script die:
-I input -> -I INPUT
-I forward -> -I FORWARD
Firewall restart!?
Albert
Eine Frage noch. Bei mir in der VM ist /var ein Link auf /tmp. Ist das bei Dir auch so? Wenn ja, dann bedeutet es, dass die Beschreibung von Basic bezüglich der strongSwan Implementierung hinfällig ist.
Albert