Overview
Currently, blocking an IP in SilentGuard only writes to ~/.silentguard_rules.json. This issue is about adding real OS-level enforcement via iptables.
Current state: No iptables/nftables code exists anywhere in the codebase. The rules-file blocking (already working) and the iptables blocking should coexist — both should happen when a user blocks an IP.
What needs to be done
Goal
A working apply_block(ip) / remove_block(ip) pair that runs iptables commands and reports True/False for success. The rules-file update still happens regardless.
Notes
Overview
Currently, blocking an IP in SilentGuard only writes to
~/.silentguard_rules.json. This issue is about adding real OS-level enforcement viaiptables.Current state: No iptables/nftables code exists anywhere in the codebase. The rules-file blocking (already working) and the iptables blocking should coexist — both should happen when a user blocks an IP.
What needs to be done
apply_block(ip: str) -> boolinmonitor.py(or a newfirewall.py) that runsiptables -A OUTPUT -d <ip> -j DROPviasubprocess.runremove_block(ip: str) -> boolthat runsiptables -D OUTPUT -d <ip> -j DROPiptables -C OUTPUT -d <ip> -j DROPexits 0 if the rule exists)subprocess.CalledProcessError,FileNotFoundError(iptables not installed), andPermissionError— returnFalseand log a message instead of crashingblock_ip_in_rules()to also callapply_block()when available; updateunblock_ip_in_rules()to callremove_block()Goal
A working
apply_block(ip)/remove_block(ip)pair that runs iptables commands and reportsTrue/Falsefor success. The rules-file update still happens regardless.Notes
iptablesonly.nftablescan be a follow-up.subprocess.runand verifies the correct command is called.