HELP, CSF zegt: “IPv6 is fout!”
CSF firewall, een leuke tool die IPtables onder linux servers kan aansturen en waarbij je op DirectAdmin en Plesk servers ook nog een leuke grafische integratie hebt in je controlpanel. Een ideale tool voor mensen die simpel en makkelijk een firewall op de server willen installeren, zonder enige vorm van kennis.
Dit laatste punt is nu een probleem. In CFS zit een ‘check server security’ functie en een standaard CentOS + DirectAdmin installatie is verre van goed of veilig. Ik heb wel eens klanten die geen rootpassword hebben maar me wel een shared hostingpakket kunnen geven. Binnen 30 seconden hack ik die machines dan.
Een van de foutmeldingen in CSF die me verbaast is de melding die hij geeft over IPv6. Eigenlijk een waarschuwing, waarbij het advies gegeven wordt om IPv6 maar uit de kernel te slopen. WTF?! IPv6 komt eraan en snel ook. Wanneer je nog geen IPv6-adressen hebt moet je hard zeuren bij je provider. Volgens jaar waneer de IPv4-adressen op zijn, ontkom je er toch niet aan.
Ga dus niet IPv6 support uit de kernel slopen om het straks weer aan te zetten. Iedere Redhat (CentOS) 5 server heeft standaard een IPv6 local-link adre en dit kan weinig tot geen kwaad. Wat is dan wel de goede oplossing? In de speeltuin poste ik hem al: gebruik ip6tables om gewoon alle poorten te firewallen, al zal ik zelf het advies geven poort 53 open te laten zodat in ieder geval je DNS-server ook over IPv6 te bereiken is, zie deze post.
Goed, het scipt. Mocht je nog géén IPv6 adres van je provider gehad hebben, laat dat de regel met deze variabele (regel 3) weg. Hetzelfde geldt voor de regels waar deze variabele gebruikt wordt, in mijn voorbeeld is dit om alleen poort 22 (SSH) open te zetten.
#!/bin/sh # My system IP/set ip address of server SERVER_IP=" 2001:db8::1337" # Flushing all rules ip6tables -F ip6tables -X # Setting default filter policy ip6tables -P INPUT DROP ip6tables -P OUTPUT DROP ip6tables -P FORWARD DROP # Allow unlimited traffic on loopback ip6tables -A INPUT -i lo -j ACCEPT ip6tables -A OUTPUT -o lo -j ACCEPT # Allow incoming ssh only ip6tables -A INPUT -p tcp -s 0/0 -d $SERVER_IP --sport 513:65535 --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT ip6tables -A OUTPUT -p tcp -s $SERVER_IP -d 0/0 --sport 22 --dport 513:65535 -m state --state ESTABLISHED -j ACCEPT #ICMP errors and unreachables. Split out into subtypes. # 4x subtypes of destination unreachable (type 1) ip6tables -A INPUT -p icmpv6 --icmpv6-type no-route -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type communication-prohibited -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type address-unreachable -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type port-unreachable -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT #Type 2, packet too big ip6tables -A INPUT -p icmpv6 --icmpv6-type packet-too-big -j ACCEPT # 2x subtype of time-exceeded (type 3) ip6tables -A INPUT -p icmpv6 --icmpv6-type ttl-zero-during-transit -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type ttl-zero-during-reassembly -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type time-exceeded -j ACCEPT # 3x subtype of parameter-problem (type 4) ip6tables -A INPUT -p icmpv6 --icmpv6-type bad-header -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type unknown-header-type -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type unknown-option -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type parameter-problem -j ACCEPT #Multicast listener query ip6tables -A INPUT -p icmpv6 --icmpv6-type 130 -j ACCEPT #Multicast listener report ip6tables -A INPUT -p icmpv6 --icmpv6-type 131 -j ACCEPT #Multicast listener done ip6tables -A INPUT -p icmpv6 --icmpv6-type 132 -j ACCEPT #MLDv2 Multicast Listener Report RFC3810 ip6tables -A INPUT -p icmpv6 --icmpv6-type 143 -j ACCEPT # 4x subtypes of destination unreachable (type 1) ip6tables -A OUTPUT -p icmpv6 --icmpv6-type no-route -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type communication-prohibited -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type address-unreachable -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type port-unreachable -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT # Type 2, packet to big ip6tables -A OUTPUT -p icmpv6 --icmpv6-type packet-too-big -j ACCEPT # 2x subtype of time-exceeded (type 3) ip6tables -A OUTPUT -p icmpv6 --icmpv6-type ttl-zero-during-transit -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type ttl-zero-during-reassembly -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type time-exceeded -j ACCEPT # 3x subtype of parameter-problem (type 4) ip6tables -A OUTPUT -p icmpv6 --icmpv6-type bad-header -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type unknown-header-type -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type unknown-option -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type parameter-problem -j ACCEPT #Multicast listener query ip6tables -A OUTPUT -p icmpv6 --icmpv6-type 130 -j ACCEPT #Multicast listener report ip6tables -A OUTPUT -p icmpv6 --icmpv6-type 131 -j ACCEPT #Multicast listener done ip6tables -A OUTPUT -p icmpv6 --icmpv6-type 132 -j ACCEPT #MLDv2 Multicast Listener Report RFC3810 ip6tables -A OUTPUT -p icmpv6 --icmpv6-type 143 -j ACCEPT # More and less necessary icmpv6 traffic # type 128 : echo request # type 129 : echo reply ip6tables -A OUTPUT -p icmpv6 --icmpv6-type echo-request -m state --state NEW,ESTABLISHED -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type echo-reply -m state --state ESTABLISHED -j ACCEPT # type 133 : router solicitation # type 134 : router advertisement. # Not needed in case of a static next hop address. ip6tables -A OUTPUT -p icmpv6 --icmpv6-type router-solicitation -j ACCEPT # 135 neighbour solicitation # 136 neighbour advertisement ip6tables -A OUTPUT -p icmpv6 --icmpv6-type neighbour-solicitation -j ACCEPT ip6tables -A OUTPUT -p icmpv6 --icmpv6-type neighbour-advertisement -j ACCEPT #Seen : Type 143: MLDv2 Multicast Listener Report. , RFC3810. #ip6tables -A OUTPUT -p icmpv6 --icmpv6-type 143 -j ACCEPT # DHCP : only checked on local segment. caveat in case of dhcp relay (reply). # DHCP v6 : anycast to ff02::1:2 udp port 547 # Reply from link-local server adres to link-local client . ip6tables -A OUTPUT -p udp -d ff02::1:2 --dport 547 -j ACCEPT ip6tables -A INPUT -p udp -s fe80::/10 --sport 547 -j ACCEPT # ping ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-reply -m state --state ESTABLISHED -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-request -m state --state NEW -j ACCEPT # type 133 router solicitation # type 134 router advertisement # type 135 neighbour solicitation # type 136 neighbour advertisement # ip6tables -A INPUT -p icmpv6 --icmpv6-type router-advertisement -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbour-solicitation -j ACCEPT ip6tables -A INPUT -p icmpv6 --icmpv6-type neighbour-advertisement -j ACCEPT # make sure nothing comes or goes out of this box ip6tables -A INPUT -j LOG ip6tables -A INPUT -j DROP ip6tables -A OUTPUT -j LOG ip6tables -A OUTPUT -j DROP
[…] mijn weblog een artikel over DA, IPv6 en CSF… https://weblog.aklmedia.nl/2010/03/he…-ipv6-is-fout/ __________________ Randy ten Have – Senior Linux systeembeheerder Als u denkt dat experts duur […]