]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/helper/writeipac.pl
Ein Paar Dateien fuer die GPLv3 angepasst.
[people/teissler/ipfire-2.x.git] / src / initscripts / helper / writeipac.pl
CommitLineData
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
22use strict;
23require '/var/ipfire/general-functions.pl';
24
25my %settings;
26my $iface;
27
28General::readhash("${General::swroot}/ethernet/settings", \%settings);
29
30if (!open(FILE, '>/etc/ipac-ng/rules.conf')) {
31 die "Unable to create /etc/ipac-ng/rules.conf"; }
32
33if (open(IFACE, "${General::swroot}/red/iface"))
34{
35 $iface = <IFACE>;
36 close IFACE;
37 chomp ($iface);
38}
39
40print FILE "incoming GREEN ($settings{'GREEN_DEV'})|ipac~o|$settings{'GREEN_DEV'}|all|||\n";
41print FILE "outgoing GREEN ($settings{'GREEN_DEV'})|ipac~i|$settings{'GREEN_DEV'}|all|||\n";
42print FILE "forwarded incoming GREEN ($settings{'GREEN_DEV'})|ipac~fi|$settings{'GREEN_DEV'}|all|||\n";
43print FILE "forwarded outgoing GREEN ($settings{'GREEN_DEV'})|ipac~fo|$settings{'GREEN_DEV'}|all|||\n";
44
cf29614f 45if ($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 53if ($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}
60if ($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
67close FILE;