We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
* SELinux and Iptables will be disabled
-
- Posts: 28
- Joined: Sat Aug 03, 2013 8:49 am
* SELinux and Iptables will be disabled
Iptables отключается во время установки и потом не включается, верно?
Устанавливается какой-то другой файервол или нужно снова вручную включать Iptables после установки?
спасибо.
Устанавливается какой-то другой файервол или нужно снова вручную включать Iptables после установки?
спасибо.
Re: * SELinux and Iptables will be disabled
Фаервол необходимо включить вручную. В будущем мы хотим сделать интегракию с фаерволом csf
-
- Posts: 28
- Joined: Sat Aug 03, 2013 8:49 am
Re: * SELinux and Iptables will be disabled
ок, ясно.
добавил:
iptables -A INPUT -p tcp --dport 8083 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
но доступа нет (
что еще забыл разрешить для работы панели?
добавил:
iptables -A INPUT -p tcp --dport 8083 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
но доступа нет (
что еще забыл разрешить для работы панели?
-
- Posts: 28
- Joined: Sat Aug 03, 2013 8:49 am
Re: * SELinux and Iptables will be disabled
какие порты необходимы для работы панели?
-
- Posts: 28
- Joined: Sat Aug 03, 2013 8:49 am
Re: * SELinux and Iptables will be disabled
вот так у меня включается фаервол:
Code: Select all
#!/bin/bash
### Скрипт конфигурации IPTables ###
# Очищаем предыдущие записи
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Установка политик по умолчанию
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Разрешаем локальный интерфейс
iptables -A INPUT -i lo -j ACCEPT
# Простая защита от DoS-атаки
iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
# Защита от спуфинга
iptables -I INPUT -m conntrack --ctstate NEW,INVALID -p tcp --tcp-flags SYN,ACK SYN,ACK -j REJECT --reject-with tcp-reset
# Защита от попытки открыть входящее соединение TCP не через SYN
iptables -I INPUT -m conntrack --ctstate NEW -p tcp ! --syn -j DROP
# Закрываемся от кривого icmp
iptables -I INPUT -p icmp -f -j DROP
# REL, ESTB allow
iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
# Начнем с базовых вещей. Разрешим передачу трафика уже открытым соединениям:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Разрешение главных типов протокола ICMP
iptables -A INPUT -p icmp --icmp-type 3 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 11 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 12 -j ACCEPT
# Защита сервера SSH от брутфорса
iptables -A INPUT -p tcp --syn --dport 22 -m recent --name dmitro --set
iptables -A INPUT -p tcp --syn --dport 22 -m recent --name dmitro --update --seconds 30 --hitcount 3 -j DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Для работы OpenVPN #
/sbin/modprobe ip_tables
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
sysctl -p
iptables -I FORWARD 1 -i tap0 -p udp -j ACCEPT
iptables -I FORWARD 1 -i tap0 -p tcp -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.231.0/24 -o eth0 -j SNAT --to-source 111.111.231.242
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
#
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
# Просмотр
iptables -L --line-number
echo
echo "Adding DONE, maybe OK"
echo "Saving to rc, PSE wait!"
service iptables save
echo
service iptables restart
echo "Done"
service iptables restart
service network restart
service openvpn restart
iptables -A INPUT -p tcp --dport 8083 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
Re: * SELinux and Iptables will be disabled
Скажите пожалуйста, этот вариант сейчас рабочий? Его можно использовать?
Last edited by nabbe on Fri Aug 30, 2013 2:37 pm, edited 1 time in total.
Re: * SELinux and Iptables will be disabled
Оставлю для потомков, ну и для себя =)
1. идем в настройки iptables и включаем запуск и сохрание настроек после ребута, иначе все что мы сделаем будет слетать.
Там меняем no на yes следующее:
Сохраняем и закрываем.
2. Создаем новый баш скрипт
3. В него копируем следующее
OpenVPN я убрал, и добавил несколько портов для почты, фтп, ssh и т.д.
Сохраняем и закрываем.
4. Запускаем скрипт на выполнение
Скрипт выполнится и завершит работу.
5. Смотрим что получилось.
1. идем в настройки iptables и включаем запуск и сохрание настроек после ребута, иначе все что мы сделаем будет слетать.
Code: Select all
sudo nano /etc/sysconfig/iptables-config
Code: Select all
IPTABLES_MODULES_UNLOAD="yes"
IPTABLES_SAVE_ON_STOP="yes"
IPTABLES_SAVE_ON_RESTART="yes"
IPTABLES_SAVE_COUNTER="yes"
2. Создаем новый баш скрипт
Code: Select all
sudo nano iptables.sh
Code: Select all
#!/bin/bash
### Скрипт конфигурации IPTables ###
# Очищаем предыдущие записи
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Установка политик по умолчанию
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Разрешаем локальный интерфейс
iptables -A INPUT -i lo -j ACCEPT
# Простая защита от DoS-атаки
iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
# Защита от спуфинга
iptables -I INPUT -m conntrack --ctstate NEW,INVALID -p tcp --tcp-flags SYN,ACK SYN,ACK -j REJECT --reject-with tcp-reset
# Защита от попытки открыть входящее соединение TCP не через SYN
iptables -I INPUT -m conntrack --ctstate NEW -p tcp ! --syn -j DROP
# Закрываемся от кривого icmp
iptables -I INPUT -p icmp -f -j DROP
# REL, ESTB allow
iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
# Начнем с базовых вещей. Разрешим передачу трафика уже открытым соединениям:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Разрешение главных типов протокола ICMP
iptables -A INPUT -p icmp --icmp-type 3 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 11 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 12 -j ACCEPT
# Защита сервера SSH от брутфорса
iptables -A INPUT -p tcp --syn --dport 22 -m recent --name dmitro --set
iptables -A INPUT -p tcp --syn --dport 22 -m recent --name dmitro --update --seconds 30 --hitcount 3 -j DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Просмотр
iptables -L --line-number
echo
echo "Adding DONE, maybe OK"
echo "Saving to rc, PSE wait!"
service iptables save
echo
service iptables restart
echo "Done"
service iptables restart
service network restart
iptables -A INPUT -p tcp --dport 8083 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 465 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
Сохраняем и закрываем.
4. Запускаем скрипт на выполнение
Code: Select all
bash iptables.sh
5. Смотрим что получилось.
Code: Select all
iptables -L -n
Re: * SELinux and Iptables will be disabled
Я немного не понял:
-------------------------------------------------------------------
[root@main ~]# 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
[root@jetlive ~]# ^C
--------------------------------------------------------------------
Это корректный ответ?
Сайт и панель работает.
Запустил с баш скрипта, выдает вот такой ужастик:
-------------------------------------------------------------------
[root@main ~]# iptables --list
Chain INPUT (policy DROP)
target prot opt source destination
DROP icmp -f anywhere anywhere
DROP tcp -- anywhere anywhere ctstate NEW tcp fla gs:!FIN,SYN,RST,ACK/SYN
REJECT tcp -- anywhere anywhere ctstate INVALID,NEW tcp flags:SYN,ACK/SYN,ACK reject-with tcp-reset
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp flags:FIN,SYN,R ST,ACK/RST limit: avg 1/sec burst 5
ACCEPT tcp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT udp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT icmp -- anywhere anywhere icmp destination-un reachable
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-prob lem
tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: SET name: dmitro side: source
DROP tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: UPDATE seconds: 30 hit_count: 3 name: dmitro side: so urce
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:us-srv
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:urd
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3s
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT tcp -- anywhere anywhere tcp dpt:imaps
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
-------------------------------------------------------------------
[root@main ~]# 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
[root@jetlive ~]# ^C
--------------------------------------------------------------------
Это корректный ответ?
Сайт и панель работает.
Запустил с баш скрипта, выдает вот такой ужастик:
-------------------------------------------------------------------
[root@main ~]# iptables --list
Chain INPUT (policy DROP)
target prot opt source destination
DROP icmp -f anywhere anywhere
DROP tcp -- anywhere anywhere ctstate NEW tcp fla gs:!FIN,SYN,RST,ACK/SYN
REJECT tcp -- anywhere anywhere ctstate INVALID,NEW tcp flags:SYN,ACK/SYN,ACK reject-with tcp-reset
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp flags:FIN,SYN,R ST,ACK/RST limit: avg 1/sec burst 5
ACCEPT tcp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT udp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT icmp -- anywhere anywhere icmp destination-un reachable
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-prob lem
tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: SET name: dmitro side: source
DROP tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: UPDATE seconds: 30 hit_count: 3 name: dmitro side: so urce
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:us-srv
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:urd
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3s
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT tcp -- anywhere anywhere tcp dpt:imaps
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Re: * SELinux and Iptables will be disabled
Всю русскую кириллицу попробуйте убрать из скрипта, вообще всюmargent wrote:Я немного не понял:
-------------------------------------------------------------------
[root@main ~]# 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
[root@jetlive ~]# ^C
--------------------------------------------------------------------
Это корректный ответ?
Сайт и панель работает.
Запустил с баш скрипта, выдает вот такой ужастик:
-------------------------------------------------------------------
[root@main ~]# iptables --list
Chain INPUT (policy DROP)
target prot opt source destination
DROP icmp -f anywhere anywhere
DROP tcp -- anywhere anywhere ctstate NEW tcp fla gs:!FIN,SYN,RST,ACK/SYN
REJECT tcp -- anywhere anywhere ctstate INVALID,NEW tcp flags:SYN,ACK/SYN,ACK reject-with tcp-reset
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp flags:FIN,SYN,R ST,ACK/RST limit: avg 1/sec burst 5
ACCEPT tcp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT udp -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTAB LISHED
ACCEPT icmp -- anywhere anywhere icmp destination-un reachable
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-prob lem
tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: SET name: dmitro side: source
DROP tcp -- anywhere anywhere tcp dpt:ssh flags:F IN,SYN,RST,ACK/SYN recent: UPDATE seconds: 30 hit_count: 3 name: dmitro side: so urce
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:us-srv
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:urd
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3s
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT tcp -- anywhere anywhere tcp dpt:imaps
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Re: * SELinux and Iptables will be disabled
Зачем столько букв?
и вставить
По вебсерверу произвел некоторые настройки, не касающиеся производительности. Выключен почтовый сервер. Что работает: веб, фтп и ssh, ssl
Да и fail2ban настроить тоже можно, если нужно могу привести настройки, будет время отправлю коммиты в репозиторий. У меня fail2ban настроен и работает корректно, результат: в блокировке постоянно китайские айпи.
Code: Select all
nano /etc/sysconfig/iptables
Code: Select all
# Generated by iptables-save v1.4.7 on Fri Jun 7 14:37:21 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8083 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Fri Jun 7 14:37:21 2013
Code: Select all
service iptables restart
Да и fail2ban настроить тоже можно, если нужно могу привести настройки, будет время отправлю коммиты в репозиторий. У меня fail2ban настроен и работает корректно, результат: в блокировке постоянно китайские айпи.