]>
Commit | Line | Data |
---|---|---|
069680ac | 1 | #!/usr/bin/perl |
70df8302 MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
069680ac MT |
21 | |
22 | use strict; | |
23 | require '/var/ipfire/general-functions.pl'; | |
24 | ||
25 | my %settings; | |
26 | my $iface; | |
27 | ||
28 | General::readhash("${General::swroot}/ethernet/settings", \%settings); | |
29 | ||
30 | if (!open(FILE, '>/etc/ipac-ng/rules.conf')) { | |
31 | die "Unable to create /etc/ipac-ng/rules.conf"; } | |
32 | ||
33 | if (open(IFACE, "${General::swroot}/red/iface")) | |
34 | { | |
35 | $iface = <IFACE>; | |
36 | close IFACE; | |
37 | chomp ($iface); | |
38 | } | |
39 | ||
40 | print FILE "incoming GREEN ($settings{'GREEN_DEV'})|ipac~o|$settings{'GREEN_DEV'}|all|||\n"; | |
41 | print FILE "outgoing GREEN ($settings{'GREEN_DEV'})|ipac~i|$settings{'GREEN_DEV'}|all|||\n"; | |
42 | print FILE "forwarded incoming GREEN ($settings{'GREEN_DEV'})|ipac~fi|$settings{'GREEN_DEV'}|all|||\n"; | |
43 | print FILE "forwarded outgoing GREEN ($settings{'GREEN_DEV'})|ipac~fo|$settings{'GREEN_DEV'}|all|||\n"; | |
44 | ||
cf29614f | 45 | if ($settings{'CONFIG_TYPE'} =~ /^(2|4)$/ ) |
069680ac MT |
46 | { |
47 | print FILE "incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~o|$settings{'ORANGE_DEV'}|all|||\n"; | |
48 | print FILE "outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~i|$settings{'ORANGE_DEV'}|all|||\n"; | |
49 | print FILE "forwarded incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~fi|$settings{'ORANGE_DEV'}|all|||\n"; | |
50 | print FILE "forwarded outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~fo|$settings{'ORANGE_DEV'}|all|||\n"; | |
51 | } | |
52 | ||
cf29614f | 53 | if ($settings{'CONFIG_TYPE'} =~ /^(3|4)$/ ) |
069680ac MT |
54 | { |
55 | print FILE "incoming BLUE ($settings{'BLUE_DEV'})|ipac~o|$settings{'BLUE_DEV'}|all|||\n"; | |
56 | print FILE "outgoing BLUE ($settings{'BLUE_DEV'})|ipac~i|$settings{'BLUE_DEV'}|all|||\n"; | |
57 | print FILE "forwarded incoming BLUE ($settings{'BLUE_DEV'})|ipac~fi|$settings{'BLUE_DEV'}|all|||\n"; | |
58 | print FILE "forwarded outgoing BLUE ($settings{'BLUE_DEV'})|ipac~fo|$settings{'BLUE_DEV'}|all|||\n"; | |
59 | } | |
60 | if ($iface) { | |
61 | print FILE "incoming RED ($iface)|ipac~o|$iface|all|||\n"; | |
62 | print FILE "outgoing RED ($iface)|ipac~i|$iface|all|||\n"; | |
63 | print FILE "forwarded incoming RED ($iface)|ipac~fi|$iface|all|||\n"; | |
64 | print FILE "forwarded outgoing RED ($iface)|ipac~fo|$iface|all|||\n"; | |
65 | } | |
66 | ||
67 | close FILE; |