fedora 26 Deaktivieren Sie die Verwendung von Firewall für iptables

438
dobbs

Die Firewall-Zonen und -Regeln usw. sind ein komplizierter Schmerz im Vergleich zu normalen alten iptables. Mein Hauptziel ist es, dass meine iptables-Regeln beim Start ausgeführt werden und nicht alle mit firewalld-config neu erstellt werden müssen.

Ich habe das folgende Shell-Skript:

[root@hypersquij ~]# cat fw.sh  #!/bin/bash  /usr/sbin/iptables -P INPUT ACCEPT /usr/sbin/iptables -P FORWARD ACCEPT /usr/sbin/iptables -P OUTPUT ACCEPT /usr/sbin/iptables -t nat -F /usr/sbin/iptables -t mangle -F /usr/sbin/iptables -F /usr/sbin/iptables -X  # Set default chain policies /usr/sbin/iptables -P INPUT DROP /usr/sbin/iptables -P FORWARD DROP /usr/sbin/iptables -P OUTPUT ACCEPT  # Accept on localhost /usr/sbin/iptables -A INPUT -i lo -j ACCEPT /usr/sbin/iptables -A OUTPUT -o lo -j ACCEPT  # Allow established sessions to receive traffic /usr/sbin/iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT  # Allow ssh /usr/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT  # various protocols  /usr/sbin/iptables -A INPUT -p icmp -j ACCEPT /usr/sbin/iptables -A INPUT -p ah -j ACCEPT /usr/sbin/iptables -A INPUT -p esp -j ACCEPT 

Und die folgende /etc/rc.d/rc.local

[root@hypersquij ~]# cat /etc/rc.d/rc.local  #!/bin/bash  /bin/bash /root/fw.sh  exit 0 

Dauerwellen:

[root@hypersquij ~]# ls -l /etc/rc.d/rc.local  -rwxr-xr-x. 1 root root 43 Oct 16 09:49 /etc/rc.d/rc.local [root@hypersquij ~]# ls -l fw.sh  -rwxr--r--. 1 root root 829 Oct 16 09:46 fw.sh 

Ich lief systemctl disable firewalld.

Erscheint dieses Shell-Skript nicht beim Start.

Aktueller Stand von rc-local.service

[root@hypersquij ~]# systemctl status rc-local.service ● rc-local.service - /etc/rc.d/rc.local Compatibility Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: disabled) Active: active (exited) since Tue 2018-10-16 09:46:56 MDT; 9min ago Process: 1200 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 4915) CGroup: /system.slice/rc-local.service  Oct 16 09:46:56 hypersquij systemd[1]: Starting /etc/rc.d/rc.local Compatibility... Oct 16 09:46:56 hypersquij systemd[1]: Started /etc/rc.d/rc.local Compatibility. 

Kann jemand helfen? Alles, was ich will, ist, dass dieses blöde fw.shSkript beim Start mit Fedora ausgeführt wird und die Komplexität von Firewall-Drohnen zunichte macht.

0
Woher wissen Sie, dass das Skript beim Start nicht ausgeführt wird? Ist `/ usr / sbin / iptables` der richtige Weg? (Wie wäre es mit `/ sbin / iptables`?) Kamil Maciorowski vor 5 Jahren 0

0 Antworten auf die Frage