ufw deny não funciona, mas o iptables está funcionando

0

Eu quero usar o ufw e o fail2ban para bloquear o portscan. Depois de configurá-los, o fail2ban mostrou que alguns IPs foram bloqueados, mas na verdade não. Eu localizei problema para o ufw, porque o fail2ban proíbe o ip que quer quebrar o ssh.

Meus testes

resultado ifconfig: (talvez seja útil? Eu oculto o endereço IP real)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:15111490 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15111490 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1089923226 (1.0 GB)  TX bytes:1089923226 (1.0 GB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: xxxxxxxxxxxxx/128 Scope:Global
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:325172 errors:0 dropped:0 overruns:0 frame:0
          TX packets:720857 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:114732548 (114.7 MB)  TX bytes:196756412 (196.7 MB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:xxxxxxxxxx  P-t-P:xxxxxxxxxx  Bcast:xxxxxxxxxx  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

porta de bloco 8923

ufw deny 8923
ufw deny out 8923

Executar ufw status verbose :

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
8923                       DENY IN     Anywhere
8923 (v6)                  DENY IN     Anywhere (v6)

8923                       DENY OUT    Anywhere
8923 (v6)                  DENY OUT    Anywhere (v6)

Executar iptables -L :

Chain INPUT (policy DROP)
target     prot opt source               destination
f2b-sshd   tcp  --  anywhere             anywhere             multiport dports 29240
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:29240
ufw-before-logging-input  all  --  anywhere             anywhere
ufw-before-input  all  --  anywhere             anywhere
ufw-after-input  all  --  anywhere             anywhere
ufw-after-logging-input  all  --  anywhere             anywhere
ufw-reject-input  all  --  anywhere             anywhere
ufw-track-input  all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
ufw-before-logging-forward  all  --  anywhere             anywhere
ufw-before-forward  all  --  anywhere             anywhere
ufw-after-forward  all  --  anywhere             anywhere
ufw-after-logging-forward  all  --  anywhere             anywhere
ufw-reject-forward  all  --  anywhere             anywhere
ufw-track-forward  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:29240
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:29240
ufw-before-logging-output  all  --  anywhere             anywhere
ufw-before-output  all  --  anywhere             anywhere
ufw-after-output  all  --  anywhere             anywhere
ufw-after-logging-output  all  --  anywhere             anywhere
ufw-reject-output  all  --  anywhere             anywhere
ufw-track-output  all  --  anywhere             anywhere

....

Chain ufw-user-input (1 references)
target     prot opt source               destination
DROP       tcp  --  anywhere             anywhere             tcp dpt:8923
DROP       udp  --  anywhere             anywhere             udp dpt:8923

Chain ufw-user-output (1 references)
target     prot opt source               destination
DROP       tcp  --  anywhere             anywhere             tcp dpt:8923
DROP       udp  --  anywhere             anywhere             udp dpt:8923

Eu gerencio um site no 8923, mas curl myhost:8923 ainda pode obter o index.html .

Meu vps é o openvz ubuntu 14.04, o host redhat é o kernel 2.6 e eu recebo este artigo link

Ele diz que o 2.6 openvz pode ter algum problema (mas minha máquina não recebe uma mensagem de aviso por /lib/ufw/ufw-init force-reload ). Embora eu tenha tentado essa configuração, nem trabalho.

    
por Mithril 27.07.2017 / 03:51

1 resposta

0

Primeiro, você deve saber que o openvz é mal suportado no Ubuntu. O Ubuntu usa o LXC (para melhor ou pior). Se você quiser usar o openvz, eu recomendo strongmente que você use um sistema .rpm já que o patch do kernel é escrito para um kernel do RHEL / Fedora e pode ou não ter problemas em kernels do Debian em Debian.

Até certo ponto, o openvz é depreciado em hosts Debian / Ubuntu.

Segundo, como você sabe que o iptables está funcionando?

Terceiro, se o iptables funcionar, eu usaria o iptables em vez do UFW.

Se você precisar de ajuda com o UFW / iptables, precisará postar todas as suas regras e qualquer informação adicional que você possa me dar depois de ler as páginas do meu blog.

Veja link

link

Qual sistema operacional host? Você tem acesso root no host?

Qual kernel você está executando? Que patch openvz - link

    
por Panther 27.07.2017 / 04:02