#!/usr/bin/perl # # fwctl: program to configure the linux firewall. # # This file is part of Fwctl. # # Author: Francis J. Lacoste # # Copyright (c) 1999,2000 iNsu Innovations Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # use strict; use Fwctl; use Getopt::Long; use Data::Dumper; sub usage() { die <configure; last ARGS; }; /stop/ && do { my $fwctl = new Fwctl( %fwopts ); $fwctl->stop; last ARGS; }; /flush/ && do { eval { my $fwctl = new Fwctl( %fwopts ); $fwctl->flush_chains; }; if ( $@) { warn "fwctl: problems with configuration file. Current accounting stats will be lost:\n$@"; Fwctl->really_flush_chains; } last ARGS; }; /dump-acct/ && do { my $fwctl = new Fwctl( %fwopts ); $fwctl->dump_acct; last ARGS; }; usage; } __END__ =pod =head1 NAME fwctl - Program to configure the Linux kernel firewall. =head1 SYNOPSIS fwtcl [--aliases file] [ --interfaces file ] [--rules file] [--services-dir dir ]+ [--accounting-file file ] [--copy | --nocopy] [--mark mark] [--log | --nolog] [--default ACCEPT|REJECT|DENY] (start|stop|flush|restart|dump-acct|check|dump-config) =head1 DESCRIPTION fwctl configure the Linux kernel firewall using the Fwctl module. =head2 COMMAND =over =item start Reset and the firewall and configure using the Fwctl module according to the rules of the rules file. =item stop Reset the firewall and allow only loopback IP traffic. =item flush Remove all Chains and Rules =item restart Does the same thing as a B since start already resets the firewall. =item check Parses the configuration files to see if there are any problems with them. =item dump-acct Dump the byte counters associated to accounting rules in the accounting log file. The counters are reset to zero by this operation. Note that the accounting rules are dumped before the firewall is reset, so there is no need to use this command before a B or B. =item dump-config Intended for debugging. The configuration files are parsed and the configuration object is printed on STDOUT using Data::Dumper. =back =head1 OPTIONS =over =item aliases Specifies the path to the F file. Default is F. =item interfaces Specifies the path to the F file. Default is F =item rules Specifies the path to the F file. Default is F =item services-dir Sets the search patch for service modules. The default is to look in I and F. Using this option removes the last directory from the search path and adds the directory specified as option. Note that the default perl module path are always searched. This option may be specified multiple times. =item accounting-file Specifies the path to the accounting file. Default is F. =item [no]log Determines the default logging policy for the firewall. The default is to log all packets which don't match explicitely any rules. =item [no]copy Determines the default copy policy for the firewall. The default is to mark for copy to user space all packets which don't match explicitely any rules. =item mark If this option is set, all packets which don't match explicitely one rule, will be marked with the specified mark. =item policy This sets the default policy for unknown packets. Default is DENY, can be one of ACCEPT, REJECT or DENY. =back =head1 AUTHOR Francis J. Lacoste =head1 COPYRIGHT Copyright (c) 1999, 2000 iNsu Innovations Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 SEE ALSO Fwctl(3) Fwctl::RuleSet(3). =cut