mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 14:20:40 +01:00
Add CHAIN_SCRIPTS option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
a56dcc745d
commit
5ad69aa650
@ -2452,6 +2452,7 @@ sub ensure_accounting_chain( $$$ )
|
||||
$chainref->{ipsec} = $ipsec;
|
||||
$chainref->{optflags} |= ( DONT_OPTIMIZE | DONT_MOVE | DONT_DELETE ) unless $config{OPTIMIZE_ACCOUNTING};
|
||||
|
||||
if ( $config{CHAIN_SCRIPTS} ) {
|
||||
unless ( $chain eq 'accounting' ) {
|
||||
my $file = find_file $chain;
|
||||
|
||||
@ -2468,6 +2469,7 @@ sub ensure_accounting_chain( $$$ )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$chainref;
|
||||
}
|
||||
|
@ -790,6 +790,7 @@ sub initialize( $;$$) {
|
||||
WARNOLDCAPVERSION => undef,
|
||||
DEFER_DNS_RESOLUTION => undef,
|
||||
USE_RT_NAMES => undef,
|
||||
CHAIN_SCRIPTS => undef,
|
||||
#
|
||||
# Packet Disposition
|
||||
#
|
||||
@ -5302,6 +5303,7 @@ sub get_configuration( $$$$ ) {
|
||||
default_yes_no 'AUTOCOMMENT' , 'Yes';
|
||||
default_yes_no 'MULTICAST' , '';
|
||||
default_yes_no 'MARK_IN_FORWARD_CHAIN' , '';
|
||||
default_yes_no 'CHAIN_SCRIPTS' , 'Yes';
|
||||
|
||||
default_yes_no 'MANGLE_ENABLED' , have_capability( 'MANGLE_ENABLED' ) ? 'Yes' : '';
|
||||
default_yes_no 'USE_DEFAULT_RT' , '';
|
||||
@ -5703,7 +5705,7 @@ sub run_user_exit( $ ) {
|
||||
my $chainref = $_[0];
|
||||
my $file = find_file $chainref->{name};
|
||||
|
||||
if ( -f $file ) {
|
||||
if ( $config{CHAIN_SCRIPTS} && -f $file ) {
|
||||
progress_message2 "Running $file...";
|
||||
|
||||
my $command = qq(package Shorewall::User;\nno strict;\n# line 1 "$file"\n) . `cat $file`;
|
||||
@ -5756,7 +5758,7 @@ sub run_user_exit1( $ ) {
|
||||
sub run_user_exit2( $$ ) {
|
||||
my ($file, $chainref) = ( find_file $_[0], $_[1] );
|
||||
|
||||
if ( -f $file ) {
|
||||
if ( $config{CHAIN_SCRIPTS} && -f $file ) {
|
||||
progress_message2 "Running $file...";
|
||||
#
|
||||
# File may be empty -- in which case eval would fail
|
||||
|
@ -1184,6 +1184,7 @@ sub createlogactionchain( $$$$$ ) {
|
||||
|
||||
$chainref->{action} = $normalized;
|
||||
|
||||
if ( $config{CHAIN_SCRIPTS} ) {
|
||||
unless ( $targets{$action} & BUILTIN ) {
|
||||
|
||||
set_optflags( $chainref, DONT_OPTIMIZE );
|
||||
@ -1202,6 +1203,7 @@ sub createlogactionchain( $$$$$ ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$chainref;
|
||||
}
|
||||
@ -1218,6 +1220,7 @@ sub createsimpleactionchain( $ ) {
|
||||
|
||||
$chainref->{action} = $normalized;
|
||||
|
||||
if ( $config{CHAIN_SCRIPTS} ) {
|
||||
unless ( $targets{$action} & BUILTIN ) {
|
||||
|
||||
set_optflags( $chainref, DONT_OPTIMIZE );
|
||||
@ -1236,6 +1239,7 @@ sub createsimpleactionchain( $ ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$chainref;
|
||||
}
|
||||
|
@ -130,6 +130,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -141,6 +141,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -139,6 +139,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=Yes
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -142,6 +142,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=Yes
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -130,6 +130,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=Yes
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -466,6 +466,22 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">CHAIN_SCRIPTS=</emphasis>{<emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.5.16. Prior to the availability of BEGIN
|
||||
PERL....END PERL in configuration files, the only way to execute a
|
||||
chain-specific script was to create a script file with the same name
|
||||
as the chain and place it in a directory on the CONFIG_PATH. That
|
||||
facility has the drawback that the compiler will attempt to run a
|
||||
non-script file just because it has the same name as a chain. To
|
||||
disable this facility, set CHAIN_SCRIPTS=No. If not specified or
|
||||
specified as the empty value, CHAIN_SCRIPTS=Yes is assumed. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">CLAMPMSS=[</emphasis><emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis
|
||||
|
@ -123,6 +123,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -123,6 +123,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -123,6 +123,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -123,6 +123,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=No
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
|
@ -123,6 +123,8 @@ AUTOMAKE=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=Yes
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=No
|
||||
|
@ -396,6 +396,22 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">CHAIN_SCRIPTS=</emphasis>{<emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.5.16. Prior to the availability of BEGIN
|
||||
PERL....END PERL in configuration files, the only way to execute a
|
||||
chain-specific script was to create a script file with the same name
|
||||
as the chain and place it in a directory on the CONFIG_PATH. That
|
||||
facility has the drawback that the compiler will attempt to run a
|
||||
non-script file just because it has the same name as a chain. To
|
||||
disable this facility, set CHAIN_SCRIPTS=No. If not specified or
|
||||
specified as the empty value, CHAIN_SCRIPTS=Yes is assumed.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">CLAMPMSS=[</emphasis><emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis
|
||||
|
Loading…
Reference in New Issue
Block a user