User Tools

Site Tools


сервис_firewall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
сервис_firewall [2021/05/21 19:17]
val [FreeBSD (pf)]
сервис_firewall [2024/05/05 19:07] (current)
val [Debian/Ubuntu (iptables)]
Line 5: Line 5:
  
 ===== Конфигурация для рабочей станции ===== ===== Конфигурация для рабочей станции =====
 +
 +==== nftables ====
 +
 +  * [[https://​habr.com/​ru/​companies/​ruvds/​articles/​580648/​|Переход с iptables на nftables. Краткий справочник]]
 +  * [[https://​cryptoworld.su/​kak-perejti-s-iptables-na-nftables-polnaya-istrukciya/​|Как перейти с iptables на Nftables — полная инструкция]]
  
 ==== Linux (iptables) ==== ==== Linux (iptables) ====
  
-  ​* [[https://​help.ubuntu.com/​community/​IptablesHowTo]] + 
-  * [[http://​ru.wikibooks.org/​wiki/​Iptables]] +  ​* [[https://​help.ubuntu.com/​community/​IptablesHowTo|ubuntu.com community ​IptablesHowTo]] 
-  * [[https://​ru.wikipedia.org/​wiki/​Netfilter]]+  * [[https://​ru.wikibooks.org/​wiki/​Iptables|Материал из Викиучебника iptables — утилита командной строки]] 
 +  * [[https://​ru.wikipedia.org/​wiki/​Netfilter|Материал из Википедии netfilter — межсетевой экран]]
  
 === Настройка фильтра === === Настройка фильтра ===
Line 44: Line 50:
 </​code>​ </​code>​
  
-=== Сохранение состояния iptables ​===+=== Управление состоянием iptables === 
 + 
 +== Вариант 1 == 
 + 
 +== Сохранение состояния iptables ==
 <​code>​ <​code>​
-# iptables-save > /​etc/​iptables.rules+root@gate:~# iptables-save > /​etc/​iptables.rules
 </​code>​ </​code>​
  
-=== Восстановление состояния iptables ​===+== Восстановление состояния iptables ==
 <​code>​ <​code>​
-# iptables-restore < /​etc/​iptables.rules+root@gate:~# iptables-restore < /​etc/​iptables.rules
 </​code>​ </​code>​
  
-=== Восстановление состояния iptables при загрузке ​=== +== Восстановление состояния iptables при загрузке ==
- +
-== Debian/​Ubuntu ​==+
 <​code>​ <​code>​
-# cat /​etc/​network/​interfaces+root@gate:~# cat /​etc/​network/​interfaces
 </​code><​code>​ </​code><​code>​
 ... ...
Line 65: Line 73:
   pre-up iptables-restore < /​etc/​iptables.rules   pre-up iptables-restore < /​etc/​iptables.rules
 ... ...
 +</​code>​
 +
 +== Вариант 2 ==
 +<​code>​
 +# apt install iptables-persistent
 +
 +# netfilter-persistent save
 </​code>​ </​code>​
  
 ==== CentOS ==== ==== CentOS ====
  
-=== CentOS 7 ===+=== CentOS 7, AlmaLinux 9 ===
  
   * [[https://​bozza.ru/​art-259.html|Настройка firewalld CentOS 7 с примерами команд]]   * [[https://​bozza.ru/​art-259.html|Настройка firewalld CentOS 7 с примерами команд]]
Line 408: Line 423:
 </​code>​ </​code>​
  
 +==== nftables ====
 +
 +  * [[https://​access.redhat.com/​documentation/​ru-ru/​red_hat_enterprise_linux/​7/​html/​security_guide/​sec-using_nftables_to_limit_the_amount_of_connections|Using nftables to limit the amount of connections]]
 +
 +<​code>​
 +gate# cat /​etc/​nftables.conf
 +</​code><​code>​
 +...
 +table inet filter {
 +        set denylist {
 +                type ipv4_addr
 +                size 65535
 +                flags dynamic,​timeout
 +                timeout 5m
 +        }
 +...
 +        chain forward {
 +                type filter hook forward priority filter; policy accept;
 +                ip protocol tcp ct state new,​untracked limit rate over 10/second add @denylist { ip saddr }
 +                ip saddr @denylist drop
 +        }
 +...
 +</​code>​
 ==== FreeBSD (pf) ==== ==== FreeBSD (pf) ====
  
Line 427: Line 465:
  
 # pfctl -t fail2ban -T add 172.16.1.254 # pfctl -t fail2ban -T add 172.16.1.254
 +# pfctl -k 172.16.1.254
  
 # pfctl -t fail2ban -T flush # pfctl -t fail2ban -T flush
сервис_firewall.1621613872.txt.gz · Last modified: 2021/05/21 19:17 by val