среда, 5 февраля 2014 г.

iptables addons geoip Баним страны

sudo apt-get install iptables-dev unzip dh-make dh-autoreconf  dkms build-essential  linux-headers-$(uname -r)libtext-csv-xs-perl
# cd /usr/src
# apt-get source xtables-addons-common

# cd xtables-addons*
# dpkg-buildpackage -d && cd ..    без -d не пошло 
# dpkg -i *.deb
# modinfo xt_geoip
# cd /var/tmp
# /usr/lib/xtables-addons/xt_geoip_dl 
Downloaded: 2 files, 2,9M in 5,8s (508 KB/s)
Archive:  GeoIPCountryCSV.zip
  inflating: GeoIPCountryWhois.csv

# ls
GeoIPCountryCSV.zip  GeoIPCountryWhois.csv  GeoIPv6.csv

# /usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip ./GeoIPCountryWhois.csv
Запрещаем все кроме RU
# iptables -A INPUT ! -i lo -m geoip ! --source-country RU -j DROP  
iptables-save > /etc/iptables.up.rules
/etc/network/if-pre-up.d/iptables
#!/bin/bash
/sbin/iptables-restore < /etc/iptables.up.rules

                                                                                                              Помогло это

Комментариев нет:

Отправить комментарий