2007-03-08 05:38:37 +01:00
|
|
|
#! /usr/bin/perl -w
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
2007-06-11 23:42:58 +02:00
|
|
|
# The Shoreline Firewall4 (Shorewall-perl) Packet Filtering Firewall Compiler - V4.0
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
2007-09-08 18:09:51 +02:00
|
|
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
|
|
|
# (c) 2007 - Tom Eastep (teastep@shorewall.net)
|
|
|
|
#
|
|
|
|
# Complete documentation is available at http://shorewall.net
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-09-08 18:09:51 +02:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
2007-06-13 20:40:09 +02:00
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# compiler.pl [ <option> ... ] [ <filename> ]
|
|
|
|
#
|
|
|
|
# Options:
|
|
|
|
#
|
|
|
|
# --export # Compile for export
|
|
|
|
# --verbosity=<number> # Set VERBOSITY
|
|
|
|
# --directory=<directory> # Directory where configuration resides (default is /etc/shorewall)
|
|
|
|
# --timestamp # Timestamp all progress messages
|
2007-06-23 23:15:53 +02:00
|
|
|
# --debug # Print stack trace on warnings and fatal error.
|
2007-09-10 17:52:57 +02:00
|
|
|
# --refresh=<chainlist> # Make the 'refresh' command refresh a comma-separated list of chains rather than 'blacklst'.
|
2007-06-13 20:40:09 +02:00
|
|
|
#
|
2007-03-08 05:38:37 +01:00
|
|
|
use strict;
|
2007-08-10 19:37:02 +02:00
|
|
|
use FindBin;
|
|
|
|
use lib "$FindBin::Bin";
|
2007-06-13 15:28:15 +02:00
|
|
|
use Shorewall::Compiler;
|
2007-06-11 20:07:34 +02:00
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
sub usage() {
|
2007-11-12 22:39:22 +01:00
|
|
|
print STDERR "usage: compiler.pl [ --export ] [ --directory=<directory> ] [ --verbose={0-2} ] [ --timestamp ] [ -- debug ] [ --refresh=<chainlist> ] [ <filename> ]\n";
|
2007-06-11 20:07:34 +02:00
|
|
|
exit 1;
|
|
|
|
}
|
2007-06-12 16:32:42 +02:00
|
|
|
|
2007-06-11 23:42:58 +02:00
|
|
|
#
|
2007-06-13 20:40:09 +02:00
|
|
|
# E x e c u t i o n B e g i n s H e r e
|
2007-06-11 23:42:58 +02:00
|
|
|
#
|
2007-07-08 17:58:13 +02:00
|
|
|
my $export = 0;
|
|
|
|
my $shorewall_dir = '';
|
|
|
|
my $verbose = 0;
|
|
|
|
my $timestamp = '';
|
2007-06-23 23:12:48 +02:00
|
|
|
my $debug = 0;
|
2007-09-10 17:52:57 +02:00
|
|
|
my $chains = '';
|
2007-06-11 20:32:47 +02:00
|
|
|
|
2007-06-12 16:32:42 +02:00
|
|
|
Getopt::Long::Configure ('bundling');
|
2007-06-11 20:07:34 +02:00
|
|
|
|
2007-06-12 01:17:02 +02:00
|
|
|
my $result = GetOptions('export' => \$export,
|
|
|
|
'e' => \$export,
|
|
|
|
'directory=s' => \$shorewall_dir,
|
|
|
|
'd=s' => \$shorewall_dir,
|
|
|
|
'verbose=i' => \$verbose,
|
|
|
|
'v=i' => \$verbose,
|
|
|
|
'timestamp' => \$timestamp,
|
2007-06-23 23:12:48 +02:00
|
|
|
't' => \$timestamp,
|
2007-09-10 17:52:57 +02:00
|
|
|
'debug' => \$debug,
|
|
|
|
'r=s' => \$chains,
|
|
|
|
'refresh=s' => \$chains
|
2007-06-23 23:12:48 +02:00
|
|
|
);
|
2007-06-11 20:07:34 +02:00
|
|
|
|
2007-06-12 01:17:02 +02:00
|
|
|
usage unless $result && @ARGV < 2;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-06-13 15:28:15 +02:00
|
|
|
my $options = 0;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-06-13 15:28:15 +02:00
|
|
|
$options |= EXPORT if $export;
|
|
|
|
$options |= TIMESTAMP if $timestamp;
|
2007-06-23 23:12:48 +02:00
|
|
|
$options |= DEBUG if $debug;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-09-10 17:52:57 +02:00
|
|
|
compiler $ARGV[0], $shorewall_dir, $verbose, $options, $chains;
|