Доброго дня всем, вобщем решил, я тут, все же заблокировать соцсети (не всем конечно) немного почитал, покурил маны, побороздил google и нашел подходящее как мне показалось решение, но что то не завелось((((
Вобщем ниже часть скрипта фаервола и выхлоп iptables -L -v
# AS32934 -- facebook.com
# AS47541 AS47542 -- vk.com
# AS49988 -- ok.ru
AS_TO_BAN="AS32934 AS47541 AS47542 AS49988"
#Исключения для некоторых пользователей
SOCIAL_ALLOW_IPs="10.0.2.203"
SOCIAL_ALLOW_MACs="00:15:5D:01:C9:01"
echo ""
echo "Block Social sites"
$IPT -N SOCIAL
# Разрешить кому можно по ip
for userip in $SOCIAL_ALLOW_IPs; do
$IPT -A SOCIAL -s $userip -j ACCEPT
done
# Разрешить кому можно по mac
for mac in $SOCIAL_ALLOW_MACs; do
$IPT -A SOCIAL -m mac --mac-source $mac -j ACCEPT
done
# Остальных drop
$IPT -A SOCIAL -j DROP
## ТУТ собираем все IP-диапазоны и блокируем доступ
for as in $AS_TO_BAN; do
for ip in `whois -h whois.radb.net "!g$as" | grep /`
do
$IPT -A FORWARD -i eth0 -p tcp -d $ip -j SOCIAL
done
done
:~$ sudo iptables -L -v
Chain INPUT (policy ACCEPT 204 packets, 22278 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 1935 packets, 1336K bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any any 10.0.2.4 anywhere
0 0 DROP all -- any any 10.0.2.6 anywhere
2 96 DROP all -- any any 10.0.2.122 anywhere
0 0 DROP all -- any any 10.0.2.125 anywhere
0 0 DROP all -- any any 10.0.2.132 anywhere
3 144 DROP all -- any any 10.0.2.146 anywhere
0 0 DROP all -- any any 10.0.2.153 anywhere
0 0 DROP all -- any any 10.0.2.159 anywhere
0 0 DROP all -- any any 10.0.2.66 anywhere
0 0 ACCEPT tcp -- any eth0 mail.vzsk.org anywhere tcp dpt:smtp
0 0 DROP tcp -- any eth0 anywhere anywhere tcp dpt:smtp
0 0 SOCIAL tcp -- eth0 any anywhere dr04.lla1.tfbnw.net/22
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 66.220.144.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 66.220.144.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.184.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/21
0 0 SOCIAL tcp -- eth0 any anywhere ae1.pr01.ams3.tfbnw.net/22
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.255.0/24
0 0 SOCIAL tcp -- eth0 any anywhere ae2.bb05.prn2.tfbnw.net/18
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.224.0/19
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.224.0/20
0 0 SOCIAL tcp -- eth0 any anywhere ae5.br01.vie1.tfbnw.net/22
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/24
0 0 SOCIAL tcp -- eth0 any anywhere ae2.bb05.prn2.tfbnw.net/19
0 0 SOCIAL tcp -- eth0 any anywhere 173.252.70.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.64.0/18
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.24.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 66.220.152.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 66.220.159.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.239.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.240.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.64.0/19
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.64.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.65.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.67.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.68.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.69.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.70.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.71.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.72.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.73.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.74.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.75.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.76.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.77.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.96.0/19
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.66.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 173.252.96.0/19
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.178.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.78.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.79.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.80.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.82.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.83.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.84.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.85.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.86.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.87.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.88.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.89.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.90.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.91.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.92.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.93.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.94.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.95.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 69.171.253.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.186.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 31.13.81.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 179.60.192.0/22
0 0 SOCIAL tcp -- eth0 any anywhere 179.60.192.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 179.60.193.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 179.60.194.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 179.60.195.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 185.60.216.0/22
0 0 SOCIAL tcp -- eth0 any anywhere 45.64.40.0/22
0 0 SOCIAL tcp -- eth0 any anywhere dr04.lla1.tfbnw.net/22
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.184.0/21
0 0 SOCIAL tcp -- eth0 any anywhere 66.220.144.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 69.63.176.0/20
0 0 SOCIAL tcp -- eth0 any anywhere srv0-224-186-93.vk.com/21
0 0 SOCIAL tcp -- eth0 any anywhere srv0-232-186-93.vk.com/21
0 0 SOCIAL tcp -- eth0 any anywhere srv0-128-240-87.vk.com/18
0 0 SOCIAL tcp -- eth0 any anywhere srv0-192.vkontakte.ru/21
0 0 SOCIAL tcp -- eth0 any anywhere 95.213.0.0/18
0 0 SOCIAL tcp -- eth0 any anywhere 185.32.248.0/22
0 0 SOCIAL tcp -- eth0 any anywhere srv0-200.vkontakte.ru/21
0 0 SOCIAL tcp -- eth0 any anywhere srv0-192.vkontakte.ru/20
0 0 SOCIAL tcp -- eth0 any anywhere 217.20.144.0/20
0 0 SOCIAL tcp -- eth0 any anywhere 185.16.244.0/23
0 0 SOCIAL tcp -- eth0 any anywhere 185.16.246.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 185.16.247.0/24
0 0 SOCIAL tcp -- eth0 any anywhere 5.61.16.0/21
Chain OUTPUT (policy ACCEPT 193 packets, 27073 bytes)
pkts bytes target prot opt in out source destination
Chain SOCIAL (85 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any 10.0.2.203 anywhere
0 0 DROP all -- any any anywhere anywhere
Как я понял, из листинга, правила сработали, но вот доступ к сайтам как был открыт так и остался.
Может кто подскажет ЧЯДНТ