mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 19:00:27 +00:00
Make blackholed use its own chain
This makes blackholed interfere less with any existing iptables raw table configurations.
This commit is contained in:
parent
69bee64a59
commit
bc8de80c96
1 changed files with 10 additions and 5 deletions
|
@ -87,15 +87,20 @@ Protocol:\n\
|
||||||
Linux Requirements:\n\
|
Linux Requirements:\n\
|
||||||
sudo modprobe ip_tables\n\
|
sudo modprobe ip_tables\n\
|
||||||
sudo echo ip_tables >>/etc/modules\n\
|
sudo echo ip_tables >>/etc/modules\n\
|
||||||
|
sudo iptables -t raw -N blackholed\n\
|
||||||
|
sudo iptables -t raw -A blackholed -j RETURN\n\
|
||||||
|
sudo iptables -t raw -I PREROUTING -j blackholed\n\
|
||||||
\n\
|
\n\
|
||||||
Administration Notes:\n\
|
Administration Notes:\n\
|
||||||
This program inserts IP bans into iptables raw prerouting, so\n\
|
This program inserts IP bans into its own chain in the iptables raw table,\n\
|
||||||
the kernel won't track the TCP connections of threat actors.\n\
|
so that the kernel won't track the TCP connections of threat actors.\n\
|
||||||
|
Note that the 3 iptables commands have to be run on every system startup.\n\
|
||||||
If you restart this program, then you should run\n\
|
If you restart this program, then you should run\n\
|
||||||
sudo iptables -t raw -F\n\
|
sudo iptables -t raw -F blackholed\n\
|
||||||
|
sudo iptables -t raw -A blackholed -j RETURN\n\
|
||||||
to clear the IP blocks. It's a good idea to have a cron job\n\
|
to clear the IP blocks. It's a good idea to have a cron job\n\
|
||||||
restart this daemon and clear the raw table daily. Use the\n\
|
restart this daemon and clear the raw table daily. Use the\n\
|
||||||
sudo iptables -t raw -L -vn\n\
|
sudo iptables -t raw -L blackholed -vn\n\
|
||||||
command to list the IP addresses that have been blocked.\n\
|
command to list the IP addresses that have been blocked.\n\
|
||||||
\n"
|
\n"
|
||||||
|
|
||||||
|
@ -221,7 +226,7 @@ void BlockIp(uint32_t ip) {
|
||||||
(char *const[]){
|
(char *const[]){
|
||||||
"iptables", //
|
"iptables", //
|
||||||
"-t", "raw", //
|
"-t", "raw", //
|
||||||
"-I", "PREROUTING", //
|
"-I", "blackholed", //
|
||||||
"-s", FormatIp(ip), //
|
"-s", FormatIp(ip), //
|
||||||
"-j", "DROP", //
|
"-j", "DROP", //
|
||||||
0, //
|
0, //
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue