#!/usr/bin/perl # setup.cgi # Create an initial IPFW rules file require './ipfw-lib.pl'; &ReadParse(); # Start with base configuration, which will include 65535 rule $rules = &get_config("$config{'ipfw'} list |", \$out); if ($in{'reset'}) { @$rules = grep { $_->{'num'} == 65535 } @$rules; } # A flush will generate the 65535 rule, so we can exclude it if (&get_ipfw_format() == 1) { @$rules = grep { $_->{'num'} != 65535 } @$rules; } # Add selected rules if ($in{'auto'} == 0) { # Allow all traffic splice(@$rules, 0, 0, { "action" => "allow", "num" => "00100", "proto" => "all", "from" => "any", "to" => "any", "cmt" => "Allow all traffic" }); } elsif ($in{'auto'} >= 2) { # Block all traffic, apart from established connections, DNS replies # and safe ICMP types $iface = $in{'iface'.$in{'auto'}} || $in{'iface'.$in{'auto'}.'_other'}; $iface || &error($text{'setup_eiface'}); splice(@$rules, 0, 0, { "action" => "skipto", "aarg" => "00300", "num" => "00100", "proto" => "all", "from" => "any", "to" => "any", "recv" => $iface, "cmt" => "Skip next rule for external interface" }, { "action" => "allow", "num" => "00200", "proto" => "all", "from" => "any", "to" => "any", "cmt" => "Allow all traffic on internal interfaces" }, { "action" => "allow", "num" => "00300", "proto" => "tcp", "from" => "any", "to" => "any", "established" => 1, "cmt" => "Allow established TCP connections" }, { "action" => "allow", "num" => "00400", "proto" => "tcp", "from" => "any", "to" => "any", "tcpflags" => "ack", "cmt" => "Allow traffic with ACK flag set" }, { "action" => "allow", "num" => "00500", "proto" => "udp", "from" => "any", "from_ports" => "53", "to" => "any", "to_ports" => "1024-65535", "cmt" => "Accept responses to DNS queries" }, { "action" => "allow", "num" => "00600", "proto" => "icmp", "from" => "any", "to" => "any", "icmptypes" => "0,3,4,11,12", "cmt" => "Accept safe ICMP types" }); if ($in{'auto'} >= 3) { # Add SSH and ident splice(@$rules, @$rules-1, 0, { "action" => "allow", "num" => "00700", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => 22, "cmt" => "Allow connections to our SSH server" }, { "action" => "allow", "num" => "00800", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => 113, "cmt" => "Allow connections to our IDENT server" }); } if ($in{'auto'} >= 4) { # Allow pings and most high ports splice(@$rules, @$rules-1, 0, { "action" => "allow", "num" => "00900", "proto" => "icmp", "from" => "any", "to" => "any", "icmptypes" => "8", "cmt" => "Respond to pings" }, { "action" => "deny", "num" => "01000", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => "2049-2050", "cmt" => "Protect our NFS server" }, { "action" => "deny", "num" => "01100", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => "6000-6063", "cmt" => "Protect our X11 display server" }, { "action" => "deny", "num" => "01200", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => "7000-7010", "cmt" => "Protect our X font server" }, { "action" => "allow", "num" => "01300", "proto" => "tcp", "from" => "any", "to" => "any", "to_ports" => "1024-65535", "cmt" => "Allow connections to unprivileged ports" }); } # Add final deny all rule (if needed) local $lr = $rules->[@$rules-1]; if ($lr->{'num'} != 65535 || $lr->{'action'} ne 'deny') { splice(@$rules, @$rules-1, 0, { "action" => "deny", "num" => "10000", "proto" => "all", "from" => "any", "to" => "any" }); } } # Add flush line at top if (&get_ipfw_format() == 1) { splice(@$rules, 0, 0, { 'other' => 1, 'text' => 'flush' }); } # Save firewall &lock_file($ipfw_file); &save_config($rules); &unlock_file($ipfw_file); ©_to_cluster(); if ($in{'atboot'}) { &enable_boot(); } &webmin_log("setup"); &redirect("");
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 1.04 KB | 0644 |
|
apply.cgi | File | 293 B | 0755 |
|
bootup.cgi | File | 240 B | 0755 |
|
cluster.cgi | File | 1.98 KB | 0755 |
|
cluster_add.cgi | File | 1.79 KB | 0755 |
|
cluster_delete.cgi | File | 470 B | 0755 |
|
config | File | 89 B | 0644 |
|
config.info | File | 472 B | 0644 |
|
config.info.ca | File | 433 B | 0644 |
|
config.info.de | File | 539 B | 0644 |
|
config.info.nl | File | 426 B | 0644 |
|
convert.cgi | File | 274 B | 0755 |
|
edit_rule.cgi | File | 10.16 KB | 0755 |
|
index.cgi | File | 6.36 KB | 0755 |
|
install_check.pl | File | 484 B | 0755 |
|
ipfw-lib.pl | File | 17.42 KB | 0755 |
|
log_parser.pl | File | 569 B | 0755 |
|
module.info | File | 170 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 114 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 169 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 192 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 208 B | 0644 |
|
module.info.ca | File | 106 B | 0644 |
|
module.info.cs | File | 0 B | 0644 |
|
module.info.cs.auto | File | 108 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 105 B | 0644 |
|
module.info.de | File | 117 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 222 B | 0644 |
|
module.info.es | File | 0 B | 0644 |
|
module.info.es.auto | File | 99 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 105 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 171 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 113 B | 0644 |
|
module.info.fr | File | 0 B | 0644 |
|
module.info.fr.auto | File | 117 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 157 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 112 B | 0644 |
|
module.info.hu | File | 0 B | 0644 |
|
module.info.hu.auto | File | 139 B | 0644 |
|
module.info.it | File | 0 B | 0644 |
|
module.info.it.auto | File | 112 B | 0644 |
|
module.info.ja | File | 0 B | 0644 |
|
module.info.ja.auto | File | 158 B | 0644 |
|
module.info.ko | File | 0 B | 0644 |
|
module.info.ko.auto | File | 125 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 120 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 121 B | 0644 |
|
module.info.ms | File | 0 B | 0644 |
|
module.info.ms.auto | File | 114 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 110 B | 0644 |
|
module.info.nl | File | 21 B | 0644 |
|
module.info.nl.auto | File | 98 B | 0644 |
|
module.info.no | File | 0 B | 0644 |
|
module.info.no.auto | File | 115 B | 0644 |
|
module.info.pl | File | 0 B | 0644 |
|
module.info.pl.auto | File | 102 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 99 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 105 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 114 B | 0644 |
|
module.info.ru | File | 0 B | 0644 |
|
module.info.ru.auto | File | 171 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 106 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 120 B | 0644 |
|
module.info.sv | File | 0 B | 0644 |
|
module.info.sv.auto | File | 111 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 177 B | 0644 |
|
module.info.tr | File | 0 B | 0644 |
|
module.info.tr.auto | File | 140 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 194 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 235 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 139 B | 0644 |
|
module.info.zh | File | 0 B | 0644 |
|
module.info.zh.auto | File | 95 B | 0644 |
|
module.info.zh_TW | File | 0 B | 0644 |
|
module.info.zh_TW.auto | File | 101 B | 0644 |
|
move.cgi | File | 561 B | 0755 |
|
save_rule.cgi | File | 8.19 KB | 0755 |
|
setup.cgi | File | 4.14 KB | 0755 |
|
start.pl | File | 271 B | 0755 |
|
stop.pl | File | 254 B | 0755 |
|
unapply.cgi | File | 257 B | 0755 |
|