mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-21 10:18:58 +02:00
Replace keyword 'object' with 'script'
This commit is contained in:
parent
fe3b8be029
commit
80f41779f8
@ -545,7 +545,8 @@ sub compiler {
|
|||||||
defined($val) && ($val == F_IPV4 || $val == F_IPV6);
|
defined($val) && ($val == F_IPV4 || $val == F_IPV6);
|
||||||
}
|
}
|
||||||
|
|
||||||
my %parms = ( object => { store => \$scriptfilename },
|
my %parms = ( object => { store => \$scriptfilename }, #Deprecated
|
||||||
|
script => { store => \$scriptfilename },
|
||||||
directory => { store => \$directory },
|
directory => { store => \$directory },
|
||||||
family => { store => \$family , validate => \&validate_family } ,
|
family => { store => \$family , validate => \&validate_family } ,
|
||||||
verbosity => { store => \$verbosity , validate => \&validate_verbosity } ,
|
verbosity => { store => \$verbosity , validate => \&validate_verbosity } ,
|
||||||
|
@ -61,7 +61,7 @@ sub usage( $ ) {
|
|||||||
[ --family={4|6} ]
|
[ --family={4|6} ]
|
||||||
';
|
';
|
||||||
|
|
||||||
$returnval;
|
exit $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -105,7 +105,7 @@ my $result = GetOptions('h' => \$help,
|
|||||||
usage(1) unless $result && @ARGV < 2;
|
usage(1) unless $result && @ARGV < 2;
|
||||||
usage(0) if $help;
|
usage(0) if $help;
|
||||||
|
|
||||||
compiler( object => defined $ARGV[0] ? $ARGV[0] : '',
|
compiler( script => defined $ARGV[0] ? $ARGV[0] : '',
|
||||||
directory => $shorewall_dir,
|
directory => $shorewall_dir,
|
||||||
verbosity => $verbose,
|
verbosity => $verbose,
|
||||||
timestamp => $timestamp,
|
timestamp => $timestamp,
|
||||||
|
@ -670,15 +670,15 @@ DNAT- net 192.168.1.3 tcp 21</programl
|
|||||||
<section id="Modules">
|
<section id="Modules">
|
||||||
<title>The Shorewall Perl Modules</title>
|
<title>The Shorewall Perl Modules</title>
|
||||||
|
|
||||||
<para>Shorewall's Perl modules are installed in
|
<para>In Shorewall 4.4 and later, Shorewall's Perl modules are installed
|
||||||
/usr/share/shorewall-perl/Shorewall and the names of the packages are of
|
in /usr/share/shorewall/Shorewall and the names of the packages are of the
|
||||||
the form Shorewall::<firstterm>name</firstterm>. So by using this
|
form Shorewall::<firstterm>name</firstterm>. So by using this
|
||||||
directive<programlisting>use lib '/usr/share/shorewall-perl';</programlisting></para>
|
directive<programlisting>use lib '/usr/share/shorewall';</programlisting></para>
|
||||||
|
|
||||||
<para>You can then load the modules via normal Perl use statements.</para>
|
<para>You can then load the modules via normal Perl use statements.</para>
|
||||||
|
|
||||||
<section id="compiler.pl">
|
<section id="compiler.pl">
|
||||||
<title>/usr/share/shorewall-perl/compiler.pl</title>
|
<title>/usr/share/shorewall/compiler.pl</title>
|
||||||
|
|
||||||
<para>While the compiler is normally run indirectly using
|
<para>While the compiler is normally run indirectly using
|
||||||
/sbin/shorewall, it can be run directly as well.<programlisting><command>compiler.pl</command> [ <emphasis>option</emphasis> ... ] [ <emphasis>filename</emphasis> ]</programlisting></para>
|
/sbin/shorewall, it can be run directly as well.<programlisting><command>compiler.pl</command> [ <emphasis>option</emphasis> ... ] [ <emphasis>filename</emphasis> ]</programlisting></para>
|
||||||
@ -734,25 +734,25 @@ DNAT- net 192.168.1.3 tcp 21</programl
|
|||||||
role="bold">--log</emphasis>=<logfile></member>
|
role="bold">--log</emphasis>=<logfile></member>
|
||||||
</simplelist></para>
|
</simplelist></para>
|
||||||
|
|
||||||
<para>Added in Shorewall 4.2. If given, compiler will log to this file
|
<para>If given, compiler will log to this file provider that
|
||||||
provider that --log_verbosity is > -1.<simplelist>
|
--log_verbosity is > -1.<simplelist>
|
||||||
<member><emphasis
|
<member><emphasis
|
||||||
role="bold">--log_verbosity</emphasis>=-1|0|1|2</member>
|
role="bold">--log_verbosity</emphasis>=-1|0|1|2</member>
|
||||||
</simplelist></para>
|
</simplelist></para>
|
||||||
|
|
||||||
<para>Added in Shorewall 4.1. If given, controls the verbosity of
|
<para>If given, controls the verbosity of logging to the log specified
|
||||||
logging to the log specified by the --log parameter.</para>
|
by the --log parameter.</para>
|
||||||
|
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member><emphasis role="bold">--family=</emphasis>4|6</member>
|
<member><emphasis role="bold">--family=</emphasis>4|6</member>
|
||||||
</simplelist>
|
</simplelist>
|
||||||
|
|
||||||
<para>Added in Shorewall 4.2.4. Specifies whether an IPv4 or an IPv6
|
<para>Specifies whether an IPv4 or an IPv6 firewall is to be
|
||||||
firewall is to be created.</para>
|
created.</para>
|
||||||
|
|
||||||
<para>Example (compiles the configuration in the current directory
|
<para>Example (compiles the configuration in the current directory
|
||||||
generating a script named 'firewall' and using VERBOSITY
|
generating a script named 'firewall' and using VERBOSITY
|
||||||
2).<programlisting><emphasis role="bold">/usr/share/shorewall-perl/compiler.pl -v 2 -d . firewall</emphasis></programlisting><note>
|
2).<programlisting><emphasis role="bold">/usr/share/shorewall/compiler.pl -v 2 -d . firewall</emphasis></programlisting><note>
|
||||||
<para>The Perl-based compiler does not process
|
<para>The Perl-based compiler does not process
|
||||||
<filename>/etc/shorewall/params</filename>. To include definitions
|
<filename>/etc/shorewall/params</filename>. To include definitions
|
||||||
in that file, you would need to do something like the
|
in that file, you would need to do something like the
|
||||||
@ -760,103 +760,24 @@ DNAT- net 192.168.1.3 tcp 21</programl
|
|||||||
set -a # Export all variables set in /etc/shorewall/params
|
set -a # Export all variables set in /etc/shorewall/params
|
||||||
. /etc/shorewall/params
|
. /etc/shorewall/params
|
||||||
set +a
|
set +a
|
||||||
/usr/share/shorewall-perl/compiler.pl ...</command></programlisting></para>
|
/usr/share/compiler.pl ...</command></programlisting></para>
|
||||||
</note></para>
|
</note></para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Compiler">
|
<section id="Compiler">
|
||||||
<title>Shorewall::Compiler</title>
|
<title>Shorewall::Compiler</title>
|
||||||
|
|
||||||
<section id="Compiler-4.0">
|
|
||||||
<title>Shorewall 4.0</title>
|
|
||||||
|
|
||||||
<para><programlisting> use lib '/usr/share/shorewall-perl';
|
|
||||||
use Shorewall::Compiler;
|
|
||||||
|
|
||||||
compiler $filename, $directory, $verbose, $options $chains</programlisting>Arguments
|
|
||||||
to the compiler are:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>$filename</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Name of the compiled script to be created. If the
|
|
||||||
arguments evaluates to false, the configuration is syntax
|
|
||||||
checked.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>$directory</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The directory containing the configuration. If passed as
|
|
||||||
'', then <filename class="directory">/etc/shorewall/</filename>
|
|
||||||
is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>$verbose</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The verbosity level that the compiler will run with
|
|
||||||
(0-2).<note>
|
|
||||||
<para>The VERBOSITY setting in the
|
|
||||||
<filename>shorewall.conf</filename> file read by the
|
|
||||||
compiler will determine the default verbosity for the
|
|
||||||
compiled program.</para>
|
|
||||||
</note></para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>$options</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>A bitmap of options. Shorewall::Compiler exports three
|
|
||||||
constants to help building this argument:<simplelist>
|
|
||||||
<member>EXPORT = 0x01</member>
|
|
||||||
|
|
||||||
<member>TIMESTAMP = 0x02</member>
|
|
||||||
|
|
||||||
<member>DEBUG = 0x04</member>
|
|
||||||
</simplelist></para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>$chains</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>A comma-separated list of chains that the generated
|
|
||||||
script's 'refresh' command will reload. If passed as an empty
|
|
||||||
string, then 'blacklist' is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>The compiler raises an exception with 'die' if it encounters an
|
|
||||||
error; $@ contains the 'ERROR' messages describing the problem. The
|
|
||||||
compiler function can be called repeatedly with different
|
|
||||||
inputs.</para>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<title>Shorewall 4.2 and Later</title>
|
|
||||||
|
|
||||||
<para>To avoid a proliferation of parameters to
|
<para>To avoid a proliferation of parameters to
|
||||||
Shorewall::Compiler::compile(), that function has been changed to use
|
Shorewall::Compiler::compile(), that function uses named parameters.
|
||||||
named parameters. Parameter names are:</para>
|
Parameter names are:</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>object</term>
|
<term>script ('object' is also accepted but deprecated)</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Object file. If omitted or '', the configuration is syntax
|
<para>Output script file. If omitted or '', the configuration is
|
||||||
checked.</para>
|
syntax checked.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -864,9 +785,9 @@ set +a
|
|||||||
<term>directory</term>
|
<term>directory</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Directory. If omitted or '', configuration files are
|
<para>Directory. If omitted or '', configuration files are located
|
||||||
located using CONFIG_PATH. Otherwise, the directory named by
|
using CONFIG_PATH. Otherwise, the directory named by this
|
||||||
this parameter is searched first.</para>
|
parameter is searched first.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -890,8 +811,7 @@ set +a
|
|||||||
<term>debug</term>
|
<term>debug</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>0|1 -- include stack trace in warning/error
|
<para>0|1 -- include stack trace in warning/error messages.</para>
|
||||||
messages.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -938,7 +858,7 @@ set +a
|
|||||||
|
|
||||||
<para>Those parameters that are supplied must have defined values.
|
<para>Those parameters that are supplied must have defined values.
|
||||||
Defaults are: <simplelist>
|
Defaults are: <simplelist>
|
||||||
<member>object '' ('check' command)</member>
|
<member>script '' ('check' command)</member>
|
||||||
|
|
||||||
<member>directory ''</member>
|
<member>directory ''</member>
|
||||||
|
|
||||||
@ -959,17 +879,16 @@ set +a
|
|||||||
<member>family 4</member>
|
<member>family 4</member>
|
||||||
</simplelist></para>
|
</simplelist></para>
|
||||||
|
|
||||||
<para>Example: <programlisting>use lib '/usr/share/shorewall-perl/';
|
<para>Example: <programlisting>use lib '/usr/share/shorewall/';
|
||||||
use Shorewall::Compiler;
|
use Shorewall::Compiler;
|
||||||
|
|
||||||
compiler( object => '/root/firewall', log => '/root/compile.log', log_verbosity => 2 ); </programlisting></para>
|
compiler( script => '/root/firewall', log => '/root/compile.log', log_verbosity => 2 ); </programlisting></para>
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Chains">
|
<section id="Chains">
|
||||||
<title>Shorewall::Chains</title>
|
<title>Shorewall::Chains</title>
|
||||||
|
|
||||||
<para><programlisting>use lib '/usr/share/shorewall-perl';
|
<para><programlisting>use lib '/usr/share/shorewall';
|
||||||
use Shorewall::Chains;
|
use Shorewall::Chains;
|
||||||
|
|
||||||
my $chainref1 = chain_new $table, $name1;
|
my $chainref1 = chain_new $table, $name1;
|
||||||
@ -1208,7 +1127,7 @@ my $chainref7 = $filter_table{$name};</programlisting>Shorewall::Chains is
|
|||||||
<section id="Config">
|
<section id="Config">
|
||||||
<title>Shorewall::Config</title>
|
<title>Shorewall::Config</title>
|
||||||
|
|
||||||
<para><programlisting>use lib '/usr/share/shorewall-perl';
|
<para><programlisting>use lib '/usr/share/shorewall';
|
||||||
use Shorewall::Config;
|
use Shorewall::Config;
|
||||||
|
|
||||||
warning message "This entry is bogus";
|
warning message "This entry is bogus";
|
||||||
@ -1218,7 +1137,7 @@ progress_message "This will only be seen if VERBOSITY >= 2";
|
|||||||
progress_message2 "This will only be seen if VERBOSITY >= 1";
|
progress_message2 "This will only be seen if VERBOSITY >= 1";
|
||||||
progress_message3 "This will be seen unless VERBOSITY < 0";
|
progress_message3 "This will be seen unless VERBOSITY < 0";
|
||||||
</programlisting>The <emphasis role="bold">shorewall()</emphasis> function may
|
</programlisting>The <emphasis role="bold">shorewall()</emphasis> function may
|
||||||
be optionally included:<programlisting>use lib '/usr/share/shorewall-perl';
|
be optionally included:<programlisting>use lib '/usr/share/shorewall';
|
||||||
use Shorewall::Config qw/shorewall/;
|
use Shorewall::Config qw/shorewall/;
|
||||||
|
|
||||||
shorewall $config_file_entry;</programlisting>The Shorewall::Config module
|
shorewall $config_file_entry;</programlisting>The Shorewall::Config module
|
||||||
|
Loading…
x
Reference in New Issue
Block a user