Skip to content

Instantly share code, notes, and snippets.

@netrunn3r
Last active November 5, 2024 22:58
Show Gist options
  • Select an option

  • Save netrunn3r/d5d9eddde86a7ad7cd31a7d8e5d747c4 to your computer and use it in GitHub Desktop.

Select an option

Save netrunn3r/d5d9eddde86a7ad7cd31a7d8e5d747c4 to your computer and use it in GitHub Desktop.

Revisions

  1. netrunn3r revised this gist Nov 24, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion iptables_geoip_debian.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    2. sudo apt install libnet-cidr-lite-perl libtext-csv-xs-perl libgeoip2-perl

    for day of writing, there is a problem with building by dkms this package xtables-addons-common so wehave to install this from source
    0. sudo apt install pkg-config libxtables-dev
    1. sudo apt install pkg-config libxtables-dev
    1. wget http://inai.de/files/xtables-addons/xtables-addons-3.13.tar.xz
    2. tar xf xtables-addons-3.13.tar.xz
    3. cd xtables-addons-3.13/
  2. netrunn3r created this gist Nov 24, 2020.
    25 changes: 25 additions & 0 deletions iptables_geoip_debian.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    1. change from buster to bullseye
    2. sudo apt install libnet-cidr-lite-perl libtext-csv-xs-perl libgeoip2-perl

    for day of writing, there is a problem with building by dkms this package xtables-addons-common so wehave to install this from source
    0. sudo apt install pkg-config libxtables-dev
    1. wget http://inai.de/files/xtables-addons/xtables-addons-3.13.tar.xz
    2. tar xf xtables-addons-3.13.tar.xz
    3. cd xtables-addons-3.13/
    4. ./configure
    5. make
    6. sudo make install
    7. sudo depmod -a
    8. sudo modprobe x_tables
    9. sudo modprobe xt_geoip
    10. cd geoip
    11. manual download GeoLite2-Country-CSV.zip from maxmind.com
    12. ./xt_geoip_dl_maxmind
    13. cd GeoLite2-Country-CSV_20201124/
    14. sudo mkdir -p /usr/share/xt_geoip
    15. sudo ../xt_geoip_build_maxmind -D /usr/share/xt_geoip/
    16. sudo iptables -I INPUT -m geoip ! --src-cc XX -j DROP

    Refenreces:
    1. https://www.reddit.com/r/debian/comments/d6mnsa/firewall_with_geoip_capability_on_debian_10/
    2. https://tracker.debian.org/pkg/xtables-addons