Skip to content

Iptables hardening #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Iptables hardening #23

wants to merge 5 commits into from

Conversation

ad90df8e708e8fa8153e56a059
Copy link
Contributor

Added some iptables & sysctl hardening rules with comments re: Issue #15

* Added a new rule to top of `PREROUTING` chain to allow connection to the SocksPort (172.16.0.1:9050). This rules prevents the ones under it from redirecting direct socks connection requests through the TransPort. Without this rule (or adding `! -d 10.4.0.1/32` to each PREROUTING redirection rule), the client will be unable to connect to the SocksPort directly.
* Copied the UDP DNS redirection/accept rules to otherwise identical TCP rules. DNS is primarily a UDP protocol, but any requests/responses over 512 bytes are sent over TCP, and per the RFC (https://tools.ietf.org/html/rfc1035) it's apparently valid to do everything over TCP if you want, so it's probably best to try and forward any TCP DNS requests instead of dropping them.
* Updated deprecated connection tracking module syntax.
* Consolidated multiple `--dport ### -j ACCEPT` lines into one using `-m multiport --dports ###,###` syntax. Not much help as is, but would save a lot of repetition if opening up multiple SocksPorts.
* Added `-s 172.16.0.0/24` to most of the INPUT rules on eth0. Probably doesn't add anything meaningful, but since clients connected to eth0 should never have an IP outside of that subnet, it doesn't hurt and might block some weird case I haven't thought of.
Added a bunch of networking lockdown rules to `/etc/sysctl.conf`
Added `sysctl -p` to reload the added sysctl rules
Added some more iptables lockdown rules.
@ad90df8e708e8fa8153e56a059
Copy link
Contributor Author

This may be beyond the scope of the project and a bit overkill besides. I'll reopen if we get there eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant