LordLamer
  • Home
  • About Me
  • Familie
  • Knowledgeroot
  • Impressum
KEEP IN TOUCH

Posts tagged firewall

Firewallregeln mit Ferm

Feb14
2011
Written by lordlamer

Wer wie ich nicht gerne direkt iptables Regeln selber schreiben möchte sollte sich mal ferm angucken. Unter Debian lässt sich das Paket ganz einfach installieren mit:

aptitude install ferm

Und schon ist ferm installiert. Um ferm global zu aktivieren oder zu deaktivieren kann man den Schalter ENABLED in der Datei /etc/default/ferm auf YES oder NO setzen.

In meiner folgenden Konfiguration habe ich sowohl Regeln für IPv4 als auch IPv6. Eingehende Verbindungen über IPv4 oder IPv6 werden eingeschränkt. Bei den IPv4 Verbindungen habe ich auch ein Source- und Destination-Limit eingebaut.

Die Konfiguration befindet sich selber in der Datei /etc/ferm/ferm.conf. Und hier endlich eine Beispielkonfiguration:

table filter {
 chain INPUT {
 policy DROP;

 # connection tracking
 mod state state INVALID DROP;
 mod state state (ESTABLISHED RELATED) ACCEPT;

 # allow local packages
 interface lo ACCEPT;

 # respond to ping
 proto icmp icmp-type echo-request ACCEPT;

 # allow IPsec
 #proto udp dport 500 ACCEPT;
 #proto (esp ah) ACCEPT;

 # allow SSH connections on port 63333
 proto tcp dport 63333 {
 # source limit
 mod connlimit connlimit-above 10 REJECT;
 # destination limit
 mod connlimit connlimit-above 20 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # http
 proto tcp dport (80 443) {
 # source limit
 mod connlimit connlimit-above 50 REJECT;
 # destination limit
 mod connlimit connlimit-above 250 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # ftp
 proto tcp dport ftp {
 # source limit
 mod connlimit connlimit-above 5 REJECT;
 # destination limit
 mod connlimit connlimit-above 50 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # smtp
 proto tcp dport (25 465) {
 # source limit
 mod connlimit connlimit-above 20 REJECT;
 # destination limit
 mod connlimit connlimit-above 50 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # pop3
 proto tcp dport (110 995) {
 # source limit
 mod connlimit connlimit-above 20 REJECT;
 # destination limit
 mod connlimit connlimit-above 250 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # imap
 proto tcp dport (143 993) {
 # source limit
 mod connlimit connlimit-above 20 REJECT;
 # destination limit
 mod connlimit connlimit-above 250 connlimit-mask 0 REJECT;

 ACCEPT;
 }

 # sieve
 proto tcp dport 2000 {
 # source limit
 mod connlimit connlimit-above 5 REJECT;
 # destination limit
 mod connlimit connlimit-above 50 connlimit-mask 0 REJECT;

 ACCEPT;
 }
 }
 chain OUTPUT {
 policy ACCEPT;

 # connection tracking
 #mod state state INVALID DROP;
 mod state state (ESTABLISHED RELATED) ACCEPT;
 }
 chain FORWARD {
 policy DROP;

 # connection tracking
 mod state state INVALID DROP;
 mod state state (ESTABLISHED RELATED) ACCEPT;
 }
}

# IPv6:
domain ip6 table filter {
 chain INPUT {
 policy DROP;

 # connection tracking
 #mod state state INVALID DROP;
 mod state state (ESTABLISHED RELATED) ACCEPT;

 # allow local connections
 interface lo ACCEPT;

 # allow ICMP (for neighbor solicitation, like ARP for IPv4)
 proto ipv6-icmp ACCEPT;

 # allow SSH connections on port 63333
 proto tcp dport 63333 ACCEPT;

 # http
 proto tcp dport (80 443) ACCEPT;

 # ftp
 proto tcp dport ftp ACCEPT;

 # smtp
 proto tcp dport (25 465) ACCEPT;

 # pop3
 proto tcp dport (110 995) ACCEPT;

 # imap
 proto tcp dport (143 993) ACCEPT;

 # sieve
 proto tcp dport 2000 ACCEPT;
 }

 # outgoing connections are not limited
 chain OUTPUT policy ACCEPT;

 # this is not a router
 chain FORWARD policy DROP;
}

Bei Fragen oder Anmerkungen meldet euch doch einfach.

Posted in Debian, IPv6 - Tagged ferm, iptables

Community

  • Forum
  • GitHub
  • Knowledgeroot
  • YouTube

#lordlamer

@phpmagazin Kann man einzelne Magazine auch online irgendwo einkaufen ohne das man gleich ein ABO abschließen muss? - 2 years ago

RT @DanShappir: Anything that can be done in HTML and CSS (without JavaScript) should be done in HTML and CSS (without JavaScript) - 2 years ago

@mauricerenck Bin auch kein Freund davon.... - 2 years ago

@jcagundlach @DB_Bahn Willkommen in Schwarzenbek ;) Dann hab ich dich gestern da stehen sehen... - 2 years ago

das nervt mich auch tierisch... zu viel Sicherheit das es schon fast unfreundlich ist es zu benutzen. Mach daraus m… https://t.co/VDTvD12q8c - 2 years ago

Visit My Profile

Categories

  • bsd (1)
  • citrix (3)
  • Company (24)
  • Debian (11)
  • Familie (75)
  • Geocaching (2)
  • Hausbau (41)
  • IPv6 (5)
  • Java (3)
  • klettern (10)
  • Knowledgeroot (15)
  • Linux (12)
  • LUG Balista (1)
  • misc (21)
  • mysql (1)
  • netscreen (2)
  • postgresql (1)
  • sap (4)
  • solr (2)
  • vim (2)

EvoLve theme by Theme4Press  •  Powered by WordPress LordLamer
Frank Habermann