Почему блокируется web-сервер?

Обычный BitrixVM с дефолтными настройками после перезагрузки блокирует web-сервер пока не сбросишь правила фильтрации. Собственно вот набор правил:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:bx_public - [0:0]
:bx_trusted - [0:0]
-A INPUT -j bx_trusted
-A INPUT -j bx_public
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A bx_public -p tcp -m state --state NEW -m tcp --dport 8070 -m comment --comment "BX: requests for pool update" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 80 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 443 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 8890 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 8891 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 8893 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 8894 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 5222 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_public -p tcp -m state --state NEW -m tcp --dport 5223 -m comment --comment "BX: web ports" -j ACCEPT
-A bx_trusted -s 0.0.0.0/32 -p tcp -m tcp -m comment --comment "BX: servername" -j ACCEPT
-A bx_trusted -s 0.0.0.0/32 -p udp -m udp -m comment --comment "BX: servername" -j ACCEPT
COMMIT

(очевидно что вместо 0.0.0.0 там реальный IP)

По идеи все входящие сначала перенаправляются в цепочку bx_public где принимаются все соединения на 80 и 443 порты, но вэб сервер все равно не доступен пока таблицу не сбросишь. В чем проблем этого набора?

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 0.0.0.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::5652:ff:fef9:cf7b  prefixlen 64  scopeid 0x20<link>
        ether 54:52:00:f9:cf:7b  txqueuelen 1000  (Ethernet)
        RX packets 9951  bytes 1331371 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9343  bytes 1645698 (1.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8  bytes 1088 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 1088 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


# iptables -L -n -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 7146 1047K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    1   236 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
 2686  147K INPUT_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 2686  147K INPUT_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 2686  147K INPUT_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
   22  2116 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID
 2049  109K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 FORWARD_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FORWARD_IN_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FORWARD_IN_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FORWARD_OUT_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FORWARD_OUT_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 9133 packets, 1511K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    8  1088 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
 9204 1519K OUTPUT_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FORWARD_IN_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDI_public  all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           [goto] 
    0     0 FWDI_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain FORWARD_IN_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD_OUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDO_public  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           [goto] 
    0     0 FWDO_public  all  --  *      +       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDI_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FWDI_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FWDI_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FWDI_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDO_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FWDO_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 FWDO_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FWDO_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 2686  147K IN_public  all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           [goto] 
    0     0 IN_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           [goto] 

Chain INPUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain IN_public (2 references)
 pkts bytes target     prot opt in     out     source               destination         
 2686  147K IN_public_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 2686  147K IN_public_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 2686  147K IN_public_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
   56  1978 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain IN_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         
  559 33476 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW,UNTRACKED

Chain IN_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain IN_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination
  • Вопрос задан
  • 246 просмотров
Решения вопроса 1
hint000
@hint000
у админа три руки
Обычный BitrixVM с дефолтными настройками
Представьте, как будто я ничего не знаю об архитектуре Bitrix, зато неплохо разбираюсь в iptables. Можете описать чуть подробнее? Web-сервер находится на виртуальной машине? И эти правила iptables применяете на той же виртуальной машине? Сетевой интерфейс один, не считая lo? (вопрос связан с правилом, блокирующим весь FORWARD)
Применяете правила, делаете пробный заход на web-сервер, после этого выполняете команду, чтобы посмотреть счётчики байтов и пакетов на правилах:
iptables -L -n -v
Вам будут интересны только те правила, у которых счётчики (первые два столбца) ненулевые, значит трафик прошел через них. В них и нужно дальше искать проблему.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы