Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
| Obě strany předchozí revize Předchozí verze Následující verze | Předchozí verze | ||
|
linux:net:firewall [12.06.2007 10:26] mtalma |
linux:net:firewall [13.03.2020 18:43] (aktuální) |
||
|---|---|---|---|
| Řádek 6: | Řádek 6: | ||
| * firewall na základě scriptu [[http:// | * firewall na základě scriptu [[http:// | ||
| * jednotlivé díly na publikované na [[http:// | * jednotlivé díly na publikované na [[http:// | ||
| + | |||
| ===== Petříček ===== | ===== Petříček ===== | ||
| Řádek 231: | Řádek 232: | ||
| </ | </ | ||
| + | |||
| + | ===== Dynamický blacklist ===== | ||
| + | *dynamický blacklist pro SSH spojení - http:// | ||
| + | <code bash> | ||
| + | ### Dynamic blacklist for SSH connection | ||
| + | # create properREJECT chain that does different rejects for tcp/udp | ||
| + | $IPTABLES -N properREJECT | ||
| + | $IPTABLES -A properREJECT -p tcp -j REJECT --reject-with tcp-reset | ||
| + | $IPTABLES -A properREJECT -j REJECT --reject-with icmp-port-unreachable | ||
| + | # | ||
| + | $IPTABLES -N blacklistdrop | ||
| + | $IPTABLES -A blacklistdrop -j LOG --log-prefix " | ||
| + | $IPTABLES -A blacklistdrop -m recent --name BLACKLIST --set -j DROP | ||
| + | # | ||
| + | # | ||
| + | # on external hosts, do rate limiting on incoming ssh packets, and keep a blacklist for 30 seconds | ||
| + | # this rule drops *any* packet if the IP is in the blacklist | ||
| + | # icmp ' | ||
| + | # they are generated by our own REJECT rule in the extern_out chain | ||
| + | $IPTABLES -A extern_in -m recent --name BLACKLIST --update --seconds 120 -j DROP | ||
| + | # | ||
| + | # all *established* ssh connections simply continue | ||
| + | $IPTABLES -A extern_in | ||
| + | # | ||
| + | # *new* ssh connections are all put into a list ' | ||
| + | # we send the package to chain ' | ||
| + | $IPTABLES -A extern_in | ||
| + | # | ||
| + | # if we have seen less then 3 such packets in the last 30 seconds we accept | ||
| + | $IPTABLES -A extern_in | ||
| + | # | ||
| + | # if the destination address is in the blacklist, we REJECT *any* packet | ||
| + | $IPTABLES -A extern_out -m recent --name BLACKLIST --rdest --rcheck --seconds 30 -j properREJECT | ||
| + | # | ||
| + | # outgoing we accept all ssh traffic, with connection tracking | ||
| + | $IPTABLES -A extern_out -p tcp --sport 22 -m state --state ESTABLISHED, | ||
| + | </ | ||
| ===== Odkazy ===== | ===== Odkazy ===== | ||
