Skip to content

Instantly share code, notes, and snippets.

View suchacoder's full-sized avatar

Leandro suchacoder

  • Rio Gallegos
View GitHub Profile
@Thermi
Thermi / Best Practices.md
Last active February 10, 2026 15:12
Summary page of the Netfilter related resources

Best Practices:

  1. Don't use iptables to apply your rules one at a time, use iptables-restore to apply a whole ruleset in one action.
  2. Set your INPUT and FORWARD policy to DROP.
  3. Don't set your OUTPUT policy to DROP unless you really know what you're doing.
  4. If you're going to implement a blacklist or whitelist, you should look at using ipsets if that list is going to be more than two or three addresses, and if it might be dynamic.
  5. Allow all traffic on lo.
  6. You should ALLOW traffic in ctstates of RELATED and ESTABLISHED near the beginning of your rules
  7. Don't use iptables -L
  8. DON'T USE IPTABLES -L
  9. Use iptables-save instead of iptables -L.
#!/usr/bin/env sh
# Location of executables
IPSET=/usr/sbin/ipset
IPTABLES=/sbin/iptables
# Common definitions
COMMENT="-m comment --comment"
LOG="ULOG --ulog-nlgroup 1 --ulog-prefix"
DONT_LOG=""
#!/usr/bin/env sh
# Location of executables
IPSET=/usr/sbin/ipset
IPTABLES=/sbin/iptables
# Common definitions
COMMENT="-m comment --comment"
LOG="ULOG --ulog-nlgroup 1 --ulog-prefix"
DONT_LOG=""
@meanevo
meanevo / ipset.service
Last active November 20, 2023 07:21
IPSet settings persistence
#
# reference: http://namsep.blogspot.com/2015/12/yad-centos-7-iptables-ipset-and-fail2ban.html
# reference: http://pkgs.fedoraproject.org/cgit/ipset.git/tree/ipset.service
# file location: /etc/systemd/system/ipset.service
#
# systemctl enable ipset.service
# mkdir /etc/ipset
# touch /etc/ipset/ipset
# ...do something with ipset...
# ipset save > /etc/ipset/ipset
@tomhodgins
tomhodgins / snippets.md
Last active August 8, 2022 14:27
Snippets.md is my most often used HTML, CSS and JavaScript snippets for front-end web development
@mattdesl
mattdesl / modules.md
Last active October 12, 2024 16:17
my favourite modules.
#!/usr/bin/env sh
# Location of executables
IPSET=/usr/sbin/ipset
IPTABLES=/sbin/iptables
# Common definitions
COMMENT="-m comment --comment"
LOG="ULOG --ulog-nlgroup 1 --ulog-prefix"
DONT_LOG=""
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})