iptables não carrega com o iptables-restore

1

Eu fiz o seguinte arquivo de regras iptables:

*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:sshguard - [0:0]

-A INPUT -i enp3s0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming SSH"
-A INPUT -i enp3s0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing SSH"
-A INPUT -i enp3s0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming HTTP"
-A INPUT -i enp3s0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming HTTPS"
-A INPUT -i enp3s0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing HTTP"
-A INPUT -i enp3s0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing HTTPS"
-A INPUT -i enp3s0 -p udp --sport 53 -j ACCEPT -m comment --comment "Allow outgoing DNS"

-A INPUT -i lo -j ACCEPT -m comment --comment "Allow ALL from localhost"

-A INPUT -p icmp --icmp-type echo-request -j ACCEPT -m comment --comment "Allow incoming ping"
-A INPUT -p icmp --icmp-type echo-reply -j ACCEPT -m comment --comment "Allow outgoing ping"
-A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT -m comment --comment "Prevent DoS attacks"
-A INPUT -p tcp --dport 443 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT -m comment --comment "Prevent DoS attacks"
-A INPUT -p tcp -m tcp --dport 22 -j sshguard -m comment --comment "SSH access protection"
COMMIT

Mas quando eu tento carregá-lo com iptables-restore < iptables.rules , eu tenho esse erro:

iptables-restore: line 22 failed

Eu fiz algo errado?

EDITAR:

  • minha versão linux é: linux44 4.4.48-1
  • minha versão do iptables é: iptables 1.6.0-1
  • uname: Linux ARCH 4.4.41-1-MANJARO # 1 SMP PREPARADO Seg 09 jan 12:43:09 UTC 2017 i686 GNU / Linux

EDIT 2: Após vários testes, parece que os módulos ipt_state.ko.gz e ipt_comment.ko.gz estão faltando no diretório /lib/modules/4.4.48-1-MANJARO/kernel/net/ipv4/netfilter

Alguém sabe como adicionar esses módulos?

    
por Dynamite 20.02.2017 / 11:56

1 resposta

2

Ok, então seguindo esse fórum: link , percebi que meu kernel foi atualizado recentemente a partir de -41 para -48, e a descoberta do módulo é baseada no uname (que estava desatualizado), é por isso que os módulos não puderam carregar. Uma simples reinicialização corrigiu todos os problemas: D

    
por 23.02.2017 / 11:28