Skip to content
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

Enhance iptables rules for security and logging #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

achrafka
Copy link

  • Added rate-limiting to SSH traffic (limits SSH connection attempts to 5 min to mitigate brute force attacks)
  • Block invalid TCP flags combinations
  • Added logging for dropped packets
  • Replaced deprecated -m state --state with -m conntrack --ctstate
  • Ensures compatibility with modern iptables versions

so i Improved security by limiting SSH connection attempts and blocking invalid TCP flag combinations, enhanced logging to track dropped packets and ensured compatibility with newer iptables versions by replacing deprecated -m state with -m conntrack

- Added rate-limiting to SSH traffic:
  iptables -A INPUT -p tcp --dport 22 -m limit --limit 5/min -j ACCEPT
  Limits SSH connection attempts to 5 per minute to mitigate brute force attacks.

- Block invalid TCP flags combinations:
  - iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
    Drops packets with no TCP flags (null scan attack).
  - iptables -A INPUT -p tcp --tcp-flags FIN,ACK FIN -j DROP
    Drops packets with FIN and ACK flags (XMAS scan mitigation).

- Added logging for dropped packets:
  - iptables -A INPUT -j LOG --log-prefix "INPUT_DROP: "
    Logs all dropped INPUT packets with the specified prefix.
  - iptables -A OUTPUT -j LOG --log-prefix "OUTPUT_DROP: "
    Logs all dropped OUTPUT packets with the specified prefix.

- Replaced deprecated `-m state --state` with `-m conntrack --ctstate`:
  - Ensures compatibility with modern iptables versions.
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