U iptables na poradi zalezi, podivat se co tam mas muzes takhle:
iptables -nvL
To vypise kompletni pravidla v tabulce filtrovani. Pokud nekde pred tim mas povoleni ... tak to samo povoli driv, nez dropne.
Problém je zřejmě, že jsem to dal do /etc/rc.local. Je to stroj se systemd (ubuntu 15.04). Ve výpisu iptables -nvL to není, to znamená, že po iniciaci sítě se ta pravidla, která jsem zadal do /etc/rc.local vymažou.
Zkoušel jsem to zablokovat i prostřednictvím ufw, ale ufw nepropsalo zákazy do iptables, přesto, že jsem ufw povolil a nastavil pro automatické spuštění.
sudo ufw deny from 79.141.0.0/16
sudo ufw deny from 95.141.0.0/16
sudo ufw deny to 79.141.0.0/16
sudo ufw deny to 95.141.0.0/16
nezabralo. Pak jsem pravidla smazal a zadal s přesunutím na první místo:
sudo ufw sudo ufw insert 1 deny from 79.141.0.0/16
sudo ufw sudo ufw insert 1 deny from 95.141.0.0/16
sudo ufw sudo ufw insert 1 deny to 79.141.0.0/16
sudo ufw sudo ufw insert 1 deny to 95.141.0.0/16
Nezabralo, vypadá to, že se prostě do iptables nepropsalo, přesto, že v ufw status numbered to vidím blokované.
Aktuální stav iptables -vL
Chain INPUT (policy DROP 21 packets, 1521 bytes)
pkts bytes target prot opt in out source destination
3773K 790M ufw-before-logging-input all -- any any anywhere anywhere
3773K 790M ufw-before-input all -- any any anywhere anywhere
20022 1919K ufw-after-input all -- any any anywhere anywhere
17421 1127K ufw-after-logging-input all -- any any anywhere anywhere
17421 1127K ufw-reject-input all -- any any anywhere anywhere
17421 1127K ufw-track-input all -- any any anywhere anywhere
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ufw-before-logging-forward all -- any any anywhere anywhere
0 0 ufw-before-forward all -- any any anywhere anywhere
0 0 ufw-after-forward all -- any any anywhere anywhere
0 0 ufw-after-logging-forward all -- any any anywhere anywhere
0 0 ufw-reject-forward all -- any any anywhere anywhere
0 0 ufw-track-forward all -- any any anywhere anywhere
Chain OUTPUT (policy ACCEPT 27 packets, 2400 bytes)
pkts bytes target prot opt in out source destination
3275K 7399M ufw-before-logging-output all -- any any anywhere anywhere
3275K 7399M ufw-before-output all -- any any anywhere anywhere
46205 34M ufw-after-output all -- any any anywhere anywhere
46205 34M ufw-after-logging-output all -- any any anywhere anywhere
46205 34M ufw-reject-output all -- any any anywhere anywhere
46205 34M ufw-track-output all -- any any anywhere anywhere
Chain ufw-after-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-input (1 references)
pkts bytes target prot opt in out source destination
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-ns
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-dgm
0 0 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:netbios-ssn
0 0 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:microsoft-ds
82 25256 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootps
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootpc
0 0 ufw-skip-to-policy-input all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCAST
Chain ufw-after-logging-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-after-logging-input (1 references)
pkts bytes target prot opt in out source destination
20 1461 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-after-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 ACCEPT icmp -- any any anywhere anywhere icmp destination-unreachable
0 0 ACCEPT icmp -- any any anywhere anywhere icmp source-quench
0 0 ACCEPT icmp -- any any anywhere anywhere icmp time-exceeded
0 0 ACCEPT icmp -- any any anywhere anywhere icmp parameter-problem
0 0 ACCEPT icmp -- any any anywhere anywhere icmp echo-request
0 0 ufw-user-forward all -- any any anywhere anywhere
Chain ufw-before-input (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo any anywhere anywhere
127K 12M ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
119 7354 ufw-logging-deny all -- any any anywhere anywhere ctstate INVALID
119 7354 DROP all -- any any anywhere anywhere ctstate INVALID
0 0 ACCEPT icmp -- any any anywhere anywhere icmp destination-unreachable
0 0 ACCEPT icmp -- any any anywhere anywhere icmp source-quench
0 0 ACCEPT icmp -- any any anywhere anywhere icmp time-exceeded
0 0 ACCEPT icmp -- any any anywhere anywhere icmp parameter-problem
0 0 ACCEPT icmp -- any any anywhere anywhere icmp echo-request
0 0 ACCEPT udp -- any any anywhere anywhere udp spt:bootps dpt:bootpc
549 64061 ufw-not-local all -- any any anywhere anywhere
0 0 ACCEPT udp -- any any anywhere 224.0.0.251 udp dpt:mdns
0 0 ACCEPT udp -- any any anywhere 239.255.255.250 udp dpt:1900
549 64061 ufw-user-input all -- any any anywhere anywhere
Chain ufw-before-logging-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-output (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any lo anywhere anywhere
124K 298M ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
1317 109K ufw-user-output all -- any any anywhere anywhere
Chain ufw-logging-allow (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "
Chain ufw-logging-deny (2 references)
pkts bytes target prot opt in out source destination
21 1240 RETURN all -- any any anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
20 1454 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-not-local (1 references)
pkts bytes target prot opt in out source destination
441 35391 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type LOCAL
4 136 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type MULTICAST
104 28534 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCAST
0 0 ufw-logging-deny all -- any any anywhere anywhere limit: avg 3/min burst 10
0 0 DROP all -- any any anywhere anywhere
Chain ufw-reject-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-skip-to-policy-forward (0 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any any anywhere anywhere
Chain ufw-skip-to-policy-input (7 references)
pkts bytes target prot opt in out source destination
82 25256 DROP all -- any any anywhere anywhere
Chain ufw-skip-to-policy-output (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere
Chain ufw-track-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-output (1 references)
pkts bytes target prot opt in out source destination
488 29280 ACCEPT tcp -- any any anywhere anywhere ctstate NEW
805 77151 ACCEPT udp -- any any anywhere anywhere ctstate NEW
Chain ufw-user-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-input (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any any anywhere 95.141.0.0/16
0 0 DROP all -- any any anywhere reverse.alphalink.fr/16
14 840 DROP all -- any any 95.141.0.0/16 anywhere
32 1984 DROP all -- any any reverse.alphalink.fr/16 anywhere
9 540 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9001
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:9001
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9090
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:9090
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9030
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:9030
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9050
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:9050
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:http
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:https
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:https
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:db-lsp
22 3278 ACCEPT udp -- any any anywhere anywhere udp dpt:17500
145 8320 ACCEPT tcp -- any any anywhere anywhere tcp dpt:51413
224 22322 ACCEPT udp -- any any anywhere anywhere udp dpt:51413
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9001
0 0 tcp -- any any anywhere anywhere tcp dpt:ssh ctstate NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
0 0 ufw-user-limit tcp -- any any anywhere anywhere tcp dpt:ssh ctstate NEW recent: UPDATE seconds: 30 hit_count: 6 name: DEFAULT side: source mask: 255.255.255.255
0 0 ufw-user-limit-accept tcp -- any any anywhere anywhere tcp dpt:ssh
0 0 ACCEPT tcp -- any any anywhere anywhere tcp spt:34714
0 0 ACCEPT udp -- any any anywhere anywhere udp spt:34714
0 0 ACCEPT tcp -- any any anywhere anywhere multiport dports http,https
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:9091
0 0 ACCEPT tcp -- any any anywhere anywhere multiport dports 6881:6891
0 0 ACCEPT udp -- any any anywhere anywhere multiport dports 6881:6891
Chain ufw-user-limit (1 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
0 0 REJECT all -- any any anywhere anywhere reject-with icmp-port-unreachable
Chain ufw-user-limit-accept (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere
Chain ufw-user-logging-forward (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-input (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-output (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-output (1 references)
pkts bytes target prot opt in out source destination