LINUX.ORG.RU
ФорумAdmin

iptables не применяет правила

 ,


0

1

Приветствую, коллеги. Интересует вопрос, почему iptables не применяет правила? В данном случае интересует блокировка ip-адреса 141.98.10.159

Chain INPUT (policy ACCEPT 1422 packets, 232K bytes)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
 3417  702K MAILCOW    all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                
   64  6038 f2b-postfix-sasl  tcp  --  *      *       0.0.0.0/0            0.0.0                                                                                                                                                             .0/0            multiport dports 22
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                         multiport dports 5222,5223,9071,7071,8443,7143,7993,7110,7995
    1    60 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                         multiport dports 25,110,143,465,587,993,995
    5   256 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                         multiport dports 80,443

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
24913   23M MAILCOW    all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                
25076   23M DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                              
25076   23M DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0                                                                                                                                                                         0.0.0.0/0
    0     0 ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0                                                                                                                                                                         ctstate RELATED,ESTABLISHED
    0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0                                                                                                                                                               
    0     0 ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0                                                                                                                                                             
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0                                                                                                                                                              
21417   20M ACCEPT     all  --  *      br-mailcow  0.0.0.0/0            0.0.0.0/                                                                                                                                                             0            ctstate RELATED,ESTABLISHED
 1757  107K DOCKER     all  --  *      br-mailcow  0.0.0.0/0            0.0.0.0/                                                                                                                                                             0
 1902 3515K ACCEPT     all  --  br-mailcow !br-mailcow  0.0.0.0/0            0.0                                                                                                                                                             .0.0/0
 1699  104K ACCEPT     all  --  br-mailcow br-mailcow  0.0.0.0/0            0.0.                                                                                                                                                             0.0/0

Chain OUTPUT (policy ACCEPT 683 packets, 48776 bytes)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
   43  2184 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.2           tcp dpt:443
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.2           tcp dpt:80
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.249         tcp dpt:6379
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.11          tcp dpt:8983
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.13          tcp dpt:3306
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.253         tcp dpt:587
   14   840 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.253         tcp dpt:465
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.253         tcp dpt:25
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:12345
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:4190
    1    52 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:995
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:993
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:143
    0     0 ACCEPT     tcp  --  !br-mailcow br-mailcow  0.0.0.0/0            172                                                                                                                                                             .22.1.250         tcp dpt:110

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
    0     0 DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0                                                                                                                                                                         0.0.0.0/0
 1902 3515K DOCKER-ISOLATION-STAGE-2  all  --  br-mailcow !br-mailcow  0.0.0.0/0                                                                                                                                                                         0.0.0.0/0
25076   23M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                

