Guten Tag,
ich habe einen Debian 9 Server mit Webserver Apache2. Der Server hat eine routbare Adresse, jedoch schaffe ich es nicht die richtige INPUT-Regel in iptables einzubauen. Meines Erachtens sollte diese Regel funktionieren:
iptables -A INPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
Tut Sie aber nicht... Was kann ich tun?
Hier meine iptables Rules:
#iptables -L | more
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
INPUT_direct all -- anywhere anywhere
INPUT_ZONES_SOURCE all -- anywhere anywhere
INPUT_ZONES all -- anywhere anywhere
DROP all -- anywhere anywhere ctstate INVALID
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
ACCEPT tcp -- anywhere anywhere multiport dports http,https ctstate NEW,ESTABLISHED
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
FORWARD_direct all -- anywhere anywhere
FORWARD_IN_ZONES_SOURCE all -- anywhere anywhere
FORWARD_IN_ZONES all -- anywhere anywhere
FORWARD_OUT_ZONES_SOURCE all -- anywhere anywhere
FORWARD_OUT_ZONES all -- anywhere anywhere
DROP all -- anywhere anywhere ctstate INVALID
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
OUTPUT_direct all -- anywhere anywhere
Chain FORWARD_IN_ZONES (1 references)
target prot opt source destination
FWDI_block all -- anywhere anywhere
FWDI_block all -- anywhere anywhere
Chain FORWARD_IN_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_OUT_ZONES (1 references)
target prot opt source destination
FWDO_block all -- anywhere anywhere
FWDO_block all -- anywhere anywhere
Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_direct (1 references)
target prot opt source destination
Chain FWDI_block (2 references)
target prot opt source destination
FWDI_block_log all -- anywhere anywhere
FWDI_block_deny all -- anywhere anywhere
FWDI_block_allow all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FWDI_block_allow (1 references)
target prot opt source destination
Chain FWDI_block_deny (1 references)
target prot opt source destination
Chain FWDI_block_log (1 references)
target prot opt source destination
Chain FWDO_block (2 references)
target prot opt source destination
FWDO_block_log all -- anywhere anywhere
FWDO_block_deny all -- anywhere anywhere
FWDO_block_allow all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FWDO_block_allow (1 references)
target prot opt source destination
Chain FWDO_block_deny (1 references)
target prot opt source destination
Chain FWDO_block_log (1 references)
target prot opt source destination
Chain INPUT_ZONES (1 references)
target prot opt source destination
IN_block all -- anywhere anywhere
IN_block all -- anywhere anywhere
Chain INPUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain INPUT_direct (1 references)
target prot opt source destination
Chain IN_block (2 references)
target prot opt source destination
IN_block_log all -- anywhere anywhere
IN_block_deny all -- anywhere anywhere
IN_block_allow all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain IN_block_allow (1 references)
target prot opt source destination
ACCEPT tcp -- x.x.0.0/16 anywhere tcp dpt:ssh ctstate NEW
Chain IN_block_deny (1 references)
target prot opt source destination
Chain IN_block_log (1 references)
target prot opt source destination
Chain OUTPUT_direct (1 references)
target prot opt source destination
Debian9 Apache2 - iptables INPUT Problem
Re: Debian9 Apache2 - iptables INPUT Problem
Evtl. hast Du die Regel nicht an der richtigen Stelle bzw. nicht in der richtigen/geeigneten Reihenfolge.linuxxxxx hat geschrieben:04.05.2019 18:46:31..., jedoch schaffe ich es nicht die richtige INPUT-Regel in iptables einzubauen. Meines Erachtens sollte diese Regel funktionieren:
iptables -A INPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
Tut Sie aber nicht... Was kann ich tun?
Hier meine iptables Rules:Code: Alles auswählen
#iptables -L | more Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED ACCEPT all -- anywhere anywhere INPUT_direct all -- anywhere anywhere INPUT_ZONES_SOURCE all -- anywhere anywhere INPUT_ZONES all -- anywhere anywhere DROP all -- anywhere anywhere ctstate INVALID REJECT all -- anywhere anywhere reject-with icmp-host-prohibited ACCEPT tcp -- anywhere anywhere multiport dports http,https ctstate NEW,ESTABLISHED
BTW: Von wo hast Du diese ganzen iptables-Regeln?
Debian 12.9 mit LXDE, OpenBSD 7.6 mit i3wm, FreeBSD 14.1 mit Xfce
Re: Debian9 Apache2 - iptables INPUT Problem
Regeln werden "von oben nach unten" angewandt: wenn etwas zuvor bereits mit REJECT oder DROP behandelt wurde, hilft auch kein nachträgliches ACCEPT mehr.
-A fügt unten an (append)
-I am Anfang oder mit Angabe des Zielorts zwischendrin (insert)
-A fügt unten an (append)
-I am Anfang oder mit Angabe des Zielorts zwischendrin (insert)
Re: Debian9 Apache2 - iptables INPUT Problem
Der TE hat:eggy hat geschrieben:04.05.2019 19:55:34... wenn etwas zuvor bereits mit REJECT oder DROP behandelt wurde, hilft auch kein nachträgliches ACCEPT mehr.
Code: Alles auswählen
ACCEPT all -- anywhere anywhere
Code: Alles auswählen
ACCEPT tcp -- anywhere anywhere multiport dports http,https ctstate NEW,ESTABLISHED
Debian 12.9 mit LXDE, OpenBSD 7.6 mit i3wm, FreeBSD 14.1 mit Xfce
Re: Debian9 Apache2 - iptables INPUT Problem
Ja, aber wie Du schon zuvor richtig bemerkt hattest, sind die Regeln an sich "komisch". Fängt ja schon viel eher an
Ich hab den Eindruck, dass linuxxxxx die von mir genannten Informationen noch zum Verständnis Deines Kommentars gefehlt haben könnten, daher "kontextfrei".
Code: Alles auswählen
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
Re: Debian9 Apache2 - iptables INPUT Problem
Für den state ESTABLISHED ja, aber für den state NEW nicht.eggy hat geschrieben:04.05.2019 20:16:09Fängt ja schon viel eher anCode: Alles auswählen
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED ACCEPT all -- anywhere anywhere
Debian 12.9 mit LXDE, OpenBSD 7.6 mit i3wm, FreeBSD 14.1 mit Xfce
Re: Debian9 Apache2 - iptables INPUT Problem
die obere ist überflüssig