• Hey Guest, we're evolving the future of TeaSpeak.
    You're invited to join the discussion here!

BlockList

Rennato

Well-known member
Using the xtables and the geoip would be more practical and lightweight, but some links are not working and can not install, that of the blacklist I can get has to arrow all the IP array
 

Vafin

TeaFanatic
Request blocking method using iptables+ipset

1) Install ipset
# apt install ipset

2) Run the script to add Ip addresses to the blacklist addipblacklist.sh (In my script blocked requests from the USA.).

3) Mount the blacklist in iptables.
# iptables -A INPUT -m set --match-set blacklist src -j DROP
 

Attachments

Last edited:

MehdiSele

Well-known member
Request blocking method using iptables+ipset

1) Install ipset
# apt install ipset

2) Run the script to add Ip addresses to the blacklist addipblacklist.sh (In my script blocked requests from the USA.).

3) Mount the blacklist in iptables.
# iptables -A INPUT -m set --match-set blacklist src -j DROP
./block.sh: line 12: syntax error near unexpected token `do'
 

rezak164

Well-known member
Request blocking method using iptables+ipset

1) Install ipset
# apt install ipset

2) Run the script to add Ip addresses to the blacklist addipblacklist.sh (In my script blocked requests from the USA.).

3) Mount the blacklist in iptables.
# iptables -A INPUT -m set --match-set blacklist src -j DROP
You Tested And Working?
 

rezak164

Well-known member
You have a script works without error?
Ip addresses added to the blacklist?
Check this with the
# ipset-L blacklist command
yes script runned
yes added the blacklist

root@gamec:~# ipset-L blacklist command
ipset-L: command not found
 

Vafin

TeaFanatic
yes script runned
yes added the blacklist

root@gamec:~# ipset-L blacklist command
ipset-L: command not found
Check if the rule is added to iptables?, it should be above all rules, at the very beginning.

# iptables -L INPUT -v -n
 

rezak164

Well-known member
Check if the rule is added to iptables?, it should be above all rules, at the very beginning.

# iptables -L INPUT -v -n
root@gamec:~# iptables -L INPUT -v -n
Chain INPUT (policy ACCEPT 14368 packets, 1430K bytes)
pkts bytes target prot opt in out source destination
 

rezak164

Well-known member
root@gamec:~# iptables -L INPUT -v -n
Chain INPUT (policy DROP 144 packets, 7794 bytes)
pkts bytes target prot opt in out source destination
7563 736K ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
7563 736K ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
147 7942 ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
 

Vafin

TeaFanatic
root@gamec:~# iptables -L INPUT -v -n
Chain INPUT (policy DROP 144 packets, 7794 bytes)
pkts bytes target prot opt in out source destination
7563 736K ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
7563 736K ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
147 7942 ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
144 7794 ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
I don't see you have a rule with blacklist.

# iptables -A INPUT -m set --match-set blacklist src -j DROP
 

rezak164

Well-known member
I don't see you have a rule with blacklist.

# iptables -A INPUT -m set --match-set blacklist src -j DROP


root@gamec:~# iptables -L INPUT -v -n
Chain INPUT (policy DROP 2 packets, 104 bytes)
pkts bytes target prot opt in out source destination
19657 2750K ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
19657 2750K ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
484 29153 ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
476 28753 ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
476 28753 ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
476 28753 ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
2 84 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 match-set blacklist src
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 match-set blacklist src