Chain DOCKER-ISOLATION-STAGE-2 (2 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
    0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0                                                                                                                                                               
    0     0 DROP       all  --  *      br-mailcow  0.0.0.0/0            0.0.0.0/                                                                                                                                                             0
 1902 3515K RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
25076   23M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0                                                                                                                                                                

Chain MAILCOW (2 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
   34  1980 REJECT     all  --  *      *       141.98.10.159        0.0.0.0/0                                                                                                                                                                         reject-with icmp-port-unreachable

Chain f2b-postfix-sasl (1 references)
 pkts bytes target     prot opt in     out     source               destination                                                                                                                                                              
    0     0 DROP       all  --  *      *       141.98.10.159        0.0.0.0/0                                                                                                                                                                
   64  6038 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

Правило попадает в iptables из fail2ban. Быть может на запрещающее правило есть антизапрещающее? Прошу помочь разобраться.



Последнее исправление: Max8885 (всего исправлений: 2)
Ответ на: комментарий от Kolins
# Generated by iptables-save v1.8.4 on Fri Mar 31 16:15:56 2023
*security
:INPUT ACCEPT [8381:1562353]
:FORWARD ACCEPT [55520:31287632]
:OUTPUT ACCEPT [4352:320204]
COMMIT
# Completed on Fri Mar 31 16:15:56 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 16:15:56 2023
*raw
:PREROUTING ACCEPT [80612:35616727]
:OUTPUT ACCEPT [4353:320516]
COMMIT
# Completed on Fri Mar 31 16:15:56 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 16:15:56 2023
*mangle
:PREROUTING ACCEPT [80613:35616771]
:INPUT ACCEPT [8381:1562353]
:FORWARD ACCEPT [55619:31293512]
:OUTPUT ACCEPT [4354:320796]
:POSTROUTING ACCEPT [59996:31627060]
COMMIT
# Completed on Fri Mar 31 16:15:56 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 16:15:56 2023
*nat
:PREROUTING ACCEPT [23813:3277824]
:INPUT ACCEPT [1869:174023]
:OUTPUT ACCEPT [267:24567]
:POSTROUTING ACCEPT [4516:285303]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.22.1.0/24 ! -o br-mailcow -j MASQUERADE
-A POSTROUTING -s 172.22.1.2/32 -d 172.22.1.2/32 -p tcp -m tcp --dport 443 -j MASQUERADE
-A POSTROUTING -s 172.22.1.2/32 -d 172.22.1.2/32 -p tcp -m tcp --dport 80 -j MASQUERADE
-A POSTROUTING -s 172.22.1.249/32 -d 172.22.1.249/32 -p tcp -m tcp --dport 6379 -j MASQUERADE
-A POSTROUTING -s 172.22.1.11/32 -d 172.22.1.11/32 -p tcp -m tcp --dport 8983 -j MASQUERADE
-A POSTROUTING -s 172.22.1.13/32 -d 172.22.1.13/32 -p tcp -m tcp --dport 3306 -j MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 587 -j MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 465 -j MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 25 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 12345 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 4190 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 995 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 993 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 143 -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 110 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN
-A DOCKER -i br-mailcow -j RETURN
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 443 -j DNAT --to-destination 172.22.1.2:443
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 80 -j DNAT --to-destination 172.22.1.2:80
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 7654 -j DNAT --to-destination 172.22.1.249:6379
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 18983 -j DNAT --to-destination 172.22.1.11:8983
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 13306 -j DNAT --to-destination 172.22.1.13:3306
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 587 -j DNAT --to-destination 172.22.1.253:587
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 465 -j DNAT --to-destination 172.22.1.253:465
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.22.1.253:25
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 19991 -j DNAT --to-destination 172.22.1.250:12345
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 4190 -j DNAT --to-destination 172.22.1.250:4190
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 995 -j DNAT --to-destination 172.22.1.250:995
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 993 -j DNAT --to-destination 172.22.1.250:993
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 143 -j DNAT --to-destination 172.22.1.250:143
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 110 -j DNAT --to-destination 172.22.1.250:110
COMMIT
# Completed on Fri Mar 31 16:15:56 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 16:15:56 2023
*filter
:INPUT ACCEPT [812:193700]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [564:40916]
:DOCKER - [0:0]
:DOCKER-ISOLATION-STAGE-1 - [0:0]
:DOCKER-ISOLATION-STAGE-2 - [0:0]
:DOCKER-USER - [0:0]
:MAILCOW - [0:0]
:f2b-postfix-sasl - [0:0]
-A INPUT -j MAILCOW
-A INPUT -p tcp -m multiport --dports 22 -j f2b-postfix-sasl
-A INPUT -p tcp -m multiport --dports 5222,5223,9071,7071,8443,7143,7993,7110,7995 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 25,110,143,465,587,993,995 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
-A FORWARD -j MAILCOW
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -o br-mailcow -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o br-mailcow -j DOCKER
-A FORWARD -i br-mailcow ! -o br-mailcow -j ACCEPT
-A FORWARD -i br-mailcow -o br-mailcow -j ACCEPT
-A DOCKER -d 172.22.1.2/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 443 -j ACCEPT
-A DOCKER -d 172.22.1.2/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 80 -j ACCEPT
-A DOCKER -d 172.22.1.249/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 6379 -j ACCEPT
-A DOCKER -d 172.22.1.11/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 8983 -j ACCEPT
-A DOCKER -d 172.22.1.13/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 3306 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 587 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 465 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 25 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 12345 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 4190 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 995 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 993 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 143 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 110 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -i br-mailcow ! -o br-mailcow -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -o br-mailcow -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN
-A f2b-postfix-sasl -s 141.98.10.159/32 -j DROP
-A f2b-postfix-sasl -j RETURN
COMMIT

Не отрабатывает на этой строке

-A f2b-postfix-sasl -s 141.98.10.159/32 -j DROP

Max8885
() автор топика
Ответ на: комментарий от Kolins

Разом поместить всю запись не позволяет, поэтому кидаю частями. Часть первая:

# Generated by iptables-save v1.8.4 on Fri Mar 31 22:50:15 2023
*security
:INPUT ACCEPT [8225:1663842]
:FORWARD ACCEPT [53417:11223660]
:OUTPUT ACCEPT [4861:348419]
COMMIT
# Completed on Fri Mar 31 22:50:15 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 22:50:15 2023
*raw
:PREROUTING ACCEPT [75204:14697335]
:OUTPUT ACCEPT [4862:348731]
COMMIT
# Completed on Fri Mar 31 22:50:15 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 22:50:15 2023
*mangle
:PREROUTING ACCEPT [75205:14697403]
:INPUT ACCEPT [8226:1663910]
:FORWARD ACCEPT [53523:11229928]
:OUTPUT ACCEPT [4863:348979]
:POSTROUTING ACCEPT [58406:11592254]
COMMIT
# Completed on Fri Mar 31 22:50:15 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 22:50:15 2023
*nat
:PREROUTING ACCEPT [21099:2347209]
:INPUT ACCEPT [1820:168141]
:OUTPUT ACCEPT [262:24561]
:POSTROUTING ACCEPT [4679:296827]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.22.1.0/24 ! -o br-mailcow -j MASQUERADE
-A POSTROUTING -s 172.22.1.249/32 -d 172.22.1.249/32 -p tcp -m tcp --dport 6379                                                                                                              -j MASQUERADE
-A POSTROUTING -s 172.22.1.10/32 -d 172.22.1.10/32 -p tcp -m tcp --dport 3306 -j                                                                                                              MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 587 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 465 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.253/32 -d 172.22.1.253/32 -p tcp -m tcp --dport 25 -j                                                                                                              MASQUERADE
-A POSTROUTING -s 172.22.1.13/32 -d 172.22.1.13/32 -p tcp -m tcp --dport 8983 -j                                                                                                              MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 12345                                                                                                              -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 4190                                                                                                              -j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 995 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 993 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 143 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.250/32 -d 172.22.1.250/32 -p tcp -m tcp --dport 110 -                                                                                                             j MASQUERADE
-A POSTROUTING -s 172.22.1.6/32 -d 172.22.1.6/32 -p tcp -m tcp --dport 443 -j MA                                                                                                             SQUERADE
-A POSTROUTING -s 172.22.1.6/32 -d 172.22.1.6/32 -p tcp -m tcp --dport 80 -j MAS                                                                                                             QUERADE
-A DOCKER -i docker0 -j RETURN
-A DOCKER -i br-mailcow -j RETURN
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 7654 -j DNAT --t                                                                                                             o-destination 172.22.1.249:6379
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 13306 -j DNAT --                                                                                                             to-destination 172.22.1.10:3306
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 587 -j DNAT --to-destination 172                                                                                                             .22.1.253:587
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 465 -j DNAT --to-destination 172                                                                                                             .22.1.253:465
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.                                                                                                             22.1.253:25
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 18983 -j DNAT --                                                                                                             to-destination 172.22.1.13:8983
-A DOCKER -d 127.0.0.1/32 ! -i br-mailcow -p tcp -m tcp --dport 19991 -j DNAT --                                                                                                             to-destination 172.22.1.250:12345
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 4190 -j DNAT --to-destination 17                                                                                                             2.22.1.250:4190
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 995 -j DNAT --to-destination 172                                                                                                             .22.1.250:995
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 993 -j DNAT --to-destination 172                                                                                                             .22.1.250:993
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 143 -j DNAT --to-destination 172                                                                                                             .22.1.250:143
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 110 -j DNAT --to-destination 172                                                                                                             .22.1.250:110
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 443 -j DNAT --to-destination 172                                                                                                             .22.1.6:443
-A DOCKER ! -i br-mailcow -p tcp -m tcp --dport 80 -j DNAT --to-destination 172.                                                                                                             22.1.6:80
COMMIT[/code[

Max8885
() автор топика
Ответ на: комментарий от Kolins

Часть вторая:

# Completed on Fri Mar 31 22:50:15 2023
# Generated by iptables-save v1.8.4 on Fri Mar 31 22:50:15 2023
*filter
:INPUT ACCEPT [148:17946]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [90:8920]
:DOCKER - [0:0]
:DOCKER-ISOLATION-STAGE-1 - [0:0]
:DOCKER-ISOLATION-STAGE-2 - [0:0]
:DOCKER-USER - [0:0]
:MAILCOW - [0:0]
-A INPUT -j MAILCOW
-A INPUT -p tcp -m multiport --dports 5222,5223,9071,7071,8443,7143,7993,7110,79                                                                                                             95 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 25,110,143,465,587,993,995 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
-A FORWARD -j MAILCOW
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -o br-mailcow -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o br-mailcow -j DOCKER
-A FORWARD -i br-mailcow ! -o br-mailcow -j ACCEPT
-A FORWARD -i br-mailcow -o br-mailcow -j ACCEPT
-A DOCKER -d 172.22.1.249/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              6379 -j ACCEPT
-A DOCKER -d 172.22.1.10/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              3306 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              587 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              465 -j ACCEPT
-A DOCKER -d 172.22.1.253/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              25 -j ACCEPT
-A DOCKER -d 172.22.1.13/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              8983 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              12345 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              4190 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              995 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              993 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              143 -j ACCEPT
-A DOCKER -d 172.22.1.250/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport                                                                                                              110 -j ACCEPT
-A DOCKER -d 172.22.1.6/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 4                                                                                                             43 -j ACCEPT
-A DOCKER -d 172.22.1.6/32 ! -i br-mailcow -o br-mailcow -p tcp -m tcp --dport 8                                                                                                             0 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -i br-mailcow ! -o br-mailcow -j DOCKER-ISOLATION-ST                                                                                                             AGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -o br-mailcow -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN
-A MAILCOW -s 141.98.10.159/32 -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Fri Mar 31 22:50:15 2023

Max8885
() автор топика
Ответ на: комментарий от mky

В логах постфикса активность с заблокированного в iptables ip-адреса [141.98.10.159] продолжается.

01.04.2023, 10:01:10	info	Anonymous TLS connection established from unknown[141.98.10.159]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
01.04.2023, 10:01:03	info	connect from unknown[141.98.10.159]
01.04.2023, 10:01:03	warning	warning: hostname srv-141-98-10-159.serveroffer.net does not resolve to address 141.98.10.159: Name or service not known
01.04.2023, 10:01:00	info	disconnect from unknown[141.98.10.159] ehlo=1 auth=0/1 rset=1 commands=2/3
01.04.2023, 10:01:00	info	lost connection after AUTH from unknown[141.98.10.159]
01.04.2023, 10:00:56	warning	warning: unknown[141.98.10.159]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
01.04.2023, 10:00:35	info	Anonymous TLS connection established from unknown[141.98.10.159]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
01.04.2023, 10:00:27	info	connect from unknown[141.98.10.159]
01.04.2023, 10:00:27	warning	warning: hostname srv-141-98-10-159.serveroffer.net does not resolve to address 141.98.10.159: Name or service not known
01.04.2023, 10:00:27	info	disconnect from unknown[141.98.10.159] ehlo=1 auth=0/1 rset=1 commands=2/3
01.04.2023, 10:00:27	info	lost connection after AUTH from unknown[141.98.10.159]
01.04.2023, 10:00:23	warning	warning: unknown[141.98.10.159]: SASL LOGIN authentication failed: UGFzc3dvcmQ6

Max8885
() автор топика
Ответ на: комментарий от Max8885

Ну добавьте руками -j DROP для этого ip-адреса в -t raw PREROUTING и посмотрите. Так у этого postfix-mailcow должен быть лог, какие правила он добавляет/удаляет.

И вы, случаем, это безумный workaround не использовали (с iptables-save по крону): https://github.com/mailcow/mailcow-dockerized/issues/4658#issuecomment-118149...

mky ★★★★★
()
Последнее исправление: mky (всего исправлений: 1)