Параноидальный iptables

K
На сайте с 12.07.2006
Offline
295
Kpd
6902

Настраиваю новый сервер, CentOS 7, DirectAdmin

Столкнулся с такой проблемой - из внешнего мира доступен только ssh и Directadmin. Как я понял, проблема в параноидальных правилах iptables

iptables -L -v -n


Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
693M 498G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
40 2460 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
29569 2250K INPUT_direct all -- * * 0.0.0.0/0 0.0.0.0/0
29569 2250K INPUT_ZONES_SOURCE all -- * * 0.0.0.0/0 0.0.0.0/0
29569 2250K INPUT_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0
16412 1374K ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
3789 324K 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 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 85M packets, 515G bytes)
pkts bytes target prot opt in out source destination
194M 1257G 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 -- enp1s0f1 * 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 FWDI_public all -- enp1s0f0 * 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 -- * enp1s0f1 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 FWDO_public all -- * enp1s0f0 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 (3 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

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 (3 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
16 960 IN_public all -- enp1s0f1 * 0.0.0.0/0 0.0.0.0/0 [goto]
29549 2249K IN_public all -- enp1s0f0 * 0.0.0.0/0 0.0.0.0/0 [goto]
2 64 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 (3 references)
pkts bytes target prot opt in out source destination
29569 2250K IN_public_log all -- * * 0.0.0.0/0 0.0.0.0/0
29569 2250K IN_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0
29569 2250K IN_public_allow all -- * * 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
7849 462K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW
1519 89968 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:2222 ctstate NEW

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

Почему-то открыты только 22 и 2222 порт.

Классический вопрос - кто виноват и что делать?

Это какие-то базовые настройки DirectAdmin? Или он вообще не при делах?

Я нагуглил, что есть плагин ConfigServer Security & FireWall, но он вроде бы не установлен (я его нигде не могу найти).

---------- Добавлено 31.03.2016 в 16:16 ----------

И ещё вдогонку. Как остановить iptables?

# service iptables stop

Redirecting to /bin/systemctl stop iptables.service

Failed to stop iptables.service: Unit iptables.service failed to load: No such file or directory.

В /etc/init.d нет iptables

N
На сайте с 06.05.2007
Offline
419
#1
Kpd:
Я нагуглил, что есть плагин ConfigServer Security & FireWall, но он вроде бы не установлен (я его нигде не могу найти).

это firewalld

Кнопка вызова админа ()
K
На сайте с 12.07.2006
Offline
295
Kpd
#2
netwind:
это firewalld

Спасибо.

От использования этого файрвола есть практический смысл? Я не понял, в какой реальной ситуации он может помочь.

---------- Добавлено 31.03.2016 в 18:06 ----------

Почитал мануал. Я правильно понял. что мне надо через

firewall-cmd --permanent --add-port=

добавить все порты, которые мне нужно открыть и всё?

Есть ещё нюансы?

---------- Добавлено 31.03.2016 в 18:23 ----------

Получился такой конфиг

#named

firewall-cmd --permanent --add-port=953/tcp

# exim

firewall-cmd --permanent --add-port=587/tcp

firewall-cmd --permanent --add-port=465/tcp

firewall-cmd --permanent --add-port=25/tcp

# dovecot

firewall-cmd --permanent --add-port=110/tcp

firewall-cmd --permanent --add-port=143/tcp

firewall-cmd --permanent --add-port=993/tcp

firewall-cmd --permanent --add-port=995/tcp

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

firewall-cmd --permanent --add-service=ftp

firewall-cmd --permanent --add-service=dns

firewall-cmd --reload

Andreyka
На сайте с 19.02.2005
Offline
822
#3

Лично я удаялю firewalld, ставлю iptables и csf

Не стоит плодить сущности без необходимости
K
На сайте с 12.07.2006
Offline
295
Kpd
#4

Что-то не складывается с firewalld

Настроил так

# firewall-cmd --list-all

public (default, active)
interfaces: enp1s0f0 enp1s0f0:0 enp1s0f0:1 enp1s0f0:2 enp1s0f1
sources:
services: dhcpv6-client dns ftp http https ssh
ports: 110/tcp 465/tcp 2222/tcp 7833/tcp 25/tcp 587/tcp 143/tcp 953/tcp 995/tcp 993/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

Интерфейсы enp1s0f0:0 enp1s0f0:1 enp1s0f0:2 - это дополнительные ip-адреса (хз почему они в виде отдельных интерфейсов, добавлял через DirectAdmin). Эти дополнительные Ip-адреса пингуются, но все порты на них закрыты. Хотя в netstat они есть явно или так

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      1479/pure-ftpd (SER

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7137/sshd

Правила работают только для enp1s0f0 и enp1s0f1

Может быть дел ов названии интерфейса?

---------- Добавлено 01.04.2016 в 09:29 ----------

Или я неправильно настроил сеть?

Отключил firewalld


# service firewalld stop

# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Но всё равно все порты закрыты. Но пингуются. Не понимаю.

---------- Добавлено 01.04.2016 в 10:27 ----------

Техподдержка хостинга помогла. Хорошо, когда есть хорошая техподдержка.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий