Как настроить брандмауэр на простой Ubuntu |
|
30.12.10 13:24 |
Как настроить брандмауэр на простой Ubuntu?
Первый способ
Создадим файл /etc/init.d/start-firewall.sh
Содержание файла: tart-firewall.sh
#! /bin/sh
# Clear any existing firewall stuff before we start iptables --flush iptables -t nat --flush iptables -t mangle --flush # As the default policies, drop all incoming traffic but allow all # outgoing traffic. This will allow us to make outgoing connections # from any port, but will only allow incoming connections on the ports # specified below. iptables --policy INPUT DROP iptables --policy OUTPUT ACCEPT # Allow all incoming traffic if it is coming from the local loopback device iptables -A INPUT -i lo -j ACCEPT # Accept all incoming traffic associated with an established # connection, or a "related" connection iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow incoming connections # SSH iptables -A INPUT -p tcp -i eth0 --dport 22 -m state --state NEW -j ACCEPT # HTTP iptables -A INPUT -p tcp -i eth0 --dport 80 -m state --state NEW -j ACCEPT # HTTPS iptables -A INPUT -p tcp -i eth0 --dport 443 -m state --state NEW -j ACCEPT # Allow icmp input so that people can ping us iptables -A INPUT -p icmp -j ACCEPT # Reject all other incoming packets iptables -A INPUT -j REJECT
|
мы оставим открытыми порты: 22, 80, 443, icmp (ping)
Сделаем файл исполняемым и запустим
$ chmod + x /etc/init.d/start-firewall.sh $ sudo /etc/init.d/start-firewall.sh
Единственная проблема которая может возникнуть, это несоответствие интерфеса eth0 или eth1
Если всё работает, добавим скрипт в автозагрузку
$ sudo update-rc.d start-firewall.sh defaults
Второй способ
sudo apt-get install firestarter Затем найдите в меню Система-> Администрирование -> firestarter
Всё. {jcomments on}
|
Последнее обновление 30.12.10 13:47 |