forked from extern/shorewall_code
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cae7c5d300 | ||
|
bba851117a | ||
|
91702f094d | ||
|
49c94bc5ec |
3
Shorewall-core/configure
vendored
3
Shorewall-core/configure
vendored
@@ -235,8 +235,7 @@ for on in \
|
|||||||
SPARSE \
|
SPARSE \
|
||||||
ANNOTATED \
|
ANNOTATED \
|
||||||
VARLIB \
|
VARLIB \
|
||||||
VARDIR \
|
VARDIR
|
||||||
DEFAULT_PAGER
|
|
||||||
do
|
do
|
||||||
echo "$on=${options[${on}]}"
|
echo "$on=${options[${on}]}"
|
||||||
echo "$on=${options[${on}]}" >> shorewallrc
|
echo "$on=${options[${on}]}" >> shorewallrc
|
||||||
|
@@ -209,8 +209,7 @@ for ( qw/ HOST
|
|||||||
SPARSE
|
SPARSE
|
||||||
ANNOTATED
|
ANNOTATED
|
||||||
VARLIB
|
VARLIB
|
||||||
VARDIR
|
VARDIR / ) {
|
||||||
DEFAULT_PAGER / ) {
|
|
||||||
|
|
||||||
my $val = $options{$_} || '';
|
my $val = $options{$_} || '';
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -712,9 +712,9 @@ find_file()
|
|||||||
set_state () # $1 = state
|
set_state () # $1 = state
|
||||||
{
|
{
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
echo "$1 $(date) from $2" > ${VARDIR}/state
|
echo "$1 ($(date)) from $2" > ${VARDIR}/state
|
||||||
else
|
else
|
||||||
echo "$1 $(date)" > ${VARDIR}/state
|
echo "$1 ($(date))" > ${VARDIR}/state
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,7 +776,7 @@ mutex_on()
|
|||||||
error_message "WARNING: Stale lockfile ${lockf} removed"
|
error_message "WARNING: Stale lockfile ${lockf} removed"
|
||||||
elif [ $lockpid -eq $$ ]; then
|
elif [ $lockpid -eq $$ ]; then
|
||||||
return 0
|
return 0
|
||||||
elif ! ps | grep -v grep | qt grep ${lockpid}; then
|
elif ! qt ps p ${lockpid}; then
|
||||||
rm -f ${lockf}
|
rm -f ${lockf}
|
||||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||||
fi
|
fi
|
||||||
@@ -788,8 +788,10 @@ mutex_on()
|
|||||||
echo $$ > ${lockf}
|
echo $$ > ${lockf}
|
||||||
chmod u-w ${lockf}
|
chmod u-w ${lockf}
|
||||||
elif qt mywhich lock; then
|
elif qt mywhich lock; then
|
||||||
lock ${lockf}
|
lock -${MUTEX_TIMEOUT} -r1 ${lockf}
|
||||||
chmod u=r ${lockf}
|
chmod u+w ${lockf}
|
||||||
|
echo $$ > ${lockf}
|
||||||
|
chmod u-w ${lockf}
|
||||||
else
|
else
|
||||||
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -811,7 +813,6 @@ mutex_on()
|
|||||||
#
|
#
|
||||||
mutex_off()
|
mutex_off()
|
||||||
{
|
{
|
||||||
[ -f ${CONFDIR}/rc.common ] && lock -u ${LOCKFILE:=${VARDIR}/lock}
|
|
||||||
rm -f ${LOCKFILE:=${VARDIR}/lock}
|
rm -f ${LOCKFILE:=${VARDIR}/lock}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,4 +19,3 @@ SERVICEFILE= #Unused on OS X
|
|||||||
SYSCONFDIR= #Unused on OS X
|
SYSCONFDIR= #Unused on OS X
|
||||||
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
||||||
VARLIB=/var/lib #Unused on OS X
|
VARLIB=/var/lib #Unused on OS X
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -20,4 +20,3 @@ SERVICEFILE= #Name of the file to install in $SYSTEMD.
|
|||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -19,4 +19,3 @@ SERVICEFILE= #Unused on Cygwin
|
|||||||
SYSCONFDIR= #Unused on Cygwin
|
SYSCONFDIR= #Unused on Cygwin
|
||||||
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
||||||
VARLIB=/var/lib #Unused on Cygwin
|
VARLIB=/var/lib #Unused on Cygwin
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -21,4 +21,3 @@ SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (s
|
|||||||
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER=/usr/bin/less #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -21,4 +21,3 @@ SERVICEDIR= #Directory where .service files are installed (systems running sy
|
|||||||
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER=/usr/bin/less #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -21,4 +21,3 @@ SYSCONFDIR= #Directory where SysV init parameter fil
|
|||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -21,4 +21,3 @@ SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.se
|
|||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/lib #Directory where product variable data is stored.
|
VARLIB=/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -21,4 +21,3 @@ SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter fil
|
|||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -22,4 +22,3 @@ SYSCONFDIR= #Name of the directory where SysV ini
|
|||||||
ANNOTATED= #If non-empty, install annotated configuration files
|
ANNOTATED= #If non-empty, install annotated configuration files
|
||||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -7,18 +7,17 @@ PREFIX=/usr #Top-level directory for s
|
|||||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||||
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
|
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
|
||||||
PERLLIBDIR=${PREFIX}/lib/perl5/site-perl #Directory to install Shorewall Perl module directory
|
PERLLIBDIR=${PREFIX}/lib/perl5/vendor_perl/5.14.2 #Directory to install Shorewall Perl module directory
|
||||||
SBINDIR=/usr/sbin #Directory where system administration programs are installed
|
SBINDIR=/usr/sbin #Directory where system administration programs are installed
|
||||||
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
|
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
|
||||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
||||||
INITFILE= #Name of the product's SysV init script
|
INITFILE=$PRODUCT #Name of the product's SysV init script
|
||||||
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
|
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
|
||||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||||
SERVICEDIR=/usr/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
|
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
|
||||||
SERVICEFILE=$PRODUCT.service #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
||||||
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
|
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
|
||||||
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
VARLIB=/var/lib #Directory where persistent product data is stored.
|
VARLIB=/var/lib #Directory where persistent product data is stored.
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
||||||
DEFAULT_PAGER= #Pager to use if none specified in shorewall[6].conf
|
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
# Required-Stop: $local_fs
|
# Required-Stop: $local_fs
|
||||||
# X-Stop-After: $network
|
# X-Stop-After: $network
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 6
|
||||||
# Short-Description: Initialize the firewall at boot time
|
# Short-Description: Initialize the firewall at boot time
|
||||||
# Description: Place the firewall in a safe state at boot time prior to
|
# Description: Place the firewall in a safe state at boot time prior to
|
||||||
# bringing up the network
|
# bringing up the network
|
||||||
|
@@ -412,7 +412,7 @@ if [ $HOST = debian ]; then
|
|||||||
|
|
||||||
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
|
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
|
||||||
if [ -n "${DESTDIR}" ]; then
|
if [ -n "${DESTDIR}" ]; then
|
||||||
mkdir -p ${DESTDIR}${ETC}/default
|
mkdir ${DESTDIR}${ETC}/default
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
|
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
|
||||||
@@ -585,7 +585,7 @@ if [ -z "$DESTDIR" ]; then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ $configure -eq 1 -a -n "$first_install" ]; then
|
if [ $configure -eq 1 -a -n "$first_install" ]; then
|
||||||
if [ $HOST = debian -a -z "$SERVICEDIR" ]; then
|
if [ $HOST = debian ]; then
|
||||||
if [ -n "${DESTDIR}" ]; then
|
if [ -n "${DESTDIR}" ]; then
|
||||||
mkdir -p ${DESTDIR}/etc/rcS.d
|
mkdir -p ${DESTDIR}/etc/rcS.d
|
||||||
fi
|
fi
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall-lite
|
# /etc/shorewall-lite
|
||||||
@@ -92,11 +92,10 @@ shorewall_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
|
echo -n "Stopping \"Shorewall firewall\": "
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
echo -n "Stopping \"Shorewall Lite firewall\": "
|
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
echo -n "Clearing all \"Shorewall Lite firewall\" rules: "
|
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -550,7 +550,7 @@ if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PR
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
|
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
|
||||||
echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${SHAREDIR} != /usr/share ]; then
|
if [ ${SHAREDIR} != /usr/share ]; then
|
||||||
|
@@ -702,9 +702,7 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
role="bold">logreject</emphasis> command.</para>
|
||||||
5.0.10, this command can also re-enable addresses blacklisted using
|
|
||||||
the <command>blacklist</command> command.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -724,23 +722,6 @@
|
|||||||
<replaceable>address</replaceable> along with any
|
<replaceable>address</replaceable> along with any
|
||||||
<replaceable>option</replaceable>s are passed to the <command>ipset
|
<replaceable>option</replaceable>s are passed to the <command>ipset
|
||||||
add</command> command.</para>
|
add</command> command.</para>
|
||||||
|
|
||||||
<para>If the <option>disconnect</option> option is specified in the
|
|
||||||
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
|
|
||||||
determines the amount of information displayed:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 0, then a message
|
|
||||||
giving the number of conntrack flows deleted by the command is
|
|
||||||
displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 1, then the conntrack
|
|
||||||
table entries deleted by the command are also displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -244,7 +244,7 @@ sub create_arptables_load( $ ) {
|
|||||||
|
|
||||||
emit "exec 3>\${VARDIR}/.arptables-input";
|
emit "exec 3>\${VARDIR}/.arptables-input";
|
||||||
|
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
unless ( $test ) {
|
unless ( $test ) {
|
||||||
emit_unindented '#';
|
emit_unindented '#';
|
||||||
@@ -294,7 +294,7 @@ sub create_arptables_load( $ ) {
|
|||||||
#
|
#
|
||||||
sub preview_arptables_load() {
|
sub preview_arptables_load() {
|
||||||
|
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";
|
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";
|
||||||
|
|
||||||
|
@@ -266,12 +266,10 @@ our %EXPORT_TAGS = (
|
|||||||
set_chain_variables
|
set_chain_variables
|
||||||
mark_firewall_not_started
|
mark_firewall_not_started
|
||||||
mark_firewall6_not_started
|
mark_firewall6_not_started
|
||||||
interface_address
|
|
||||||
get_interface_address
|
get_interface_address
|
||||||
get_interface_addresses
|
get_interface_addresses
|
||||||
get_interface_bcasts
|
get_interface_bcasts
|
||||||
get_interface_acasts
|
get_interface_acasts
|
||||||
interface_gateway
|
|
||||||
get_interface_gateway
|
get_interface_gateway
|
||||||
get_interface_mac
|
get_interface_mac
|
||||||
have_global_variables
|
have_global_variables
|
||||||
@@ -339,7 +337,7 @@ our $VERSION = 'MODULEVERSION';
|
|||||||
# digest => SHA1 digest of the string representation of the chain's rules for use in optimization
|
# digest => SHA1 digest of the string representation of the chain's rules for use in optimization
|
||||||
# level 8.
|
# level 8.
|
||||||
# complete => The last rule in the chain is a -g or a simple -j to a terminating target
|
# complete => The last rule in the chain is a -g or a simple -j to a terminating target
|
||||||
# Suppresses adding additional rules to the end of the chain
|
# Suppresses adding additional rules to the chain end of the chain
|
||||||
# sections => { <section> = 1, ... } - Records sections that have been completed.
|
# sections => { <section> = 1, ... } - Records sections that have been completed.
|
||||||
# chainnumber => Numeric enumeration of the builtin chains (mangle table only).
|
# chainnumber => Numeric enumeration of the builtin chains (mangle table only).
|
||||||
# allowedchains
|
# allowedchains
|
||||||
@@ -810,6 +808,7 @@ sub initialize( $$$ ) {
|
|||||||
DNAT => 1,
|
DNAT => 1,
|
||||||
MASQUERADE => 1,
|
MASQUERADE => 1,
|
||||||
NETMAP => 1,
|
NETMAP => 1,
|
||||||
|
NFQUEUE => 1,
|
||||||
NOTRACK => 1,
|
NOTRACK => 1,
|
||||||
RAWDNAT => 1,
|
RAWDNAT => 1,
|
||||||
REDIRECT => 1,
|
REDIRECT => 1,
|
||||||
@@ -1217,7 +1216,6 @@ sub merge_rules( $$$ ) {
|
|||||||
if ( exists $fromref->{$option} ) {
|
if ( exists $fromref->{$option} ) {
|
||||||
push( @{$toref->{matches}}, $option ) unless exists $toref->{$option};
|
push( @{$toref->{matches}}, $option ) unless exists $toref->{$option};
|
||||||
$toref->{$option} = $fromref->{$option};
|
$toref->{$option} = $fromref->{$option};
|
||||||
$toref->{simple} = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1339,14 +1337,7 @@ sub push_rule( $$ ) {
|
|||||||
push @{$chainref->{rules}}, $ruleref;
|
push @{$chainref->{rules}}, $ruleref;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
||||||
|
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1] $ruleref->{comment}" ) if $debug;
|
||||||
if ( $debug ) {
|
|
||||||
if ( $ruleref->{comment} ) {
|
|
||||||
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1] -m comment --comment \"$ruleref->{comment}\"" );
|
|
||||||
} else {
|
|
||||||
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1]" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$chainref->{complete} = 1 if $complete;
|
$chainref->{complete} = 1 if $complete;
|
||||||
|
|
||||||
@@ -2749,13 +2740,11 @@ sub accounting_chainrefs() {
|
|||||||
grep $_->{accounting} , values %$filter_table;
|
grep $_->{accounting} , values %$filter_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ensure_mangle_chain($;$$) {
|
sub ensure_mangle_chain($) {
|
||||||
my ( $chain, $number, $restriction ) = @_;
|
my $chain = $_[0];
|
||||||
|
|
||||||
my $chainref = ensure_chain 'mangle', $chain;
|
my $chainref = ensure_chain 'mangle', $chain;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
$chainref->{chainnumber} = $number if $number;
|
|
||||||
$chainref->{restriction} = $restriction if $restriction;
|
|
||||||
$chainref;
|
$chainref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2939,13 +2928,13 @@ sub initialize_chain_table($) {
|
|||||||
# As new targets (Actions, Macros and Manual Chains) are discovered, they are added to the table
|
# As new targets (Actions, Macros and Manual Chains) are discovered, they are added to the table
|
||||||
#
|
#
|
||||||
%targets = ('ACCEPT' => STANDARD,
|
%targets = ('ACCEPT' => STANDARD,
|
||||||
'ACCEPT+' => STANDARD + NONAT,
|
'ACCEPT+' => STANDARD + NONAT,
|
||||||
'ACCEPT!' => STANDARD,
|
'ACCEPT!' => STANDARD,
|
||||||
'ADD' => STANDARD + SET,
|
'ADD' => STANDARD + SET,
|
||||||
'AUDIT' => STANDARD + AUDIT + OPTIONS,
|
'AUDIT' => STANDARD + AUDIT + OPTIONS,
|
||||||
'A_ACCEPT' => STANDARD + AUDIT,
|
'A_ACCEPT' => STANDARD + AUDIT,
|
||||||
'A_ACCEPT+' => STANDARD + NONAT + AUDIT,
|
'A_ACCEPT+' => STANDARD + NONAT + AUDIT,
|
||||||
'A_ACCEPT!' => STANDARD + AUDIT,
|
'A_ACCEPT!' => STANDARD + AUDIT,
|
||||||
'A_DROP' => STANDARD + AUDIT,
|
'A_DROP' => STANDARD + AUDIT,
|
||||||
'A_DROP!' => STANDARD + AUDIT,
|
'A_DROP!' => STANDARD + AUDIT,
|
||||||
'NONAT' => STANDARD + NONAT + NATONLY,
|
'NONAT' => STANDARD + NONAT + NATONLY,
|
||||||
@@ -3005,13 +2994,13 @@ sub initialize_chain_table($) {
|
|||||||
# As new targets (Actions, Macros and Manual Chains) are discovered, they are added to the table
|
# As new targets (Actions, Macros and Manual Chains) are discovered, they are added to the table
|
||||||
#
|
#
|
||||||
%targets = ('ACCEPT' => STANDARD,
|
%targets = ('ACCEPT' => STANDARD,
|
||||||
'ACCEPT+' => STANDARD + NONAT,
|
'ACCEPT+' => STANDARD + NONAT,
|
||||||
'ACCEPT!' => STANDARD,
|
'ACCEPT!' => STANDARD,
|
||||||
'A_ACCEPT+' => STANDARD + NONAT + AUDIT,
|
'A_ACCEPT+' => STANDARD + NONAT + AUDIT,
|
||||||
'A_ACCEPT!' => STANDARD + AUDIT,
|
'A_ACCEPT!' => STANDARD + AUDIT,
|
||||||
'AUDIT' => STANDARD + AUDIT + OPTIONS,
|
'AUDIT' => STANDARD + AUDIT + OPTIONS,
|
||||||
'A_ACCEPT' => STANDARD + AUDIT,
|
'A_ACCEPT' => STANDARD + AUDIT,
|
||||||
'NONAT' => STANDARD + NONAT + NATONLY,
|
'NONAT' => STANDARD + NONAT + NATONLY,
|
||||||
'DROP' => STANDARD,
|
'DROP' => STANDARD,
|
||||||
'DROP!' => STANDARD,
|
'DROP!' => STANDARD,
|
||||||
'A_DROP' => STANDARD + AUDIT,
|
'A_DROP' => STANDARD + AUDIT,
|
||||||
@@ -3190,17 +3179,17 @@ sub delete_references( $ ) {
|
|||||||
#
|
#
|
||||||
sub calculate_digest( $ ) {
|
sub calculate_digest( $ ) {
|
||||||
my $chainref = shift;
|
my $chainref = shift;
|
||||||
my $rules = '';
|
my $digest = '';
|
||||||
|
|
||||||
for ( @{$chainref->{rules}} ) {
|
for ( @{$chainref->{rules}} ) {
|
||||||
if ( $rules ) {
|
if ( $digest ) {
|
||||||
$rules .= ' |' . format_rule( $chainref, $_, 1 );
|
$digest .= ' |' . format_rule( $chainref, $_, 1 );
|
||||||
} else {
|
} else {
|
||||||
$rules = format_rule( $chainref, $_, 1 );
|
$digest = format_rule( $chainref, $_, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chainref->{digest} = sha1_hex $rules;
|
$chainref->{digest} = sha1_hex $digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3489,7 +3478,7 @@ sub optimize_level4( $$ ) {
|
|||||||
$progress = 1;
|
$progress = 1;
|
||||||
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) {
|
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) {
|
||||||
#
|
#
|
||||||
# This case requires a new rule merging algorithm. Ignore this chain from
|
# This case requires a new rule merging algorithm. Ignore this chain for
|
||||||
# now on.
|
# now on.
|
||||||
#
|
#
|
||||||
$chainref->{optflags} |= DONT_OPTIMIZE;
|
$chainref->{optflags} |= DONT_OPTIMIZE;
|
||||||
@@ -3497,7 +3486,7 @@ sub optimize_level4( $$ ) {
|
|||||||
#
|
#
|
||||||
# Replace references to this chain with the target and add the matches
|
# Replace references to this chain with the target and add the matches
|
||||||
#
|
#
|
||||||
$progress = 1 if replace_references1( $chainref, $firstrule );
|
$progress = 1 if replace_references1 $chainref, $firstrule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -3543,7 +3532,7 @@ sub optimize_level4( $$ ) {
|
|||||||
#empty builtin chain -- change it's policy
|
#empty builtin chain -- change it's policy
|
||||||
#
|
#
|
||||||
$chainref->{policy} = $target;
|
$chainref->{policy} = $target;
|
||||||
trace( $chainref, 'P', undef, $target ) if $debug;
|
trace( $chainref, 'P', undef, 'ACCEPT' ) if $debug;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3697,12 +3686,7 @@ sub optimize_level8( $$$ ) {
|
|||||||
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
||||||
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
replace_references( $chainref1,
|
replace_references $chainref1, $chainref->{name}, undef, '', '', 1;
|
||||||
$chainref->{name},
|
|
||||||
undef, # Target Opts
|
|
||||||
'', # Comment
|
|
||||||
'', # Origin
|
|
||||||
1 ); # Recalculate digests of modified chains
|
|
||||||
|
|
||||||
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
||||||
#
|
#
|
||||||
@@ -4028,7 +4012,7 @@ sub delete_duplicates {
|
|||||||
my $docheck;
|
my $docheck;
|
||||||
my $duplicate = 0;
|
my $duplicate = 0;
|
||||||
|
|
||||||
if ( $baseref->{mode} == CAT_MODE && $baseref->{target} ) {
|
if ( $baseref->{mode} == CAT_MODE ) {
|
||||||
my $ports1;
|
my $ports1;
|
||||||
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
||||||
my $rulenum = @_;
|
my $rulenum = @_;
|
||||||
@@ -5194,7 +5178,7 @@ sub do_time( $ ) {
|
|||||||
$result .= "--monthday $days ";
|
$result .= "--monthday $days ";
|
||||||
} elsif ( $element =~ /^(datestart|datestop)=(\d{4}(-\d{2}(-\d{2}(T\d{1,2}(:\d{1,2}){0,2})?)?)?)$/ ) {
|
} elsif ( $element =~ /^(datestart|datestop)=(\d{4}(-\d{2}(-\d{2}(T\d{1,2}(:\d{1,2}){0,2})?)?)?)$/ ) {
|
||||||
$result .= "--$1 $2 ";
|
$result .= "--$1 $2 ";
|
||||||
} elsif ( $element =~ /^(utc|localtz|kerneltz|contiguous)$/ ) {
|
} elsif ( $element =~ /^(utc|localtz|kerneltz)$/ ) {
|
||||||
$result .= "--$1 ";
|
$result .= "--$1 ";
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Invalid time element ($element)";
|
fatal_error "Invalid time element ($element)";
|
||||||
@@ -5236,8 +5220,6 @@ sub do_user( $ ) {
|
|||||||
|
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
$user = $2;
|
$user = $2;
|
||||||
$user =~ s/:$//;
|
|
||||||
|
|
||||||
if ( $user =~ /^(\d+)(-(\d+))?$/ ) {
|
if ( $user =~ /^(\d+)(-(\d+))?$/ ) {
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
||||||
@@ -5777,12 +5759,12 @@ sub have_ipset_rules() {
|
|||||||
$ipset_rules;
|
$ipset_rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_interface_address( $;$ );
|
sub get_interface_address( $ );
|
||||||
|
|
||||||
sub get_interface_gateway ( $;$$ );
|
sub get_interface_gateway ( $;$ );
|
||||||
|
|
||||||
sub record_runtime_address( $$;$$ ) {
|
sub record_runtime_address( $$;$ ) {
|
||||||
my ( $addrtype, $interface, $protect, $provider ) = @_;
|
my ( $addrtype, $interface, $protect ) = @_;
|
||||||
|
|
||||||
if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
||||||
fatal_error "Mixed required/optional usage of address variable $1" if ( $address_variables{$1} || $addrtype ) ne $addrtype;
|
fatal_error "Mixed required/optional usage of address variable $1" if ( $address_variables{$1} || $addrtype ) ne $addrtype;
|
||||||
@@ -5796,9 +5778,9 @@ sub record_runtime_address( $$;$$ ) {
|
|||||||
my $addr;
|
my $addr;
|
||||||
|
|
||||||
if ( $addrtype eq '&' ) {
|
if ( $addrtype eq '&' ) {
|
||||||
$addr = get_interface_address( $interface, $provider );
|
$addr = get_interface_address( $interface );
|
||||||
} else {
|
} else {
|
||||||
$addr = get_interface_gateway( $interface, $protect, $provider );
|
$addr = get_interface_gateway( $interface, $protect );
|
||||||
}
|
}
|
||||||
|
|
||||||
$addr . ' ';
|
$addr . ' ';
|
||||||
@@ -5823,18 +5805,12 @@ sub conditional_rule( $$ ) {
|
|||||||
if ( $type eq '&' ) {
|
if ( $type eq '&' ) {
|
||||||
$variable = get_interface_address( $interface );
|
$variable = get_interface_address( $interface );
|
||||||
add_commands( $chainref , "if [ $variable != " . NILIP . ' ]; then' );
|
add_commands( $chainref , "if [ $variable != " . NILIP . ' ]; then' );
|
||||||
incr_cmd_level $chainref;
|
|
||||||
} else {
|
} else {
|
||||||
$variable = get_interface_gateway( $interface );
|
$variable = get_interface_gateway( $interface );
|
||||||
|
add_commands( $chainref , qq(if [ -n "$variable" ]; then) );
|
||||||
if ( $variable =~ /^\$/ ) {
|
|
||||||
add_commands( $chainref , qq(if [ -n "$variable" ]; then) );
|
|
||||||
incr_cmd_level $chainref;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
incr_cmd_level $chainref;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} elsif ( $type eq '%' && $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
} elsif ( $type eq '%' && $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
||||||
@@ -6795,8 +6771,8 @@ sub interface_address( $ ) {
|
|||||||
#
|
#
|
||||||
# Record that the ruleset requires the first IP address on the passed interface
|
# Record that the ruleset requires the first IP address on the passed interface
|
||||||
#
|
#
|
||||||
sub get_interface_address ( $;$ ) {
|
sub get_interface_address ( $ ) {
|
||||||
my ( $logical, $provider ) = @_;
|
my ( $logical ) = $_[0];
|
||||||
|
|
||||||
my $interface = get_physical( $logical );
|
my $interface = get_physical( $logical );
|
||||||
my $variable = interface_address( $interface );
|
my $variable = interface_address( $interface );
|
||||||
@@ -6806,8 +6782,6 @@ sub get_interface_address ( $;$ ) {
|
|||||||
|
|
||||||
$interfaceaddr{$interface} = "$variable=\$($function $interface)\n";
|
$interfaceaddr{$interface} = "$variable=\$($function $interface)\n";
|
||||||
|
|
||||||
set_interface_option( $logical, 'used_address_variable', 1 ) unless $provider;
|
|
||||||
|
|
||||||
"\$$variable";
|
"\$$variable";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6868,21 +6842,14 @@ sub interface_gateway( $ ) {
|
|||||||
#
|
#
|
||||||
# Record that the ruleset requires the gateway address on the passed interface
|
# Record that the ruleset requires the gateway address on the passed interface
|
||||||
#
|
#
|
||||||
sub get_interface_gateway ( $;$$ ) {
|
sub get_interface_gateway ( $;$ ) {
|
||||||
my ( $logical, $protect, $provider ) = @_;
|
my ( $logical, $protect ) = @_;
|
||||||
|
|
||||||
my $interface = get_physical $logical;
|
my $interface = get_physical $logical;
|
||||||
my $variable = interface_gateway( $interface );
|
my $variable = interface_gateway( $interface );
|
||||||
my $gateway = get_interface_option( $interface, 'gateway' );
|
|
||||||
|
|
||||||
$global_variables |= ALL_COMMANDS;
|
$global_variables |= ALL_COMMANDS;
|
||||||
|
|
||||||
if ( $gateway ) {
|
|
||||||
fatal_error q(A gateway variable cannot be used for a provider interface with GATEWAY set to 'none' in the providers file) if $gateway eq 'none';
|
|
||||||
fatal_error q(A gateway variable cannot be used for a provider interface with an empty GATEWAY column in the providers file) if $gateway eq 'omitted';
|
|
||||||
return $gateway if $gateway ne 'detect';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( interface_is_optional $logical ) {
|
if ( interface_is_optional $logical ) {
|
||||||
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface));
|
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface));
|
||||||
} else {
|
} else {
|
||||||
@@ -6890,8 +6857,6 @@ sub get_interface_gateway ( $;$$ ) {
|
|||||||
[ -n "\$$variable" ] || startup_error "Unable to detect the gateway through interface $interface");
|
[ -n "\$$variable" ] || startup_error "Unable to detect the gateway through interface $interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
set_interface_option($interface, 'used_gateway_variable', 1) unless $provider;
|
|
||||||
|
|
||||||
$protect ? "\${$variable:-" . NILIP . '}' : "\$$variable";
|
$protect ? "\${$variable:-" . NILIP . '}' : "\$$variable";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7294,7 +7259,6 @@ sub isolate_dest_interface( $$$$ ) {
|
|||||||
my ( $diface, $dnets );
|
my ( $diface, $dnets );
|
||||||
|
|
||||||
if ( ( $restriction & PREROUTE_RESTRICT ) && $dest =~ /^detect:(.*)$/ ) {
|
if ( ( $restriction & PREROUTE_RESTRICT ) && $dest =~ /^detect:(.*)$/ ) {
|
||||||
my $niladdr = NILIP;
|
|
||||||
#
|
#
|
||||||
# DETECT_DNAT_IPADDRS=Yes and we're generating the nat rule
|
# DETECT_DNAT_IPADDRS=Yes and we're generating the nat rule
|
||||||
#
|
#
|
||||||
@@ -7311,14 +7275,14 @@ sub isolate_dest_interface( $$$$ ) {
|
|||||||
|
|
||||||
push_command( $chainref , "for address in $list; do" , 'done' );
|
push_command( $chainref , "for address in $list; do" , 'done' );
|
||||||
|
|
||||||
push_command( $chainref , "if [ \$address != $niladdr ]; then" , 'fi' ) if $optional;
|
push_command( $chainref , 'if [ $address != 0.0.0.0 ]; then' , 'fi' ) if $optional;
|
||||||
|
|
||||||
$rule .= '-d $address ';
|
$rule .= '-d $address ';
|
||||||
} else {
|
} else {
|
||||||
my $interface = $interfaces[0];
|
my $interface = $interfaces[0];
|
||||||
my $variable = get_interface_address( $interface );
|
my $variable = get_interface_address( $interface );
|
||||||
|
|
||||||
push_command( $chainref , "if [ $variable != $niladdr ]; then" , 'fi') if interface_is_optional( $interface );
|
push_command( $chainref , "if [ $variable != 0.0.0.0 ]; then" , 'fi') if interface_is_optional( $interface );
|
||||||
|
|
||||||
$rule .= "-d $variable ";
|
$rule .= "-d $variable ";
|
||||||
}
|
}
|
||||||
@@ -8287,65 +8251,37 @@ EOF
|
|||||||
|
|
||||||
sub ensure_ipsets( @ ) {
|
sub ensure_ipsets( @ ) {
|
||||||
my $set;
|
my $set;
|
||||||
my $counters = have_capability( 'IPSET_MATCH_COUNTERS' ) ? ' counters' : '';
|
|
||||||
|
|
||||||
if ( $globals{DBL_TIMEOUT} ne '' && $_[0] eq $globals{DBL_IPSET} ) {
|
|
||||||
shift;
|
|
||||||
|
|
||||||
emit( qq( if ! qt \$IPSET list $globals{DBL_IPSET}; then));
|
|
||||||
|
|
||||||
|
if ( @_ > 1 ) {
|
||||||
push_indent;
|
push_indent;
|
||||||
|
emit( "for set in @_; do" );
|
||||||
if ( $family == F_IPV4 ) {
|
$set = '$set';
|
||||||
emit( q( #),
|
} else {
|
||||||
q( # Set the timeout for the dynamic blacklisting ipset),
|
$set = $_[0];
|
||||||
q( #),
|
|
||||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet timeout $globals{DBL_TIMEOUT}${counters}) );
|
|
||||||
} else {
|
|
||||||
emit( q( #),
|
|
||||||
q( # Set the timeout for the dynamic blacklisting ipset),
|
|
||||||
q( #),
|
|
||||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet6 timeout $globals{DBL_TIMEOUT}${counters}) );
|
|
||||||
}
|
|
||||||
|
|
||||||
pop_indent;
|
|
||||||
|
|
||||||
emit( qq( fi\n) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( @_ ) {
|
if ( $family == F_IPV4 ) {
|
||||||
if ( @_ > 1 ) {
|
if ( have_capability 'IPSET_V5' ) {
|
||||||
push_indent;
|
emit ( qq( if ! qt \$IPSET -L $set -n; then) ,
|
||||||
emit( "for set in @_; do" );
|
qq( error_message "WARNING: ipset $set does not exist; creating it as an hash:net set") ,
|
||||||
$set = '$set';
|
qq( \$IPSET -N $set hash:net family inet timeout 0 counters) ,
|
||||||
|
qq( fi) );
|
||||||
} else {
|
} else {
|
||||||
$set = $_[0];
|
emit ( qq( if ! qt \$IPSET -L $set -n; then) ,
|
||||||
}
|
qq( error_message "WARNING: ipset $set does not exist; creating it as an iphash set") ,
|
||||||
|
qq( \$IPSET -N $set iphash) ,
|
||||||
if ( $family == F_IPV4 ) {
|
|
||||||
if ( have_capability 'IPSET_V5' ) {
|
|
||||||
emit ( qq( if ! qt \$IPSET list $set -n; then) ,
|
|
||||||
qq( error_message "WARNING: ipset $set does not exist; creating it as a hash:net set") ,
|
|
||||||
qq( \$IPSET create $set hash:net family inet timeout 0${counters}) ,
|
|
||||||
qq( fi) );
|
|
||||||
} else {
|
|
||||||
emit ( qq( if ! qt \$IPSET -L $set -n; then) ,
|
|
||||||
qq( error_message "WARNING: ipset $set does not exist; creating it as an iphash set") ,
|
|
||||||
qq( \$IPSET -N $set iphash) ,
|
|
||||||
qq( fi) );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
emit ( qq( if ! qt \$IPSET list $set -n; then) ,
|
|
||||||
qq( error_message "WARNING: ipset $set does not exist; creating it as a hash:net set") ,
|
|
||||||
qq( \$IPSET create $set hash:net family inet6 timeout 0${counters}) ,
|
|
||||||
qq( fi) );
|
qq( fi) );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
emit ( qq( if ! qt \$IPSET -L $set -n; then) ,
|
||||||
|
qq( error_message "WARNING: ipset $set does not exist; creating it as an hash:net set") ,
|
||||||
|
qq( \$IPSET -N $set hash:net family inet6 timeout 0 counters) ,
|
||||||
|
qq( fi) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( @_ > 1 ) {
|
if ( @_ > 1 ) {
|
||||||
emit 'done';
|
emit 'done';
|
||||||
pop_indent;
|
pop_indent;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8523,21 +8459,10 @@ sub create_load_ipsets() {
|
|||||||
'if [ "$COMMAND" = start ]; then' ); ##################### Start Command ##################
|
'if [ "$COMMAND" = start ]; then' ); ##################### Start Command ##################
|
||||||
|
|
||||||
if ( $config{SAVE_IPSETS} || @{$globals{SAVED_IPSETS}} ) {
|
if ( $config{SAVE_IPSETS} || @{$globals{SAVED_IPSETS}} ) {
|
||||||
emit( ' if [ -f ${VARDIR}/ipsets.save ]; then' );
|
emit( ' if [ -f ${VARDIR}/ipsets.save ]; then',
|
||||||
|
' zap_ipsets',
|
||||||
if ( my $set = $globals{DBL_IPSET} ) {
|
' $IPSET -R < ${VARDIR}/ipsets.save',
|
||||||
emit( ' #',
|
' fi' );
|
||||||
' # Update the dynamic blacklisting ipset timeout value',
|
|
||||||
' #',
|
|
||||||
qq( awk '/create $set/ { sub( /timeout [0-9]+/, "timeout $globals{DBL_TIMEOUT}" ) }; {print};' \${VARDIR}/ipsets.save > \${VARDIR}/ipsets.temp),
|
|
||||||
' zap_ipsets',
|
|
||||||
' $IPSET restore < ${VARDIR}/ipsets.temp',
|
|
||||||
' fi' );
|
|
||||||
} else {
|
|
||||||
emit( ' zap_ipsets',
|
|
||||||
' $IPSET -R < ${VARDIR}/ipsets.save',
|
|
||||||
' fi' );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( @ipsets ) {
|
if ( @ipsets ) {
|
||||||
@@ -8650,7 +8575,7 @@ sub create_netfilter_load( $ ) {
|
|||||||
|
|
||||||
enter_cat_mode;
|
enter_cat_mode;
|
||||||
|
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
unless ( $test ) {
|
unless ( $test ) {
|
||||||
emit_unindented '#';
|
emit_unindented '#';
|
||||||
@@ -8758,7 +8683,7 @@ sub preview_netfilter_load() {
|
|||||||
|
|
||||||
enter_cat_mode1;
|
enter_cat_mode1;
|
||||||
|
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";
|
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";
|
||||||
|
|
||||||
@@ -8994,7 +8919,7 @@ sub create_stop_load( $ ) {
|
|||||||
enter_cat_mode;
|
enter_cat_mode;
|
||||||
|
|
||||||
unless ( $test ) {
|
unless ( $test ) {
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
emit_unindented '#';
|
emit_unindented '#';
|
||||||
emit_unindented "# Generated by Shorewall $globals{VERSION} - $date";
|
emit_unindented "# Generated by Shorewall $globals{VERSION} - $date";
|
||||||
emit_unindented '#';
|
emit_unindented '#';
|
||||||
|
@@ -76,7 +76,7 @@ sub initialize_package_globals( $$$ ) {
|
|||||||
#
|
#
|
||||||
# First stage of script generation.
|
# First stage of script generation.
|
||||||
#
|
#
|
||||||
# Copy lib.runtime and lib.common to the generated script.
|
# Copy lib.core and lib.common to the generated script.
|
||||||
# Generate the various user-exit jacket functions.
|
# Generate the various user-exit jacket functions.
|
||||||
#
|
#
|
||||||
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
|
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
|
||||||
@@ -90,12 +90,12 @@ sub generate_script_1( $ ) {
|
|||||||
if ( $test ) {
|
if ( $test ) {
|
||||||
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
|
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
|
||||||
} else {
|
} else {
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
|
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
|
||||||
|
|
||||||
copy $globals{SHAREDIRPL} . '/lib.runtime', 0;
|
copy $globals{SHAREDIRPL} . '/lib.core', 0;
|
||||||
copy2 $globals{SHAREDIRPL} . '/lib.common' , $debug;
|
copy2 $globals{SHAREDIRPL} . '/lib.common', $debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -596,21 +596,6 @@ EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Generate info_command()
|
|
||||||
#
|
|
||||||
sub compile_info_command() {
|
|
||||||
my $date = compiletime;
|
|
||||||
|
|
||||||
emit( "\n",
|
|
||||||
"#",
|
|
||||||
"# Echo the date and time when this script was compiled along with the Shorewall version",
|
|
||||||
"#",
|
|
||||||
"info_command() {" ,
|
|
||||||
qq( echo "compiled $date by Shorewall version $globals{VERSION}") ,
|
|
||||||
"}\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The Compiler.
|
# The Compiler.
|
||||||
#
|
#
|
||||||
@@ -804,8 +789,33 @@ sub compiler {
|
|||||||
# Validate the TC files so that the providers will know what interfaces have TC
|
# Validate the TC files so that the providers will know what interfaces have TC
|
||||||
#
|
#
|
||||||
my $tcinterfaces = process_tc;
|
my $tcinterfaces = process_tc;
|
||||||
|
#
|
||||||
|
# Generate a function to bring up each provider
|
||||||
|
#
|
||||||
process_providers( $tcinterfaces );
|
process_providers( $tcinterfaces );
|
||||||
|
#
|
||||||
|
# [Re-]establish Routing
|
||||||
|
#
|
||||||
|
if ( $scriptfilename || $debug ) {
|
||||||
|
emit( "\n#",
|
||||||
|
'# Setup routing and traffic shaping',
|
||||||
|
'#',
|
||||||
|
'setup_routing_and_traffic_shaping() {'
|
||||||
|
);
|
||||||
|
|
||||||
|
push_indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_providers;
|
||||||
|
#
|
||||||
|
# TCRules and Traffic Shaping
|
||||||
|
#
|
||||||
|
setup_tc( $update );
|
||||||
|
|
||||||
|
if ( $scriptfilename || $debug ) {
|
||||||
|
pop_indent;
|
||||||
|
emit "}\n"; # End of setup_routing_and_traffic_shaping()
|
||||||
|
}
|
||||||
|
|
||||||
$have_arptables = process_arprules if $family == F_IPV4;
|
$have_arptables = process_arprules if $family == F_IPV4;
|
||||||
|
|
||||||
@@ -816,9 +826,13 @@ sub compiler {
|
|||||||
#
|
#
|
||||||
process_tos;
|
process_tos;
|
||||||
#
|
#
|
||||||
# Setup Masquerade/SNAT
|
# ECN
|
||||||
#
|
#
|
||||||
setup_snat( $update );
|
setup_ecn if $family == F_IPV4 && have_capability( 'MANGLE_ENABLED' ) && $config{MANGLE_ENABLED};
|
||||||
|
#
|
||||||
|
# Setup Masquerading/SNAT
|
||||||
|
#
|
||||||
|
setup_masq;
|
||||||
#
|
#
|
||||||
# Setup Nat
|
# Setup Nat
|
||||||
#
|
#
|
||||||
@@ -860,37 +874,6 @@ sub compiler {
|
|||||||
#
|
#
|
||||||
setup_accounting if $config{ACCOUNTING};
|
setup_accounting if $config{ACCOUNTING};
|
||||||
|
|
||||||
enable_script;
|
|
||||||
#
|
|
||||||
# Generate a function to bring up each provider
|
|
||||||
#
|
|
||||||
if ( $scriptfilename || $debug ) {
|
|
||||||
emit( "\n#",
|
|
||||||
'# Setup routing and traffic shaping',
|
|
||||||
'#',
|
|
||||||
'setup_routing_and_traffic_shaping() {'
|
|
||||||
);
|
|
||||||
|
|
||||||
push_indent;
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_providers;
|
|
||||||
#
|
|
||||||
# TCRules and Traffic Shaping
|
|
||||||
#
|
|
||||||
setup_tc( $update );
|
|
||||||
|
|
||||||
if ( $scriptfilename || $debug ) {
|
|
||||||
pop_indent;
|
|
||||||
emit "}\n"; # End of setup_routing_and_traffic_shaping()
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# ECN
|
|
||||||
#
|
|
||||||
setup_ecn if $family == F_IPV4 && have_capability( 'MANGLE_ENABLED' ) && $config{MANGLE_ENABLED};
|
|
||||||
|
|
||||||
disable_script;
|
|
||||||
|
|
||||||
if ( $scriptfilename ) {
|
if ( $scriptfilename ) {
|
||||||
#
|
#
|
||||||
# Compiling a script - generate the zone by zone matrix
|
# Compiling a script - generate the zone by zone matrix
|
||||||
@@ -939,10 +922,6 @@ sub compiler {
|
|||||||
#
|
#
|
||||||
compile_updown;
|
compile_updown;
|
||||||
#
|
#
|
||||||
# Echo the compilation time and date
|
|
||||||
#
|
|
||||||
compile_info_command unless $test;
|
|
||||||
#
|
|
||||||
# Copy the footer to the script
|
# Copy the footer to the script
|
||||||
#
|
#
|
||||||
copy $globals{SHAREDIRPL} . 'prog.footer' unless $test;
|
copy $globals{SHAREDIRPL} . 'prog.footer' unless $test;
|
||||||
|
@@ -84,8 +84,6 @@ our @EXPORT = qw(
|
|||||||
require_capability
|
require_capability
|
||||||
report_used_capabilities
|
report_used_capabilities
|
||||||
kernel_version
|
kernel_version
|
||||||
|
|
||||||
compiletime
|
|
||||||
);
|
);
|
||||||
|
|
||||||
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
|
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
|
||||||
@@ -133,7 +131,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
split_line
|
split_line
|
||||||
split_line1
|
split_line1
|
||||||
split_line2
|
split_line2
|
||||||
split_rawline2
|
|
||||||
first_entry
|
first_entry
|
||||||
open_file
|
open_file
|
||||||
close_file
|
close_file
|
||||||
@@ -166,7 +163,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
directive_callback
|
directive_callback
|
||||||
add_ipset
|
add_ipset
|
||||||
all_ipsets
|
all_ipsets
|
||||||
transfer_permissions
|
|
||||||
|
|
||||||
$product
|
$product
|
||||||
$Product
|
$Product
|
||||||
@@ -175,7 +171,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
$doing
|
$doing
|
||||||
$done
|
$done
|
||||||
$currentline
|
$currentline
|
||||||
$rawcurrentline
|
|
||||||
$currentfilename
|
$currentfilename
|
||||||
$debug
|
$debug
|
||||||
$file_format
|
$file_format
|
||||||
@@ -566,7 +561,6 @@ our $usedcaller;
|
|||||||
our $inline_matches;
|
our $inline_matches;
|
||||||
|
|
||||||
our $currentline; # Current config file line image
|
our $currentline; # Current config file line image
|
||||||
our $rawcurrentline; # Current config file line with no variable expansion
|
|
||||||
our $currentfile; # File handle reference
|
our $currentfile; # File handle reference
|
||||||
our $currentfilename; # File NAME
|
our $currentfilename; # File NAME
|
||||||
our $currentlinenumber; # Line number
|
our $currentlinenumber; # Line number
|
||||||
@@ -580,7 +574,6 @@ our $max_format; # Max format value
|
|||||||
our $comment; # Current COMMENT
|
our $comment; # Current COMMENT
|
||||||
our $comments_allowed; # True if [?]COMMENT is allowed in the current file
|
our $comments_allowed; # True if [?]COMMENT is allowed in the current file
|
||||||
our $nocomment; # When true, ignore [?]COMMENT in the current file
|
our $nocomment; # When true, ignore [?]COMMENT in the current file
|
||||||
our $sr_comment; # When true, $comment should only be applied to the current rule
|
|
||||||
our $warningcount; # Used to suppress duplicate warnings about missing COMMENT support
|
our $warningcount; # Used to suppress duplicate warnings about missing COMMENT support
|
||||||
our $checkinline; # The -i option to check/compile/etc.
|
our $checkinline; # The -i option to check/compile/etc.
|
||||||
our $directive_callback; # Function to call in compiler_directive
|
our $directive_callback; # Function to call in compiler_directive
|
||||||
@@ -688,8 +681,6 @@ our %ipsets; # All required IPsets
|
|||||||
#
|
#
|
||||||
our %filecache;
|
our %filecache;
|
||||||
|
|
||||||
our $compiletime;
|
|
||||||
|
|
||||||
sub process_shorewallrc($$);
|
sub process_shorewallrc($$);
|
||||||
sub add_variables( \% );
|
sub add_variables( \% );
|
||||||
#
|
#
|
||||||
@@ -735,7 +726,6 @@ sub initialize( $;$$) {
|
|||||||
# Contents of last COMMENT line.
|
# Contents of last COMMENT line.
|
||||||
#
|
#
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$sr_comment = '';
|
|
||||||
$warningcount = 0;
|
$warningcount = 0;
|
||||||
#
|
#
|
||||||
# Misc Globals
|
# Misc Globals
|
||||||
@@ -747,7 +737,7 @@ sub initialize( $;$$) {
|
|||||||
TC_SCRIPT => '',
|
TC_SCRIPT => '',
|
||||||
EXPORT => 0,
|
EXPORT => 0,
|
||||||
KLUDGEFREE => '',
|
KLUDGEFREE => '',
|
||||||
VERSION => "5.0.9-Beta2",
|
VERSION => "5.0.1",
|
||||||
CAPVERSION => 50004 ,
|
CAPVERSION => 50004 ,
|
||||||
BLACKLIST_LOG_TAG => '',
|
BLACKLIST_LOG_TAG => '',
|
||||||
RELATED_LOG_TAG => '',
|
RELATED_LOG_TAG => '',
|
||||||
@@ -757,8 +747,6 @@ sub initialize( $;$$) {
|
|||||||
RPFILTER_LOG_TAG => '',
|
RPFILTER_LOG_TAG => '',
|
||||||
INVALID_LOG_TAG => '',
|
INVALID_LOG_TAG => '',
|
||||||
UNTRACKED_LOG_TAG => '',
|
UNTRACKED_LOG_TAG => '',
|
||||||
DBL_IPSET => '',
|
|
||||||
DBL_TIMEOUT => 0,
|
|
||||||
POSTROUTING => 'POSTROUTING',
|
POSTROUTING => 'POSTROUTING',
|
||||||
);
|
);
|
||||||
#
|
#
|
||||||
@@ -901,9 +889,6 @@ sub initialize( $;$$) {
|
|||||||
DOCKER => undef ,
|
DOCKER => undef ,
|
||||||
PAGER => undef ,
|
PAGER => undef ,
|
||||||
MINIUPNPD => undef ,
|
MINIUPNPD => undef ,
|
||||||
VERBOSE_MESSAGES => undef ,
|
|
||||||
ZERO_MARKS => undef ,
|
|
||||||
FIREWALL => undef ,
|
|
||||||
#
|
#
|
||||||
# Packet Disposition
|
# Packet Disposition
|
||||||
#
|
#
|
||||||
@@ -1186,12 +1171,6 @@ sub initialize( $;$$) {
|
|||||||
%shorewallrc1 = %shorewallrc unless $shorewallrc1;
|
%shorewallrc1 = %shorewallrc unless $shorewallrc1;
|
||||||
|
|
||||||
add_variables %shorewallrc1;
|
add_variables %shorewallrc1;
|
||||||
|
|
||||||
$compiletime = `date`;
|
|
||||||
|
|
||||||
chomp $compiletime;
|
|
||||||
|
|
||||||
$compiletime =~ s/ +/ /g;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
||||||
@@ -1204,10 +1183,6 @@ sub all_ipsets() {
|
|||||||
sort keys %ipsets;
|
sort keys %ipsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub compiletime() {
|
|
||||||
$compiletime;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create 'currentlineinfo'
|
# Create 'currentlineinfo'
|
||||||
#
|
#
|
||||||
@@ -2165,47 +2140,6 @@ sub split_list3( $$ ) {
|
|||||||
@list2;
|
@list2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# This version spits a list on white-space with optional leading comma. It prevents double-quoted
|
|
||||||
# strings from being split.
|
|
||||||
#
|
|
||||||
sub split_list4( $ ) {
|
|
||||||
my ($list ) = @_;
|
|
||||||
my @list1 = split( /,?\s+/, $list );
|
|
||||||
my @list2;
|
|
||||||
my $element = '';
|
|
||||||
my $opencount = 0;
|
|
||||||
|
|
||||||
return @list1 unless $list =~ /"/;
|
|
||||||
|
|
||||||
@list1 = split( /(,?\s+)/, $list );
|
|
||||||
|
|
||||||
for ( my $i = 0; $i < @list1; $i += 2 ) {
|
|
||||||
my $e = $list1[$i];
|
|
||||||
|
|
||||||
if ( $e =~ /[^\\]"/ ) {
|
|
||||||
if ( $e =~ /[^\\]".*[^\\]"/ ) {
|
|
||||||
fatal_error 'Unescaped embedded quote (' . join( $list1[$i - 1], $element, $e ) . ')' if $element ne '';
|
|
||||||
push @list2, $e;
|
|
||||||
} elsif ( $element ne '' ) {
|
|
||||||
fatal_error 'Quoting Error (' . join( $list1[$i - 1], $element, $e ) . ')' unless $e =~ /"$/;
|
|
||||||
push @list2, join( $list1[$i - 1], $element, $e );
|
|
||||||
$element = '';
|
|
||||||
} else {
|
|
||||||
$element = $e;
|
|
||||||
}
|
|
||||||
} elsif ( $element ne '' ) {
|
|
||||||
$element = join( $list1[$i - 1], $element, $e );
|
|
||||||
} else {
|
|
||||||
push @list2, $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fatal_error "Mismatched_quotes ($list)" if $element ne '';
|
|
||||||
|
|
||||||
@list2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Splits the columns of a config file record
|
# Splits the columns of a config file record
|
||||||
#
|
#
|
||||||
@@ -2275,8 +2209,6 @@ sub passed( $ ) {
|
|||||||
defined $val && $val ne '' && $val ne '-';
|
defined $val && $val ne '' && $val ne '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
sub clear_comment();
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pre-process a line from a configuration file.
|
# Pre-process a line from a configuration file.
|
||||||
|
|
||||||
@@ -2300,8 +2232,6 @@ sub split_line2( $$;$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$inline_matches = '';
|
$inline_matches = '';
|
||||||
|
|
||||||
clear_comment if $sr_comment;
|
|
||||||
#
|
#
|
||||||
# First, see if there are double semicolons on the line; what follows will be raw iptables input
|
# First, see if there are double semicolons on the line; what follows will be raw iptables input
|
||||||
#
|
#
|
||||||
@@ -2408,62 +2338,24 @@ sub split_line2( $$;$$$ ) {
|
|||||||
$pairs =~ s/^\s*//;
|
$pairs =~ s/^\s*//;
|
||||||
$pairs =~ s/\s*$//;
|
$pairs =~ s/\s*$//;
|
||||||
|
|
||||||
my @pairs = split_list4( $pairs );
|
my @pairs = split( /,?\s+/, $pairs );
|
||||||
|
|
||||||
for ( @pairs ) {
|
for ( @pairs ) {
|
||||||
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
||||||
my ( $column, $value ) = ( lc( $1 ), $2 );
|
my ( $column, $value ) = ( lc( $1 ), $2 );
|
||||||
|
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
||||||
if ( $value =~ /"$/ ) {
|
$column = $columnsref->{$column};
|
||||||
fatal_error "Invalid value ( $value )" unless $value =~ /^"(.*)"$/;
|
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
||||||
$value = $1;
|
$value = $1 if $value =~ /^"([^"]+)"$/;
|
||||||
}
|
fatal_error "Column values may not contain embedded double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
|
||||||
|
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
||||||
if ( $column eq 'comment' ) {
|
$line[$column] = $value;
|
||||||
if ( $comments_allowed ) {
|
|
||||||
if ( have_capability( 'COMMENTS' ) ) {
|
|
||||||
$comment = $value;
|
|
||||||
$sr_comment = 1;
|
|
||||||
} else {
|
|
||||||
warning_message '"comment" ignored -- requires comment support in iptables/Netfilter' unless $warningcount++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fatal_error '"comment" is not allowed in this file';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
|
||||||
$column = $columnsref->{$column};
|
|
||||||
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
|
||||||
$value = $1 if $value =~ /^"([^"]+)"$/;
|
|
||||||
$value =~ s/\\"/"/g;
|
|
||||||
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
|
||||||
$line[$column] = $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@line;
|
@line;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Same as above, only it splits the raw current line
|
|
||||||
#
|
|
||||||
sub split_rawline2( $$;$$$ ) {
|
|
||||||
my $savecurrentline = $currentline;
|
|
||||||
|
|
||||||
$currentline = $rawcurrentline;
|
|
||||||
#
|
|
||||||
# Delete trailing comment
|
|
||||||
#
|
|
||||||
$currentline =~ s/\s*#.*//;
|
|
||||||
|
|
||||||
my @result = &split_line2( @_ );
|
|
||||||
|
|
||||||
$currentline = $savecurrentline;
|
|
||||||
|
|
||||||
@result;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub split_line1( $$;$$ ) {
|
sub split_line1( $$;$$ ) {
|
||||||
&split_line2( @_, undef );
|
&split_line2( @_, undef );
|
||||||
}
|
}
|
||||||
@@ -2487,7 +2379,6 @@ sub no_comment() {
|
|||||||
sub clear_comment() {
|
sub clear_comment() {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$nocomment = 0;
|
$nocomment = 0;
|
||||||
$sr_comment = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2583,8 +2474,7 @@ sub push_include() {
|
|||||||
$max_format,
|
$max_format,
|
||||||
$comment,
|
$comment,
|
||||||
$nocomment,
|
$nocomment,
|
||||||
$section_function,
|
$section_function ];
|
||||||
$sr_comment ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2608,8 +2498,7 @@ sub pop_include() {
|
|||||||
$max_format,
|
$max_format,
|
||||||
$comment,
|
$comment,
|
||||||
$nocomment,
|
$nocomment,
|
||||||
$section_function,
|
$section_function ) = @$arrayref;
|
||||||
$sr_comment ) = @$arrayref;
|
|
||||||
} else {
|
} else {
|
||||||
$currentfile = undef;
|
$currentfile = undef;
|
||||||
$currentlinenumber = 'EOF';
|
$currentlinenumber = 'EOF';
|
||||||
@@ -2654,54 +2543,18 @@ sub directive_error( $$$ ) {
|
|||||||
fatal_error $_[0];
|
fatal_error $_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub directive_warning( $$$$ ) {
|
sub directive_warning( $$$ ) {
|
||||||
if ( shift ) {
|
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
||||||
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
( my $warning, $currentfilename, $currentlinenumber ) = @_;
|
||||||
( my $warning, $currentfilename, $currentlinenumber ) = @_;
|
warning_message $warning;
|
||||||
warning_message $warning;
|
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
||||||
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
|
||||||
} else {
|
|
||||||
our @localtime;
|
|
||||||
|
|
||||||
handle_first_entry if $first_entry;
|
|
||||||
|
|
||||||
$| = 1; #Reset output buffering (flush any partially filled buffers).
|
|
||||||
|
|
||||||
if ( $log ) {
|
|
||||||
@localtime = localtime;
|
|
||||||
printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0];
|
|
||||||
print $log " WARNING: $_[0]\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print STDERR " WARNING: $_[0]\n";
|
|
||||||
|
|
||||||
$| = 0; #Re-allow output buffering
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub directive_info( $$$$ ) {
|
sub directive_info( $$$ ) {
|
||||||
if ( shift ) {
|
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
||||||
my ( $savefilename, $savelineno ) = ( $currentfilename, $currentlinenumber );
|
( my $info, $currentfilename, $currentlinenumber ) = @_;
|
||||||
( my $info, $currentfilename, $currentlinenumber ) = @_;
|
info_message $info;
|
||||||
info_message $info;
|
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
||||||
( $currentfilename, $currentlinenumber ) = ( $savefilename, $savelineno );
|
|
||||||
} else {
|
|
||||||
our @localtime;
|
|
||||||
|
|
||||||
handle_first_entry if $first_entry;
|
|
||||||
|
|
||||||
$| = 1; #Reset output buffering (flush any partially filled buffers).
|
|
||||||
|
|
||||||
if ( $log ) {
|
|
||||||
@localtime = localtime;
|
|
||||||
printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0];
|
|
||||||
print $log " INFO: $_[0]\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print STDERR " INFO: $_[0]\n";
|
|
||||||
|
|
||||||
$| = 0; #Re-allow output buffering
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2850,7 +2703,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
|
|
||||||
print "CD===> $line\n" if $debug;
|
print "CD===> $line\n" if $debug;
|
||||||
|
|
||||||
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+)(.*)$/i;
|
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+)(.*)$/i;
|
||||||
|
|
||||||
my ($keyword, $expression) = ( uc $1, $2 );
|
my ($keyword, $expression) = ( uc $1, $2 );
|
||||||
|
|
||||||
@@ -2958,14 +2811,14 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
delete $actparams{$var}
|
delete $actparams{$var}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber );
|
directive_warning( "Shorewall variable $2 does not exist", $filename, $linenumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ( exists $variables{$2} ) {
|
if ( exists $variables{$2} ) {
|
||||||
delete $variables{$2};
|
delete $variables{$2};
|
||||||
} else {
|
} else {
|
||||||
directive_warning( 'Yes', "Shell variable $2 does not exist", $filename, $linenumber );
|
directive_warning( "Shell variable $2 does not exist", $filename, $linenumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2978,9 +2831,8 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
if ( have_capability( 'COMMENTS' ) ) {
|
if ( have_capability( 'COMMENTS' ) ) {
|
||||||
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
||||||
$comment =~ s/\s*$//;
|
$comment =~ s/\s*$//;
|
||||||
$sr_comment = '';
|
|
||||||
} else {
|
} else {
|
||||||
directive_warning( 'Yes', "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
directive_warning( "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2999,8 +2851,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
} ,
|
} ,
|
||||||
|
|
||||||
WARNING => sub() {
|
WARNING => sub() {
|
||||||
directive_warning( $config{VERBOSE_MESSAGES} ,
|
directive_warning( evaluate_expression( $expression ,
|
||||||
evaluate_expression( $expression ,
|
|
||||||
$filename ,
|
$filename ,
|
||||||
$linenumber ,
|
$linenumber ,
|
||||||
1 ),
|
1 ),
|
||||||
@@ -3009,28 +2860,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
} ,
|
} ,
|
||||||
|
|
||||||
INFO => sub() {
|
INFO => sub() {
|
||||||
directive_info( $config{VERBOSE_MESSAGES} ,
|
directive_info( evaluate_expression( $expression ,
|
||||||
evaluate_expression( $expression ,
|
|
||||||
$filename ,
|
|
||||||
$linenumber ,
|
|
||||||
1 ),
|
|
||||||
$filename ,
|
|
||||||
$linenumber ) unless $omitting;
|
|
||||||
} ,
|
|
||||||
|
|
||||||
'WARNING!' => sub() {
|
|
||||||
directive_warning( ! $config{VERBOSE_MESSAGES} ,
|
|
||||||
evaluate_expression( $expression ,
|
|
||||||
$filename ,
|
|
||||||
$linenumber ,
|
|
||||||
1 ),
|
|
||||||
$filename ,
|
|
||||||
$linenumber ) unless $omitting;
|
|
||||||
} ,
|
|
||||||
|
|
||||||
'INFO!' => sub() {
|
|
||||||
directive_info( ! $config{VERBOSE_MESSAGES} ,
|
|
||||||
evaluate_expression( $expression ,
|
|
||||||
$filename ,
|
$filename ,
|
||||||
$linenumber ,
|
$linenumber ,
|
||||||
1 ),
|
1 ),
|
||||||
@@ -3048,9 +2878,9 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
|
|
||||||
if ( $directive_callback ) {
|
if ( $directive_callback ) {
|
||||||
$directive_callback->( $keyword, $line )
|
$directive_callback->( $keyword, $line )
|
||||||
|
} else {
|
||||||
|
$omitting;
|
||||||
}
|
}
|
||||||
|
|
||||||
$omitting;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3332,7 +3162,6 @@ sub push_open( $;$$$$ ) {
|
|||||||
push @openstack, \@a;
|
push @openstack, \@a;
|
||||||
@includestack = ();
|
@includestack = ();
|
||||||
$currentfile = undef;
|
$currentfile = undef;
|
||||||
$sr_comment = '';
|
|
||||||
open_file( $file , $max, $comments_allowed || $ca, $nc , $cf );
|
open_file( $file , $max, $comments_allowed || $ca, $nc , $cf );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3426,7 +3255,7 @@ sub embedded_shell( $ ) {
|
|||||||
sub embedded_perl( $ ) {
|
sub embedded_perl( $ ) {
|
||||||
my $multiline = shift;
|
my $multiline = shift;
|
||||||
|
|
||||||
my ( $command , $linenumber ) = ( qq(package Shorewall::User;\nno strict;\nuse Shorewall::Config (qw/shorewall/);\n# line $currentlinenumber "$currentfilename"\n$currentline), $currentlinenumber );
|
my ( $command , $linenumber ) = ( qq(package Shorewall::User;\nno strict;\n# line $currentlinenumber "$currentfilename"\n$currentline), $currentlinenumber );
|
||||||
|
|
||||||
$directive_callback->( 'PERL', $currentline ) if $directive_callback;
|
$directive_callback->( 'PERL', $currentline ) if $directive_callback;
|
||||||
|
|
||||||
@@ -3758,7 +3587,6 @@ sub read_a_line($) {
|
|||||||
|
|
||||||
if ( $omitting ) {
|
if ( $omitting ) {
|
||||||
print "OMIT=> $_\n" if $debug;
|
print "OMIT=> $_\n" if $debug;
|
||||||
$directive_callback->( 'OMITTED', $_ ) if ( $directive_callback );
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3813,10 +3641,6 @@ sub read_a_line($) {
|
|||||||
#
|
#
|
||||||
handle_first_entry if $first_entry;
|
handle_first_entry if $first_entry;
|
||||||
#
|
#
|
||||||
# Save Raw Image
|
|
||||||
#
|
|
||||||
$rawcurrentline = $currentline;
|
|
||||||
#
|
|
||||||
# Expand Shell Variables using %params and %actparams
|
# Expand Shell Variables using %params and %actparams
|
||||||
#
|
#
|
||||||
expand_variables( $currentline ) if $options & EXPAND_VARIABLES;
|
expand_variables( $currentline ) if $options & EXPAND_VARIABLES;
|
||||||
@@ -3845,7 +3669,7 @@ sub read_a_line($) {
|
|||||||
fatal_error "Invalid SECTION name ($sectionname)" unless $sectionname =~ /^[-_\da-zA-Z]+$/;
|
fatal_error "Invalid SECTION name ($sectionname)" unless $sectionname =~ /^[-_\da-zA-Z]+$/;
|
||||||
fatal_error "This file does not allow ?SECTION" unless $section_function;
|
fatal_error "This file does not allow ?SECTION" unless $section_function;
|
||||||
$section_function->($sectionname);
|
$section_function->($sectionname);
|
||||||
$directive_callback->( 'SECTION', $rawcurrentline ) if $directive_callback;
|
$directive_callback->( 'SECTION', $currentline ) if $directive_callback;
|
||||||
next LINE;
|
next LINE;
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Non-ASCII gunk in file" if ( $options && CHECK_GUNK ) && $currentline =~ /[^\s[:print:]]/;
|
fatal_error "Non-ASCII gunk in file" if ( $options && CHECK_GUNK ) && $currentline =~ /[^\s[:print:]]/;
|
||||||
@@ -3884,10 +3708,8 @@ sub process_shorewallrc( $$ ) {
|
|||||||
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
||||||
}
|
}
|
||||||
} elsif ( supplied $shorewallrc{VARLIB} ) {
|
} elsif ( supplied $shorewallrc{VARLIB} ) {
|
||||||
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product" unless supplied $shorewallrc{VARDIR};
|
||||||
}
|
}
|
||||||
|
|
||||||
$shorewallrc{DEFAULT_PAGER} = '' unless supplied $shorewallrc{DEFAULT_PAGER};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3999,10 +3821,9 @@ my %logoptions = ( tcp_sequence => '--log-tcp-sequence',
|
|||||||
|
|
||||||
sub validate_level( $;$ ) {
|
sub validate_level( $;$ ) {
|
||||||
my ( $rawlevel, $option ) = @_;
|
my ( $rawlevel, $option ) = @_;
|
||||||
my $level;
|
my $level = uc $rawlevel;
|
||||||
|
|
||||||
if ( supplied ( $rawlevel ) ) {
|
if ( supplied ( $level ) ) {
|
||||||
$level = uc $rawlevel;
|
|
||||||
$level =~ s/!$//;
|
$level =~ s/!$//;
|
||||||
my $value = $level;
|
my $value = $level;
|
||||||
my $qualifier;
|
my $qualifier;
|
||||||
@@ -4571,11 +4392,11 @@ sub IPSet_Match() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub IPSet_Match_Nomatch() {
|
sub IPSet_Match_Nomatch() {
|
||||||
have_capability( 'IPSET_MATCH' ) && $capabilities{IPSET_MATCH_NOMATCH};
|
have_capability 'IPSET_MATCH' && $capabilities{IPSET_MATCH_NOMATCH};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub IPSet_Match_Counters() {
|
sub IPSet_Match_Counters() {
|
||||||
have_capability( 'IPSET_MATCH' ) && $capabilities{IPSET_MATCH_COUNTERS};
|
have_capability 'IPSET_MATCH' && $capabilities{IPSET_MATCH_COUNTERS};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub IPSET_V5() {
|
sub IPSET_V5() {
|
||||||
@@ -5194,19 +5015,6 @@ sub update_default($$) {
|
|||||||
$config{$var} = $val unless defined $config{$var};
|
$config{$var} = $val unless defined $config{$var};
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Transfer the permissions from an old .bak file to a newly-created file
|
|
||||||
#
|
|
||||||
sub transfer_permissions( $$ ) {
|
|
||||||
my ( $old, $new ) = @_;
|
|
||||||
|
|
||||||
my @stat = stat $old;
|
|
||||||
|
|
||||||
if ( @stat ) {
|
|
||||||
fatal_error "Can't transfer permissions from $old to $new" unless chmod( $stat[2] & 0777, $new );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub update_config_file( $ ) {
|
sub update_config_file( $ ) {
|
||||||
my ( $annotate ) = @_;
|
my ( $annotate ) = @_;
|
||||||
|
|
||||||
@@ -5261,7 +5069,7 @@ sub update_config_file( $ ) {
|
|||||||
update_default( 'USE_DEFAULT_RT', 'No' );
|
update_default( 'USE_DEFAULT_RT', 'No' );
|
||||||
update_default( 'EXPORTMODULES', 'No' );
|
update_default( 'EXPORTMODULES', 'No' );
|
||||||
update_default( 'RESTART', 'reload' );
|
update_default( 'RESTART', 'reload' );
|
||||||
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
|
update_default( 'PAGER', '' );
|
||||||
|
|
||||||
my $fn;
|
my $fn;
|
||||||
|
|
||||||
@@ -5356,7 +5164,6 @@ EOF
|
|||||||
|
|
||||||
if ( system( "diff -q $configfile $configfile.bak > /dev/null" ) ) {
|
if ( system( "diff -q $configfile $configfile.bak > /dev/null" ) ) {
|
||||||
progress_message3 "Configuration file $configfile updated - old file renamed $configfile.bak";
|
progress_message3 "Configuration file $configfile updated - old file renamed $configfile.bak";
|
||||||
transfer_permissions( "$configfile.bak", $configfile );
|
|
||||||
} else {
|
} else {
|
||||||
if ( rename "$configfile.bak", $configfile ) {
|
if ( rename "$configfile.bak", $configfile ) {
|
||||||
progress_message3 "No update required to configuration file $configfile; $configfile.bak not saved";
|
progress_message3 "No update required to configuration file $configfile; $configfile.bak not saved";
|
||||||
@@ -5871,24 +5678,6 @@ sub get_configuration( $$$$ ) {
|
|||||||
$ENV{PATH} = $default_path;
|
$ENV{PATH} = $default_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Shorewall-core does not appear to be installed" unless open_file "$globals{SHAREDIRPL}coreversion";
|
|
||||||
|
|
||||||
fatal_error "$globals{SHAREDIRPL}coreversion is empty" unless read_a_line( PLAIN_READ );
|
|
||||||
|
|
||||||
close_file;
|
|
||||||
|
|
||||||
warning_message "Version Mismatch: Shorewall-core is version $currentline, while the Shorewall version is $globals{VERSION}" unless $currentline eq $globals{VERSION};
|
|
||||||
|
|
||||||
if ( $family == F_IPV6 ) {
|
|
||||||
open_file( "$globals{SHAREDIR}/version" ) || fatal_error "Unable to open $globals{SHAREDIR}/version";
|
|
||||||
|
|
||||||
fatal_error "$globals{SHAREDIR}/version is empty" unless read_a_line( PLAIN_READ );
|
|
||||||
|
|
||||||
close_file;
|
|
||||||
|
|
||||||
warning_message "Version Mismatch: Shorewall6 is version $currentline, while the Shorewall version is $globals{VERSION}" unless $currentline eq $globals{VERSION};
|
|
||||||
}
|
|
||||||
|
|
||||||
my $have_capabilities;
|
my $have_capabilities;
|
||||||
|
|
||||||
if ( $export || $> != 0 ) {
|
if ( $export || $> != 0 ) {
|
||||||
@@ -6283,27 +6072,9 @@ sub get_configuration( $$$$ ) {
|
|||||||
|
|
||||||
if ( supplied( $val = $config{DYNAMIC_BLACKLIST} ) ) {
|
if ( supplied( $val = $config{DYNAMIC_BLACKLIST} ) ) {
|
||||||
if ( $val =~ /^ipset/ ) {
|
if ( $val =~ /^ipset/ ) {
|
||||||
my %simple_options = ( 'src-dst' => 1, 'disconnect' => 1 );
|
|
||||||
|
|
||||||
my ( $key, $set, $level, $tag, $rest ) = split( ':', $val , 5 );
|
my ( $key, $set, $level, $tag, $rest ) = split( ':', $val , 5 );
|
||||||
|
|
||||||
( $key , my @options ) = split_list( $key, 'option' );
|
fatal_error "Invalid DYNAMIC_BLACKLIST setting ( $val )" if $key !~ /^ipset(?:-only)?(?:,src-dst)?$/ || defined $rest;
|
||||||
|
|
||||||
my $options = '';
|
|
||||||
|
|
||||||
for ( @options ) {
|
|
||||||
if ( $simple_options{$_} ) {
|
|
||||||
$options = join( ',' , $options, $_ );
|
|
||||||
} elsif ( $_ =~ s/^timeout=(\d+)$// ) {
|
|
||||||
$globals{DBL_TIMEOUT} = $1;
|
|
||||||
} else {
|
|
||||||
fatal_error "Invalid ipset option ($_)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$globals{DBL_OPTIONS} = $options;
|
|
||||||
|
|
||||||
fatal_error "Invalid DYNAMIC_BLACKLIST setting ( $val )" if $key !~ /^ipset(?:-only)?$/ || defined $rest;
|
|
||||||
|
|
||||||
if ( supplied( $set ) ) {
|
if ( supplied( $set ) ) {
|
||||||
fatal_error "Invalid DYNAMIC_BLACKLIST ipset name" unless $set =~ /^[A-Za-z][\w-]*/;
|
fatal_error "Invalid DYNAMIC_BLACKLIST ipset name" unless $set =~ /^[A-Za-z][\w-]*/;
|
||||||
@@ -6311,7 +6082,7 @@ sub get_configuration( $$$$ ) {
|
|||||||
$set = 'SW_DBL' . $family;
|
$set = 'SW_DBL' . $family;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_ipset( $globals{DBL_IPSET} = $set );
|
add_ipset( $set );
|
||||||
|
|
||||||
$level = validate_level( $level );
|
$level = validate_level( $level );
|
||||||
|
|
||||||
@@ -6322,10 +6093,8 @@ sub get_configuration( $$$$ ) {
|
|||||||
require_capability( 'IPSET_V5', 'DYNAMIC_BLACKLIST=ipset...', 's' );
|
require_capability( 'IPSET_V5', 'DYNAMIC_BLACKLIST=ipset...', 's' );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
default_yes_no( 'DYNAMIC_BLACKLIST' , 'Yes' );
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default_yes_no 'REQUIRE_INTERFACE' , '';
|
default_yes_no 'REQUIRE_INTERFACE' , '';
|
||||||
@@ -6340,8 +6109,6 @@ sub get_configuration( $$$$ ) {
|
|||||||
default_yes_no 'WARNOLDCAPVERSION' , 'Yes';
|
default_yes_no 'WARNOLDCAPVERSION' , 'Yes';
|
||||||
default_yes_no 'DEFER_DNS_RESOLUTION' , 'Yes';
|
default_yes_no 'DEFER_DNS_RESOLUTION' , 'Yes';
|
||||||
default_yes_no 'MINIUPNPD' , '';
|
default_yes_no 'MINIUPNPD' , '';
|
||||||
default_yes_no 'VERBOSE_MESSAGES' , 'Yes';
|
|
||||||
default_yes_no 'ZERO_MARKS' , '';
|
|
||||||
|
|
||||||
$config{IPSET} = '' if supplied $config{IPSET} && $config{IPSET} eq 'ipset';
|
$config{IPSET} = '' if supplied $config{IPSET} && $config{IPSET} eq 'ipset';
|
||||||
|
|
||||||
|
@@ -432,18 +432,13 @@ sub validate_port( $$ ) {
|
|||||||
sub validate_portpair( $$ ) {
|
sub validate_portpair( $$ ) {
|
||||||
my ($proto, $portpair) = @_;
|
my ($proto, $portpair) = @_;
|
||||||
my $what;
|
my $what;
|
||||||
my $pair = $portpair;
|
|
||||||
#
|
|
||||||
# Accept '-' as a port-range separator
|
|
||||||
#
|
|
||||||
$pair =~ tr/-/:/ if $pair =~ /^[-0-9]+$/;
|
|
||||||
|
|
||||||
fatal_error "Invalid port range ($portpair)" if $pair =~ tr/:/:/ > 1;
|
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/:/:/ > 1;
|
||||||
|
|
||||||
$pair = "0$pair" if substr( $pair, 0, 1 ) eq ':';
|
$portpair = "0$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
||||||
$pair = "${pair}65535" if substr( $pair, -1, 1 ) eq ':';
|
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
||||||
|
|
||||||
my @ports = split /:/, $pair, 2;
|
my @ports = split /:/, $portpair, 2;
|
||||||
|
|
||||||
my $protonum = resolve_proto( $proto ) || 0;
|
my $protonum = resolve_proto( $proto ) || 0;
|
||||||
|
|
||||||
@@ -472,7 +467,7 @@ sub validate_portpair1( $$ ) {
|
|||||||
|
|
||||||
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
||||||
|
|
||||||
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
$portpair = "0$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
||||||
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
||||||
|
|
||||||
my @ports = split /-/, $portpair, 2;
|
my @ports = split /-/, $portpair, 2;
|
||||||
@@ -483,10 +478,9 @@ sub validate_portpair1( $$ ) {
|
|||||||
|
|
||||||
if ( @ports == 2 ) {
|
if ( @ports == 2 ) {
|
||||||
$what = 'port range';
|
$what = 'port range';
|
||||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] && $ports[0] < $ports[1];
|
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
|
||||||
} else {
|
} else {
|
||||||
$what = 'port';
|
$what = 'port';
|
||||||
fatal_error 'Invalid port number (0)' unless $portpair;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
||||||
@@ -503,7 +497,7 @@ sub validate_port_list( $$ ) {
|
|||||||
my ( $proto, $list ) = @_;
|
my ( $proto, $list ) = @_;
|
||||||
my @list = split_list( $list, 'port' );
|
my @list = split_list( $list, 'port' );
|
||||||
|
|
||||||
if ( @list > 1 && $list =~ /[:-]/ ) {
|
if ( @list > 1 && $list =~ /:/ ) {
|
||||||
require_capability( 'XMULTIPORT' , 'Port ranges in a port list', '' );
|
require_capability( 'XMULTIPORT' , 'Port ranges in a port list', '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -200,7 +200,6 @@ sub remove_blacklist( $ ) {
|
|||||||
if ( $changed ) {
|
if ( $changed ) {
|
||||||
rename $fn, "$fn.bak" or fatal_error "Unable to rename $fn to $fn.bak: $!";
|
rename $fn, "$fn.bak" or fatal_error "Unable to rename $fn to $fn.bak: $!";
|
||||||
rename "$fn.new", $fn or fatal_error "Unable to rename $fn.new to $fn: $!";
|
rename "$fn.new", $fn or fatal_error "Unable to rename $fn.new to $fn: $!";
|
||||||
transfer_permissions( "$fn.bak", $fn );
|
|
||||||
progress_message2 "\u$file file $fn saved in $fn.bak"
|
progress_message2 "\u$file file $fn saved in $fn.bak"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +215,6 @@ sub convert_blacklist() {
|
|||||||
my $audit = $disposition =~ /^A_/;
|
my $audit = $disposition =~ /^A_/;
|
||||||
my $target = $disposition;
|
my $target = $disposition;
|
||||||
my $orig_target = $target;
|
my $orig_target = $target;
|
||||||
my $warnings = 0;
|
|
||||||
my @rules;
|
my @rules;
|
||||||
|
|
||||||
if ( @$zones || @$zones1 ) {
|
if ( @$zones || @$zones1 ) {
|
||||||
@@ -238,22 +236,12 @@ sub convert_blacklist() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
directive_callback(
|
|
||||||
sub ()
|
|
||||||
{
|
|
||||||
warning_message "Omitted rules and compiler directives were not translated" unless $warnings++;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
first_entry "Converting $fn...";
|
first_entry "Converting $fn...";
|
||||||
|
|
||||||
while ( read_a_line( NORMAL_READ ) ) {
|
while ( read_a_line( NORMAL_READ ) ) {
|
||||||
my ( $networks, $protocol, $ports, $options ) =
|
my ( $networks, $protocol, $ports, $options ) =
|
||||||
split_rawline2( 'blacklist file',
|
split_line( 'blacklist file',
|
||||||
{ networks => 0, proto => 1, port => 2, options => 3 },
|
{ networks => 0, proto => 1, port => 2, options => 3 } );
|
||||||
{},
|
|
||||||
4,
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( $options eq '-' ) {
|
if ( $options eq '-' ) {
|
||||||
$options = 'src';
|
$options = 'src';
|
||||||
@@ -311,21 +299,18 @@ sub convert_blacklist() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
directive_callback(0);
|
|
||||||
|
|
||||||
if ( @rules ) {
|
if ( @rules ) {
|
||||||
my $fn1 = find_writable_file( 'blrules' );
|
my $fn1 = find_writable_file( 'blrules' );
|
||||||
my $blrules;
|
my $blrules;
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
|
|
||||||
if ( -f $fn1 ) {
|
if ( -f $fn1 ) {
|
||||||
open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
} else {
|
} else {
|
||||||
open $blrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $blrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
transfer_permissions( $fn, $fn1 );
|
|
||||||
print $blrules <<'EOF';
|
print $blrules <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall - Blacklist Rules File
|
# Shorewall version 5.0 - Blacklist Rules File
|
||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall-blrules"
|
# For information about entries in this file, type "man shorewall-blrules"
|
||||||
#
|
#
|
||||||
@@ -407,9 +392,8 @@ sub convert_routestopped() {
|
|||||||
if ( my $fn = open_file 'routestopped' ) {
|
if ( my $fn = open_file 'routestopped' ) {
|
||||||
my ( @allhosts, %source, %dest , %notrack, @rule );
|
my ( @allhosts, %source, %dest , %notrack, @rule );
|
||||||
|
|
||||||
my $seq = 0;
|
my $seq = 0;
|
||||||
my $warnings = 0;
|
my $date = localtime;
|
||||||
my $date = compiletime;
|
|
||||||
|
|
||||||
my ( $stoppedrules, $fn1 );
|
my ( $stoppedrules, $fn1 );
|
||||||
|
|
||||||
@@ -417,10 +401,9 @@ sub convert_routestopped() {
|
|||||||
open $stoppedrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $stoppedrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
} else {
|
} else {
|
||||||
open $stoppedrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $stoppedrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
transfer_permissions( $fn, $fn1 );
|
|
||||||
print $stoppedrules <<'EOF';
|
print $stoppedrules <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall - Stopped Rules File
|
# Shorewall version 5 - Stopped Rules File
|
||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall-stoppedrules"
|
# For information about entries in this file, type "man shorewall-stoppedrules"
|
||||||
#
|
#
|
||||||
@@ -436,16 +419,9 @@ sub convert_routestopped() {
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
directive_callback(
|
|
||||||
sub ()
|
|
||||||
{
|
|
||||||
warning_message "Omitted rules and compiler directives were not translated" unless $warnings++;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
first_entry(
|
first_entry(
|
||||||
sub {
|
sub {
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
progress_message2 "$doing $fn...";
|
progress_message2 "$doing $fn...";
|
||||||
print( $stoppedrules
|
print( $stoppedrules
|
||||||
"#\n" ,
|
"#\n" ,
|
||||||
@@ -457,16 +433,13 @@ EOF
|
|||||||
while ( read_a_line ( NORMAL_READ ) ) {
|
while ( read_a_line ( NORMAL_READ ) ) {
|
||||||
|
|
||||||
my ($interface, $hosts, $options , $proto, $ports, $sports ) =
|
my ($interface, $hosts, $options , $proto, $ports, $sports ) =
|
||||||
split_rawline2( 'routestopped file',
|
split_line( 'routestopped file',
|
||||||
{ interface => 0, hosts => 1, options => 2, proto => 3, dport => 4, sport => 5 },
|
{ interface => 0, hosts => 1, options => 2, proto => 3, dport => 4, sport => 5 } );
|
||||||
{},
|
|
||||||
6,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
my $interfaceref;
|
my $interfaceref;
|
||||||
|
|
||||||
fatal_error 'INTERFACE must be specified' if $interface eq '-';
|
fatal_error 'INTERFACE must be specified' if $interface eq '-';
|
||||||
|
fatal_error "Unknown interface ($interface)" unless $interfaceref = known_interface $interface;
|
||||||
$hosts = ALLIP unless $hosts && $hosts ne '-';
|
$hosts = ALLIP unless $hosts && $hosts ne '-';
|
||||||
|
|
||||||
my $routeback = 0;
|
my $routeback = 0;
|
||||||
@@ -480,6 +453,8 @@ EOF
|
|||||||
$hosts = ALLIP if $hosts eq '-';
|
$hosts = ALLIP if $hosts eq '-';
|
||||||
|
|
||||||
for my $host ( split /,/, $hosts ) {
|
for my $host ( split /,/, $hosts ) {
|
||||||
|
fatal_error "Ipsets not allowed with SAVE_IPSETS=Yes" if $host =~ /^!?\+/ && $config{SAVE_IPSETS};
|
||||||
|
validate_host $host, 1;
|
||||||
push @hosts, "$interface|$host|$seq";
|
push @hosts, "$interface|$host|$seq";
|
||||||
push @rule, $rule;
|
push @rule, $rule;
|
||||||
}
|
}
|
||||||
@@ -523,8 +498,6 @@ EOF
|
|||||||
push @allhosts, @hosts;
|
push @allhosts, @hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
directive_callback(0);
|
|
||||||
|
|
||||||
for my $host ( @allhosts ) {
|
for my $host ( @allhosts ) {
|
||||||
my ( $interface, $h, $seq ) = split /\|/, $host;
|
my ( $interface, $h, $seq ) = split /\|/, $host;
|
||||||
my $rule = shift @rule;
|
my $rule = shift @rule;
|
||||||
@@ -676,15 +649,9 @@ sub create_docker_rules() {
|
|||||||
add_ijump( $chainref, j => 'ACCEPT', o => 'docker0', state_imatch 'ESTABLISHED,RELATED' );
|
add_ijump( $chainref, j => 'ACCEPT', o => 'docker0', state_imatch 'ESTABLISHED,RELATED' );
|
||||||
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => '! docker0' );
|
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => '! docker0' );
|
||||||
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => 'docker0' ) if $dockerref->{options}{routeback};
|
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => 'docker0' ) if $dockerref->{options}{routeback};
|
||||||
|
add_ijump( $filter_table->{OUTPUT}, j => 'DOCKER' );
|
||||||
decr_cmd_level( $chainref );
|
decr_cmd_level( $chainref );
|
||||||
add_commands( $chainref, 'fi' );
|
add_commands( $chainref, 'fi' );
|
||||||
|
|
||||||
my $outputref;
|
|
||||||
add_commands( $outputref = $filter_table->{OUTPUT}, 'if [ -n "$g_docker" ]; then' );
|
|
||||||
incr_cmd_level( $outputref );
|
|
||||||
add_ijump( $outputref, j => 'DOCKER' );
|
|
||||||
decr_cmd_level( $outputref );
|
|
||||||
add_commands( $outputref, 'fi' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_FORWARD ] && cat $VARDIR/.filter_FORWARD >&3', );
|
add_commands( $chainref, '[ -f ${VARDIR}/.filter_FORWARD ] && cat $VARDIR/.filter_FORWARD >&3', );
|
||||||
@@ -712,8 +679,7 @@ sub add_common_rules ( $ ) {
|
|||||||
my $dbl_ipset;
|
my $dbl_ipset;
|
||||||
my $dbl_level;
|
my $dbl_level;
|
||||||
my $dbl_tag;
|
my $dbl_tag;
|
||||||
my $dbl_src_target;
|
my $dbl_target;
|
||||||
my $dbl_dst_target;
|
|
||||||
|
|
||||||
if ( $config{REJECT_ACTION} ) {
|
if ( $config{REJECT_ACTION} ) {
|
||||||
process_reject_action;
|
process_reject_action;
|
||||||
@@ -774,42 +740,8 @@ sub add_common_rules ( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $dbl_ipset ) {
|
if ( $dbl_ipset ) {
|
||||||
if ( $val = $globals{DBL_TIMEOUT} ) {
|
if ( $dbl_level ) {
|
||||||
$dbl_src_target = $globals{DBL_OPTIONS} =~ /src-dst/ ? 'dbl_src' : 'dbl_log';
|
my $chainref = set_optflags( new_standard_chain( $dbl_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||||
|
|
||||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target ) , DONT_OPTIMIZE | DONT_DELETE );
|
|
||||||
|
|
||||||
log_rule_limit( $dbl_level,
|
|
||||||
$chainref,
|
|
||||||
'dbl_log',
|
|
||||||
'DROP',
|
|
||||||
$globals{LOGLIMIT},
|
|
||||||
$dbl_tag,
|
|
||||||
'add',
|
|
||||||
'',
|
|
||||||
$origin{DYNAMIC_BLACKLIST} ) if $dbl_level;
|
|
||||||
add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} );
|
|
||||||
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
|
|
||||||
|
|
||||||
if ( $dbl_src_target eq 'dbl_src' ) {
|
|
||||||
$chainref = set_optflags( new_standard_chain( $dbl_dst_target = 'dbl_dst' ) , DONT_OPTIMIZE | DONT_DELETE );
|
|
||||||
|
|
||||||
log_rule_limit( $dbl_level,
|
|
||||||
$chainref,
|
|
||||||
'dbl_log',
|
|
||||||
'DROP',
|
|
||||||
$globals{LOGLIMIT},
|
|
||||||
$dbl_tag,
|
|
||||||
'add',
|
|
||||||
'',
|
|
||||||
$origin{DYNAMIC_BLACKLIST} ) if $dbl_level;
|
|
||||||
add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset dst --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} );
|
|
||||||
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
|
|
||||||
} else {
|
|
||||||
$dbl_dst_target = $dbl_src_target;
|
|
||||||
}
|
|
||||||
} elsif ( $dbl_level ) {
|
|
||||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
|
||||||
|
|
||||||
log_rule_limit( $dbl_level,
|
log_rule_limit( $dbl_level,
|
||||||
$chainref,
|
$chainref,
|
||||||
@@ -822,7 +754,7 @@ sub add_common_rules ( $ ) {
|
|||||||
$origin{DYNAMIC_BLACKLIST} );
|
$origin{DYNAMIC_BLACKLIST} );
|
||||||
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
|
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
|
||||||
} else {
|
} else {
|
||||||
$dbl_src_target = $dbl_dst_target = 'DROP';
|
$dbl_target = 'DROP';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -928,30 +860,13 @@ sub add_common_rules ( $ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $dbl_ipset && ( ( my $setting = get_interface_option( $interface, 'dbl' ) ) ne '0:0' ) ) {
|
if ( $dbl_ipset && ! get_interface_option( $interface, 'nodbl' ) ) {
|
||||||
|
add_ijump_extended( $filter_table->{input_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
||||||
my ( $in, $out ) = split /:/, $setting;
|
add_ijump_extended( $filter_table->{output_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" ) if $dbl_type =~ /,src-dst$/;
|
||||||
|
|
||||||
if ( $in == 1 ) {
|
|
||||||
#
|
|
||||||
# src
|
|
||||||
#
|
|
||||||
add_ijump_extended( $filter_table->{input_option_chain($interface)}, j => $dbl_src_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
|
||||||
add_ijump_extended( $filter_table->{forward_option_chain($interface)}, j => $dbl_src_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
|
||||||
} elsif ( $in == 2 ) {
|
|
||||||
add_ijump_extended( $filter_table->{forward_option_chain($interface)}, j => $dbl_dst_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $out == 2 ) {
|
|
||||||
#
|
|
||||||
# dst
|
|
||||||
#
|
|
||||||
add_ijump_extended( $filter_table->{output_option_chain($interface)}, j => $dbl_dst_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( option_chains( $interface ) ) {
|
for ( option_chains( $interface ) ) {
|
||||||
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref && ( get_interface_option( $interface, 'dbl' ) ne '0:0' );
|
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref && ! get_interface_option( $interface, 'nodbl' );
|
||||||
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2764,9 +2679,6 @@ EOF
|
|||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit '
|
emit '
|
||||||
rm -f ${VARDIR}/*.address
|
|
||||||
rm -f ${VARDIR}/*.gateway
|
|
||||||
|
|
||||||
run_stopped_exit';
|
run_stopped_exit';
|
||||||
|
|
||||||
my @ipsets = all_ipsets;
|
my @ipsets = all_ipsets;
|
||||||
|
@@ -36,8 +36,8 @@ use Shorewall::Providers qw( provider_realm );
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
|
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
|
||||||
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule process_one_masq convert_masq @addresses_to_add %addresses_to_add ) ] );
|
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule ) ] );
|
||||||
our @EXPORT_OK = ();
|
our @EXPORT_OK = ();
|
||||||
|
|
||||||
Exporter::export_ok_tags('rules');
|
Exporter::export_ok_tags('rules');
|
||||||
@@ -62,7 +62,7 @@ sub initialize($) {
|
|||||||
#
|
#
|
||||||
sub process_one_masq1( $$$$$$$$$$$ )
|
sub process_one_masq1( $$$$$$$$$$$ )
|
||||||
{
|
{
|
||||||
my ( $interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
my ($interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||||
|
|
||||||
my $pre_nat;
|
my $pre_nat;
|
||||||
my $add_snat_aliases = $family == F_IPV4 && $config{ADD_SNAT_ALIASES};
|
my $add_snat_aliases = $family == F_IPV4 && $config{ADD_SNAT_ALIASES};
|
||||||
@@ -70,12 +70,10 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
my $baserule = '';
|
my $baserule = '';
|
||||||
my $inlinematches = '';
|
my $inlinematches = '';
|
||||||
my $prerule = '';
|
my $prerule = '';
|
||||||
my $savelist;
|
|
||||||
#
|
#
|
||||||
# Leading '+'
|
# Leading '+'
|
||||||
#
|
#
|
||||||
$pre_nat = 1 if $interfacelist =~ s/^\+//;
|
$pre_nat = 1 if $interfacelist =~ s/^\+//;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for INLINE
|
# Check for INLINE
|
||||||
#
|
#
|
||||||
@@ -84,9 +82,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
$inlinematches = get_inline_matches(0);
|
$inlinematches = get_inline_matches(0);
|
||||||
} else {
|
} else {
|
||||||
$inlinematches = get_inline_matches(0);
|
$inlinematches = get_inline_matches(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$savelist = $interfacelist;
|
|
||||||
#
|
#
|
||||||
# Handle early matches
|
# Handle early matches
|
||||||
#
|
#
|
||||||
@@ -153,12 +149,9 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
$baserule .= do_user( $user ) if $user ne '-';
|
$baserule .= do_user( $user ) if $user ne '-';
|
||||||
$baserule .= do_probability( $probability ) if $probability ne '-';
|
$baserule .= do_probability( $probability ) if $probability ne '-';
|
||||||
|
|
||||||
my $target;
|
|
||||||
|
|
||||||
for my $fullinterface (split_list $interfacelist, 'interface' ) {
|
for my $fullinterface (split_list $interfacelist, 'interface' ) {
|
||||||
my $rule = '';
|
my $rule = '';
|
||||||
|
my $target = 'MASQUERADE ';
|
||||||
$target = 'MASQUERADE ';
|
|
||||||
#
|
#
|
||||||
# Isolate and verify the interface part
|
# Isolate and verify the interface part
|
||||||
#
|
#
|
||||||
@@ -200,7 +193,6 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
# Parse the ADDRESSES column
|
# Parse the ADDRESSES column
|
||||||
#
|
#
|
||||||
if ( $addresses ne '-' ) {
|
if ( $addresses ne '-' ) {
|
||||||
my $saveaddresses = $addresses;
|
|
||||||
if ( $addresses eq 'random' ) {
|
if ( $addresses eq 'random' ) {
|
||||||
require_capability( 'MASQUERADE_TGT', 'Masquerade rules', '') if $family == F_IPV6;
|
require_capability( 'MASQUERADE_TGT', 'Masquerade rules', '') if $family == F_IPV6;
|
||||||
$randomize = '--random ';
|
$randomize = '--random ';
|
||||||
@@ -232,7 +224,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
my $addrlist = '';
|
my $addrlist = '';
|
||||||
my @addrs = split_list $addresses, 'address';
|
my @addrs = split_list $addresses, 'address';
|
||||||
|
|
||||||
fatal_error "Only one ADDRESS may be specified" if @addrs > 1;
|
fatal_error "Only one IPv6 ADDRESS may be specified" if $family == F_IPV6 && @addrs > 1;
|
||||||
|
|
||||||
for my $addr ( @addrs ) {
|
for my $addr ( @addrs ) {
|
||||||
if ( $addr =~ /^([&%])(.+)$/ ) {
|
if ( $addr =~ /^([&%])(.+)$/ ) {
|
||||||
@@ -248,7 +240,6 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
# Address Variable
|
# Address Variable
|
||||||
#
|
#
|
||||||
$target = 'SNAT ';
|
$target = 'SNAT ';
|
||||||
|
|
||||||
if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
|
||||||
#
|
#
|
||||||
# User-defined address variable
|
# User-defined address variable
|
||||||
@@ -278,20 +269,14 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
} elsif ( $family == F_IPV4 ) {
|
} elsif ( $family == F_IPV4 ) {
|
||||||
if ( $addr =~ /^.*\..*\..*\./ ) {
|
if ( $addr =~ /^.*\..*\..*\./ ) {
|
||||||
$target = 'SNAT ';
|
$target = 'SNAT ';
|
||||||
my ($ipaddr, $rest) = split ':', $addr, 2;
|
my ($ipaddr, $rest) = split ':', $addr;
|
||||||
if ( $ipaddr =~ /^(.+)-(.+)$/ ) {
|
if ( $ipaddr =~ /^(.+)-(.+)$/ ) {
|
||||||
validate_range( $1, $2 );
|
validate_range( $1, $2 );
|
||||||
} else {
|
} else {
|
||||||
validate_address $ipaddr, 0;
|
validate_address $ipaddr, 0;
|
||||||
}
|
}
|
||||||
|
validate_portpair1( $proto, $rest ) if supplied $rest;
|
||||||
if ( supplied $rest ) {
|
$addrlist .= "--to-source $addr ";
|
||||||
validate_portpair1( $proto, $rest );
|
|
||||||
$addrlist .= "--to-source $addr ";
|
|
||||||
} else {
|
|
||||||
$addrlist .= "--to-source $ipaddr";
|
|
||||||
}
|
|
||||||
|
|
||||||
$exceptionrule = do_proto( $proto, '', '' ) if $addr =~ /:/;
|
$exceptionrule = do_proto( $proto, '', '' ) if $addr =~ /:/;
|
||||||
} else {
|
} else {
|
||||||
my $ports = $addr;
|
my $ports = $addr;
|
||||||
@@ -352,7 +337,6 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
|
|
||||||
$target .= $randomize;
|
$target .= $randomize;
|
||||||
$target .= $persistent;
|
$target .= $persistent;
|
||||||
$addresses = $saveaddresses;
|
|
||||||
} else {
|
} else {
|
||||||
require_capability( 'MASQUERADE_TGT', 'Masquerade rules', '' ) if $family == F_IPV6;
|
require_capability( 'MASQUERADE_TGT', 'Masquerade rules', '' ) if $family == F_IPV6;
|
||||||
$add_snat_aliases = 0;
|
$add_snat_aliases = 0;
|
||||||
@@ -402,250 +386,32 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub convert_one_masq1( $$$$$$$$$$$$ )
|
sub process_one_masq( )
|
||||||
{
|
{
|
||||||
my ( $snat, $interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
my ($interfacelist, $networks, $addresses, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
||||||
|
split_line2( 'masq file',
|
||||||
|
{ interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9, probability => 10 },
|
||||||
|
{}, #Nopad
|
||||||
|
undef, #Columns
|
||||||
|
1 ); #Allow inline matches
|
||||||
|
|
||||||
my $pre_nat;
|
fatal_error 'INTERFACE must be specified' if $interfacelist eq '-';
|
||||||
my $destnets = '';
|
|
||||||
my $savelist;
|
for my $proto ( split_list $protos, 'Protocol' ) {
|
||||||
#
|
process_one_masq1( $interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
||||||
# Leading '+'
|
|
||||||
#
|
|
||||||
$pre_nat = ( $interfacelist =~ s/^\+// );
|
|
||||||
#
|
|
||||||
# Check for INLINE
|
|
||||||
#
|
|
||||||
if ( $interfacelist =~ /^INLINE\((.+)\)$/ ) {
|
|
||||||
$interfacelist = $1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$savelist = $interfacelist;
|
|
||||||
#
|
|
||||||
# Parse the remaining part of the INTERFACE column
|
|
||||||
#
|
|
||||||
if ( $family == F_IPV4 ) {
|
|
||||||
if ( $interfacelist =~ /^([^:]+)::([^:]*)$/ ) {
|
|
||||||
$destnets = $2;
|
|
||||||
$interfacelist = $1;
|
|
||||||
} elsif ( $interfacelist =~ /^([^:]+:[^:]+):([^:]+)$/ ) {
|
|
||||||
$destnets = $2;
|
|
||||||
$interfacelist = $1;
|
|
||||||
} elsif ( $interfacelist =~ /^([^:]+):$/ ) {
|
|
||||||
$interfacelist = $1;
|
|
||||||
} elsif ( $interfacelist =~ /^([^:]+):([^:]*)$/ ) {
|
|
||||||
my ( $one, $two ) = ( $1, $2 );
|
|
||||||
if ( $2 =~ /\./ || $2 =~ /^%/ ) {
|
|
||||||
$interfacelist = $one;
|
|
||||||
$destnets = $two;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elsif ( $interfacelist =~ /^(.+?):(.+)$/ ) {
|
|
||||||
$interfacelist = $1;
|
|
||||||
$destnets = $2;
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# If there is no source or destination then allow all addresses
|
|
||||||
#
|
|
||||||
$networks = ALLIP if $networks eq '-';
|
|
||||||
$destnets = ALLIP if $destnets eq '-';
|
|
||||||
|
|
||||||
my $target;
|
|
||||||
#
|
|
||||||
# Parse the ADDRESSES column
|
|
||||||
#
|
|
||||||
if ( $addresses ne '-' ) {
|
|
||||||
my $saveaddresses = $addresses;
|
|
||||||
if ( $addresses ne 'random' ) {
|
|
||||||
$addresses =~ s/:persistent$//;
|
|
||||||
$addresses =~ s/:random$//;
|
|
||||||
|
|
||||||
if ( $addresses eq 'detect' ) {
|
|
||||||
$target = 'SNAT';
|
|
||||||
} elsif ( $addresses eq 'NONAT' ) {
|
|
||||||
$target = 'CONTINUE';
|
|
||||||
} elsif ( $addresses ) {
|
|
||||||
if ( $addresses =~ /^:/ ) {
|
|
||||||
$target = 'MASQUERADE';
|
|
||||||
} else {
|
|
||||||
$target = 'SNAT';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$addresses = $saveaddresses;
|
|
||||||
} else {
|
|
||||||
$target = 'MASQUERADE';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $snat ) {
|
|
||||||
$target .= '+' if $pre_nat;
|
|
||||||
|
|
||||||
if ( $addresses ne '-' && $addresses ne 'NONAT' ) {
|
|
||||||
$addresses =~ s/^://;
|
|
||||||
$target .= '(' . $addresses . ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
my $line = "$target\t$networks\t$savelist\t$proto\t$ports\t$ipsec\t$mark\t$user\t$condition\t$origdest\t$probability";
|
|
||||||
#
|
|
||||||
# Supress superfluous trailing dashes
|
|
||||||
#
|
|
||||||
$line =~ s/(?:\t-)+$//;
|
|
||||||
|
|
||||||
my $raw_matches = fetch_inline_matches;
|
|
||||||
|
|
||||||
$line .= join( '', ' ;;', $raw_matches ) if $raw_matches ne ' ';
|
|
||||||
|
|
||||||
print $snat "$line\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
progress_message " Masq record \"$rawcurrentline\" Converted";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub process_one_masq( $ )
|
#
|
||||||
|
# Process the masq file
|
||||||
|
#
|
||||||
|
sub setup_masq()
|
||||||
{
|
{
|
||||||
my ( $snat ) = @_;
|
|
||||||
|
|
||||||
if ( $snat ) {
|
|
||||||
unless ( $rawcurrentline =~ /^\s*(?:#.*)?$/ ) {
|
|
||||||
#
|
|
||||||
# Line was not blank or all comment
|
|
||||||
#
|
|
||||||
my ($interfacelist, $networks, $addresses, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
|
||||||
split_rawline2( 'masq file',
|
|
||||||
{ interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9, probability => 10 },
|
|
||||||
{}, #Nopad
|
|
||||||
undef, #Columns
|
|
||||||
1 ); #Allow inline matches
|
|
||||||
|
|
||||||
if ( $interfacelist ne '-' ) {
|
|
||||||
for my $proto ( split_list $protos, 'Protocol' ) {
|
|
||||||
convert_one_masq1( $snat, $interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
my ($interfacelist, $networks, $addresses, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
|
||||||
split_line2( 'masq file',
|
|
||||||
{ interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9, probability => 10 },
|
|
||||||
{}, #Nopad
|
|
||||||
undef, #Columns
|
|
||||||
1 ); #Allow inline matches
|
|
||||||
|
|
||||||
fatal_error 'INTERFACE must be specified' if $interfacelist eq '-';
|
|
||||||
|
|
||||||
for my $proto ( split_list $protos, 'Protocol' ) {
|
|
||||||
process_one_masq1( $interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub open_snat_for_output( $ ) {
|
|
||||||
my ($fn ) = @_;
|
|
||||||
my ( $snat, $fn1 );
|
|
||||||
|
|
||||||
if ( -f ( $fn1 = find_writable_file( 'snat' ) ) ) {
|
|
||||||
open( $snat , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
|
||||||
} else {
|
|
||||||
open( $snat , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
|
||||||
#
|
|
||||||
# Transfer permissions from the existing masq file to the new snat file
|
|
||||||
#
|
|
||||||
transfer_permissions( $fn, $fn1 );
|
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
|
||||||
print $snat <<'EOF';
|
|
||||||
#
|
|
||||||
# Shorewall - SNAT/Masquerade File
|
|
||||||
#
|
|
||||||
# For information about entries in this file, type "man shorewall-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages/shorewall-snat.html for additional information
|
|
||||||
EOF
|
|
||||||
} else {
|
|
||||||
print $snat <<'EOF';
|
|
||||||
#
|
|
||||||
# Shorewall6 - SNAT/Masquerade File
|
|
||||||
#
|
|
||||||
# For information about entries in this file, type "man shorewall6-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages6/shorewall6-snat.html for additional information
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
print $snat <<'EOF';
|
|
||||||
###################################################################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( $snat, $fn1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Convert a masq file into the equivalent snat file
|
|
||||||
#
|
|
||||||
sub convert_masq() {
|
|
||||||
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
||||||
my ( $snat, $fn1 ) = open_snat_for_output( $fn );
|
|
||||||
|
|
||||||
my $have_masq_rules;
|
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } );
|
||||||
|
|
||||||
directive_callback(
|
process_one_masq while read_a_line( NORMAL_READ );
|
||||||
sub ()
|
|
||||||
{
|
|
||||||
if ( $_[0] eq 'OMITTED' ) {
|
|
||||||
#
|
|
||||||
# Convert the raw rule
|
|
||||||
#
|
|
||||||
process_one_masq( $snat) if $snat;
|
|
||||||
} else {
|
|
||||||
print $snat "$_[1]\n"; 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
first_entry(
|
|
||||||
sub {
|
|
||||||
my $date = compiletime;
|
|
||||||
progress_message2 "Converting $fn...";
|
|
||||||
print( $snat
|
|
||||||
"#\n" ,
|
|
||||||
"# Rules generated from masq file $fn by Shorewall $globals{VERSION} - $date\n" ,
|
|
||||||
"#\n" );
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
while ( read_a_line( NORMAL_READ ) ) {
|
|
||||||
#
|
|
||||||
# Process the file normally
|
|
||||||
#
|
|
||||||
process_one_masq(0);
|
|
||||||
#
|
|
||||||
# Now Convert it
|
|
||||||
#
|
|
||||||
process_one_masq($snat);
|
|
||||||
|
|
||||||
$have_masq_rules++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $have_masq_rules ) {
|
|
||||||
progress_message2 "Converted $fn to $fn1";
|
|
||||||
if ( rename $fn, "$fn.bak" ) {
|
|
||||||
progress_message2 "$fn renamed $fn.bak";
|
|
||||||
} else {
|
|
||||||
fatal_error "Cannot Rename $fn to $fn.bak: $!";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( unlink $fn ) {
|
|
||||||
warning_message "Empty masq file ($fn) removed";
|
|
||||||
} else {
|
|
||||||
warning_message "Unable to remove empty masq file $fn: $!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close $snat, directive_callback( 0 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -125,13 +125,6 @@ sub setup_route_marking() {
|
|||||||
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
|
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
|
||||||
|
|
||||||
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
|
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
|
||||||
#
|
|
||||||
# Clear the mark -- we have seen cases where the mark is non-zero even in the raw table chains!
|
|
||||||
#
|
|
||||||
|
|
||||||
if ( $config{ZERO_MARKS} ) {
|
|
||||||
add_ijump( $mangle_table->{$_}, j => 'MARK', targetopts => '--set-mark 0' ) for qw/PREROUTING OUTPUT/;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $config{RESTORE_ROUTEMARKS} ) {
|
if ( $config{RESTORE_ROUTEMARKS} ) {
|
||||||
add_ijump $mangle_table->{$_} , j => 'CONNMARK', targetopts => "--restore-mark --mask $mask" for qw/PREROUTING OUTPUT/;
|
add_ijump $mangle_table->{$_} , j => 'CONNMARK', targetopts => "--restore-mark --mask $mask" for qw/PREROUTING OUTPUT/;
|
||||||
@@ -220,14 +213,7 @@ sub copy_table( $$$ ) {
|
|||||||
' esac',
|
' esac',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
emit ( ' case $net in',
|
emit ( " run_ip route add table $number \$net \$route $realm" );
|
||||||
' fe80:*)',
|
|
||||||
' ;;',
|
|
||||||
' *)',
|
|
||||||
" run_ip route add table $number \$net \$route $realm",
|
|
||||||
' ;;',
|
|
||||||
' esac',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit ( ' ;;',
|
emit ( ' ;;',
|
||||||
@@ -298,14 +284,7 @@ sub copy_and_edit_table( $$$$$ ) {
|
|||||||
' esac',
|
' esac',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
emit ( ' case $net in',
|
emit ( " run_ip route add table $id \$net \$route $realm" );
|
||||||
' fe80:*)',
|
|
||||||
' ;;',
|
|
||||||
' *)',
|
|
||||||
" run_ip route add table $id \$net \$route $realm",
|
|
||||||
' ;;',
|
|
||||||
' esac',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit ( ' ;;',
|
emit ( ' ;;',
|
||||||
@@ -323,14 +302,27 @@ sub balance_default_route( $$$$ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $first_default_route ) {
|
if ( $first_default_route ) {
|
||||||
if ( $gateway ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
if ( $gateway ) {
|
||||||
|
emit "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
||||||
|
} else {
|
||||||
|
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
#
|
||||||
|
# IPv6 doesn't support multi-hop routes
|
||||||
|
#
|
||||||
|
if ( $gateway ) {
|
||||||
|
emit "DEFAULT_ROUTE=\"via $gateway dev $interface $realm\"";
|
||||||
|
} else {
|
||||||
|
emit "DEFAULT_ROUTE=\"dev $interface $realm\"";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$first_default_route = 0;
|
$first_default_route = 0;
|
||||||
} else {
|
} else {
|
||||||
|
fatal_error "Only one 'balance' provider is allowed with IPv6" if $family == F_IPV6;
|
||||||
|
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
emit "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
||||||
} else {
|
} else {
|
||||||
@@ -347,14 +339,27 @@ sub balance_fallback_route( $$$$ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $first_fallback_route ) {
|
if ( $first_fallback_route ) {
|
||||||
if ( $gateway ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit "FALLBACK_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
if ( $gateway ) {
|
||||||
|
emit "FALLBACK_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
||||||
|
} else {
|
||||||
|
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
#
|
||||||
|
# IPv6 doesn't support multi-hop routes
|
||||||
|
#
|
||||||
|
if ( $gateway ) {
|
||||||
|
emit "FALLBACK_ROUTE=\"via $gateway dev $interface $realm\"";
|
||||||
|
} else {
|
||||||
|
emit "FALLBACK_ROUTE=\"dev $interface $realm\"";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$first_fallback_route = 0;
|
$first_fallback_route = 0;
|
||||||
} else {
|
} else {
|
||||||
|
fatal_error "Only one 'fallback' provider is allowed with IPv6" if $family == F_IPV6;
|
||||||
|
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit "FALLBACK_ROUTE=\"\$FALLBACK_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
emit "FALLBACK_ROUTE=\"\$FALLBACK_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
||||||
} else {
|
} else {
|
||||||
@@ -486,14 +491,12 @@ sub process_a_provider( $ ) {
|
|||||||
|
|
||||||
if ( ( $gw = lc $gateway ) eq 'detect' ) {
|
if ( ( $gw = lc $gateway ) eq 'detect' ) {
|
||||||
fatal_error "Configuring multiple providers through one interface requires an explicit gateway" if $shared;
|
fatal_error "Configuring multiple providers through one interface requires an explicit gateway" if $shared;
|
||||||
$gateway = get_interface_gateway( $interface, undef, 1 );
|
$gateway = get_interface_gateway $interface;
|
||||||
$gatewaycase = 'detect';
|
$gatewaycase = 'detect';
|
||||||
set_interface_option( $interface, 'gateway', 'detect' );
|
|
||||||
} elsif ( $gw eq 'none' ) {
|
} elsif ( $gw eq 'none' ) {
|
||||||
fatal_error "Configuring multiple providers through one interface requires a gateway" if $shared;
|
fatal_error "Configuring multiple providers through one interface requires a gateway" if $shared;
|
||||||
$gatewaycase = 'none';
|
$gatewaycase = 'none';
|
||||||
$gateway = '';
|
$gateway = '';
|
||||||
set_interface_option( $interface, 'gateway', 'none' );
|
|
||||||
} elsif ( $gateway && $gateway ne '-' ) {
|
} elsif ( $gateway && $gateway ne '-' ) {
|
||||||
( $gateway, $mac ) = split_host_list( $gateway, 0 );
|
( $gateway, $mac ) = split_host_list( $gateway, 0 );
|
||||||
validate_address $gateway, 0;
|
validate_address $gateway, 0;
|
||||||
@@ -507,15 +510,12 @@ sub process_a_provider( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$gatewaycase = 'specified';
|
$gatewaycase = 'specified';
|
||||||
set_interface_option( $interface, 'gateway', $gateway );
|
|
||||||
} else {
|
} else {
|
||||||
$gatewaycase = 'omitted';
|
$gatewaycase = 'omitted';
|
||||||
fatal_error "Configuring multiple providers through one interface requires a gateway" if $shared;
|
fatal_error "Configuring multiple providers through one interface requires a gateway" if $shared;
|
||||||
$gateway = '';
|
$gateway = '';
|
||||||
set_interface_option( $interface, 'gateway', $pseudo ? 'detect' : 'omitted' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my ( $loose, $track, $balance, $default, $default_balance, $optional, $mtu, $tproxy, $local, $load, $what, $hostroute, $persistent );
|
my ( $loose, $track, $balance, $default, $default_balance, $optional, $mtu, $tproxy, $local, $load, $what, $hostroute, $persistent );
|
||||||
|
|
||||||
if ( $pseudo ) {
|
if ( $pseudo ) {
|
||||||
@@ -535,6 +535,7 @@ sub process_a_provider( $ ) {
|
|||||||
$track = 0;
|
$track = 0;
|
||||||
} elsif ( $option =~ /^balance=(\d+)$/ ) {
|
} elsif ( $option =~ /^balance=(\d+)$/ ) {
|
||||||
fatal_error q('balance' may not be spacified when GATEWAY is 'none') if $gatewaycase eq 'none';
|
fatal_error q('balance' may not be spacified when GATEWAY is 'none') if $gatewaycase eq 'none';
|
||||||
|
fatal_error q('balance=<weight>' is not available in IPv6) if $family == F_IPV6;
|
||||||
fatal_error 'The balance setting must be non-zero' unless $1;
|
fatal_error 'The balance setting must be non-zero' unless $1;
|
||||||
$balance = $1;
|
$balance = $1;
|
||||||
} elsif ( $option eq 'balance' || $option eq 'primary') {
|
} elsif ( $option eq 'balance' || $option eq 'primary') {
|
||||||
@@ -557,6 +558,7 @@ sub process_a_provider( $ ) {
|
|||||||
$mtu = "mtu $1 ";
|
$mtu = "mtu $1 ";
|
||||||
} elsif ( $option =~ /^fallback=(\d+)$/ ) {
|
} elsif ( $option =~ /^fallback=(\d+)$/ ) {
|
||||||
fatal_error q('fallback' may not be spacified when GATEWAY is 'none') if $gatewaycase eq 'none';
|
fatal_error q('fallback' may not be spacified when GATEWAY is 'none') if $gatewaycase eq 'none';
|
||||||
|
fatal_error q('fallback=<weight>' is not available in IPv6) if $family == F_IPV6;
|
||||||
$default = $1;
|
$default = $1;
|
||||||
$default_balance = 0;
|
$default_balance = 0;
|
||||||
fatal_error 'fallback must be non-zero' unless $default;
|
fatal_error 'fallback must be non-zero' unless $default;
|
||||||
@@ -684,7 +686,6 @@ sub process_a_provider( $ ) {
|
|||||||
interface => $interface ,
|
interface => $interface ,
|
||||||
physical => $physical ,
|
physical => $physical ,
|
||||||
optional => $optional ,
|
optional => $optional ,
|
||||||
wildcard => $interfaceref->{wildcard} || 0,
|
|
||||||
gateway => $gateway ,
|
gateway => $gateway ,
|
||||||
gatewaycase => $gatewaycase ,
|
gatewaycase => $gatewaycase ,
|
||||||
shared => $shared ,
|
shared => $shared ,
|
||||||
@@ -744,9 +745,9 @@ sub emit_started_message( $$$$$ ) {
|
|||||||
my ( $spaces, $level, $pseudo, $name, $number ) = @_;
|
my ( $spaces, $level, $pseudo, $name, $number ) = @_;
|
||||||
|
|
||||||
if ( $pseudo ) {
|
if ( $pseudo ) {
|
||||||
emit qq(${spaces}progress_message${level} "Optional interface $name Started");
|
emit qq(${spaces}progress_message${level} " Optional interface $name Started");
|
||||||
} else {
|
} else {
|
||||||
emit qq(${spaces}progress_message${level} "Provider $name ($number) Started");
|
emit qq(${spaces}progress_message${level} " Provider $name ($number) Started");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,10 +801,6 @@ sub add_a_provider( $$ ) {
|
|||||||
|
|
||||||
push_indent;
|
push_indent;
|
||||||
|
|
||||||
emit( "if interface_is_up $physical; then" );
|
|
||||||
|
|
||||||
push_indent;
|
|
||||||
|
|
||||||
if ( $gatewaycase eq 'omitted' ) {
|
if ( $gatewaycase eq 'omitted' ) {
|
||||||
if ( $tproxy ) {
|
if ( $tproxy ) {
|
||||||
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
||||||
@@ -813,19 +810,22 @@ sub add_a_provider( $$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
$address = get_interface_address( $interface, 1 ) unless $address;
|
$address = get_interface_address $interface unless $address;
|
||||||
|
|
||||||
emit( qq([ -z "$address" ] && return\n) );
|
emit( qq([ -z "$address" ] && return\n) );
|
||||||
|
|
||||||
if ( $hostroute ) {
|
if ( $hostroute ) {
|
||||||
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
|
if ( $family == F_IPV4 ) {
|
||||||
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
|
||||||
emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu} > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
} else {
|
||||||
|
emit qq(qt \$IP -6 route add $gateway src $address dev $physical ${mtu});
|
||||||
|
emit qq(qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
|
emit qq(run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm" );
|
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm";
|
||||||
emit( qq( echo "\$IP route del default via $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $noautosrc ) {
|
if ( ! $noautosrc ) {
|
||||||
@@ -854,10 +854,8 @@ sub add_a_provider( $$ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_indent;
|
emit( qq(\n),
|
||||||
|
qq(rm -f \${VARDIR}/${physical}_enabled) );
|
||||||
emit( qq(fi\n),
|
|
||||||
qq(echo 1 > \${VARDIR}/${physical}_disabled) );
|
|
||||||
|
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@@ -939,11 +937,17 @@ CEOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
$address = get_interface_address( $interface, 1 ) unless $address;
|
$address = get_interface_address $interface unless $address;
|
||||||
|
|
||||||
if ( $hostroute ) {
|
if ( $hostroute ) {
|
||||||
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
|
if ( $family == F_IPV4 ) {
|
||||||
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
|
||||||
|
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
|
} else {
|
||||||
|
emit qq(qt \$IP -6 route add $gateway src $address dev $physical ${mtu});
|
||||||
|
emit qq(qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
|
emit qq(run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm";
|
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm";
|
||||||
@@ -957,8 +961,13 @@ CEOF
|
|||||||
my $id = $providers{default}->{id};
|
my $id = $providers{default}->{id};
|
||||||
emit '';
|
emit '';
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute;
|
if ( $family == F_IPV4 ) {
|
||||||
emit qq(run_ip route add default via $gateway src $address dev $physical table $id metric $number);
|
emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute;
|
||||||
|
emit qq(run_ip route add default via $gateway src $address dev $physical table $id metric $number);
|
||||||
|
} else {
|
||||||
|
emit qq(qt \$IP -6 route del default via $gateway src $address dev $physical table $id metric $number);
|
||||||
|
emit qq(run_ip route add default via $gateway src $address dev $physical table $id metric $number);
|
||||||
|
}
|
||||||
emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
||||||
emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
|
emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
|
||||||
} else {
|
} else {
|
||||||
@@ -1034,12 +1043,23 @@ CEOF
|
|||||||
$tbl = $providers{$default ? 'default' : $config{USE_DEFAULT_RT} ? 'balance' : 'main'}->{id};
|
$tbl = $providers{$default ? 'default' : $config{USE_DEFAULT_RT} ? 'balance' : 'main'}->{id};
|
||||||
$weight = $balance ? $balance : $default;
|
$weight = $balance ? $balance : $default;
|
||||||
|
|
||||||
if ( $gateway ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl;
|
if ( $gateway ) {
|
||||||
|
emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl;
|
||||||
|
} else {
|
||||||
|
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
|
#
|
||||||
|
# IPv6 doesn't support multi-hop routes
|
||||||
|
#
|
||||||
|
if ( $gateway ) {
|
||||||
|
emit qq(add_gateway "via $gateway dev $physical $realm" ) . $tbl;
|
||||||
|
} else {
|
||||||
|
emit qq(add_gateway "dev $physical $realm" ) . $tbl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$weight = 1;
|
$weight = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,40 +1069,19 @@ CEOF
|
|||||||
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( qq(rm -f \${VARDIR}/${physical}_disabled) );
|
emit( qq( echo 1 > \${VARDIR}/${physical}_enabled) ) if $persistent;
|
||||||
emit_started_message( '', 2, $pseudo, $table, $number );
|
emit_started_message( '', 2, $pseudo, $table, $number );
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
|
||||||
emit( '',
|
|
||||||
'if [ -n "$g_forcereload" ]; then',
|
|
||||||
" progress_message2 \"The IP address or gateway of $physical has changed -- forcing reload of the ruleset\"",
|
|
||||||
' COMMAND=reload',
|
|
||||||
' detect_configuration',
|
|
||||||
' define_firewall',
|
|
||||||
'fi' );
|
|
||||||
}
|
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
unless ( $pseudo ) {
|
unless ( $pseudo ) {
|
||||||
emit( 'else' );
|
emit( 'else' );
|
||||||
emit( qq( echo $weight > \${VARDIR}/${physical}_weight) );
|
emit( qq( echo $weight > \${VARDIR}/${physical}_weight) );
|
||||||
emit( qq( rm -f \${VARDIR}/${physical}_disabled) ) if $persistent;
|
emit( qq( echo 1 > \${VARDIR}/${physical}_enabled) ) if $persistent;
|
||||||
emit_started_message( ' ', '', $pseudo, $table, $number );
|
emit_started_message( ' ', '', $pseudo, $table, $number );
|
||||||
}
|
}
|
||||||
|
|
||||||
emit "fi\n";
|
emit "fi\n";
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
|
||||||
my $variable = interface_address( $interface );
|
|
||||||
|
|
||||||
emit( "echo \$$variable > \${VARDIR}/${physical}.address" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
|
||||||
my $variable = interface_gateway( $interface );
|
|
||||||
emit( qq(echo "\$$variable" > \${VARDIR}/${physical}.gateway\n) );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
emit( qq(progress_message "Provider $table ($number) Started") );
|
emit( qq(progress_message "Provider $table ($number) Started") );
|
||||||
}
|
}
|
||||||
@@ -1107,17 +1106,6 @@ CEOF
|
|||||||
} else {
|
} else {
|
||||||
emit ( "error_message \"WARNING: Interface $physical is not usable -- Provider $table ($number) not Started\"" );
|
emit ( "error_message \"WARNING: Interface $physical is not usable -- Provider $table ($number) not Started\"" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
|
||||||
my $variable = interface_address( $interface );
|
|
||||||
emit( "\necho \$$variable > \${VARDIR}/${physical}.address" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
|
||||||
my $variable = interface_gateway( $interface );
|
|
||||||
emit( qq(\necho "\$$variable" > \${VARDIR}/${physical}.gateway) );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ( $shared ) {
|
if ( $shared ) {
|
||||||
emit( "fatal_error \"Gateway $gateway is not reachable -- Provider $table ($number) Cannot be Started\"" );
|
emit( "fatal_error \"Gateway $gateway is not reachable -- Provider $table ($number) Cannot be Started\"" );
|
||||||
@@ -1161,7 +1149,7 @@ CEOF
|
|||||||
$via = "dev $physical";
|
$via = "dev $physical";
|
||||||
}
|
}
|
||||||
|
|
||||||
$via .= " weight $weight" unless $weight < 0;
|
$via .= " weight $weight" unless $weight < 0 or $family == F_IPV6; # IPv6 doesn't support route weights
|
||||||
$via .= " $realm" if $realm;
|
$via .= " $realm" if $realm;
|
||||||
|
|
||||||
emit( qq(delete_gateway "$via" $tbl $physical) );
|
emit( qq(delete_gateway "$via" $tbl $physical) );
|
||||||
@@ -1183,7 +1171,7 @@ CEOF
|
|||||||
'if [ $COMMAND = disable ]; then',
|
'if [ $COMMAND = disable ]; then',
|
||||||
" do_persistent_${what}_${table}",
|
" do_persistent_${what}_${table}",
|
||||||
"else",
|
"else",
|
||||||
" echo 1 > \${VARDIR}/${physical}_disabled\n",
|
" rm -f \${VARDIR}/${physical}_enabled\n",
|
||||||
"fi\n",
|
"fi\n",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1256,7 +1244,7 @@ sub add_an_rtrule1( $$$$$ ) {
|
|||||||
if ( $source eq '-' ) {
|
if ( $source eq '-' ) {
|
||||||
$source = 'from ' . ALLIP;
|
$source = 'from ' . ALLIP;
|
||||||
} elsif ( $source =~ s/^&// ) {
|
} elsif ( $source =~ s/^&// ) {
|
||||||
$source = 'from ' . record_runtime_address( '&', $source, undef, 1 );
|
$source = 'from ' . record_runtime_address '&', $source;
|
||||||
} elsif ( $family == F_IPV4 ) {
|
} elsif ( $family == F_IPV4 ) {
|
||||||
if ( $source =~ /:/ ) {
|
if ( $source =~ /:/ ) {
|
||||||
( my $interface, $source , my $remainder ) = split( /:/, $source, 3 );
|
( my $interface, $source , my $remainder ) = split( /:/, $source, 3 );
|
||||||
@@ -1510,17 +1498,11 @@ sub finish_providers() {
|
|||||||
|
|
||||||
if ( $balancing ) {
|
if ( $balancing ) {
|
||||||
emit ( 'if [ -n "$DEFAULT_ROUTE" ]; then' );
|
emit ( 'if [ -n "$DEFAULT_ROUTE" ]; then' );
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
|
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
|
||||||
} else {
|
} else {
|
||||||
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
|
emit ( " qt \$IP -6 route del default scope global table $table \$DEFAULT_ROUTE" );
|
||||||
" qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE",
|
emit ( " run_ip route add default scope global table $table \$DEFAULT_ROUTE" );
|
||||||
" run_ip -6 route add default scope global table $table \$DEFAULT_ROUTE",
|
|
||||||
' else',
|
|
||||||
" run_ip -6 route replace default scope global table $table \$DEFAULT_ROUTE",
|
|
||||||
' fi',
|
|
||||||
'' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $config{USE_DEFAULT_RT} ) {
|
if ( $config{USE_DEFAULT_RT} ) {
|
||||||
@@ -1574,11 +1556,10 @@ sub finish_providers() {
|
|||||||
|
|
||||||
if ( $fallback ) {
|
if ( $fallback ) {
|
||||||
emit ( 'if [ -n "$FALLBACK_ROUTE" ]; then' );
|
emit ( 'if [ -n "$FALLBACK_ROUTE" ]; then' );
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
|
||||||
} else {
|
} else {
|
||||||
emit( " run_ip route delete default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " qt \$IP -6 route del default scope global table $default \$FALLBACK_ROUTE" );
|
||||||
emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1695,7 +1676,7 @@ EOF
|
|||||||
emit ( " if [ ! -f \${VARDIR}/undo_${provider}_routing ]; then",
|
emit ( " if [ ! -f \${VARDIR}/undo_${provider}_routing ]; then",
|
||||||
" start_interface_$provider" );
|
" start_interface_$provider" );
|
||||||
} elsif ( $providerref->{persistent} ) {
|
} elsif ( $providerref->{persistent} ) {
|
||||||
emit ( " if [ -f \${VARDIR}/$providerref->{physical}_disabled ]; then",
|
emit ( " if [ ! -f \${VARDIR}/$providerref->{physical}_enabled ]; then",
|
||||||
" start_provider_$provider" );
|
" start_provider_$provider" );
|
||||||
} else {
|
} else {
|
||||||
emit ( " if [ -z \"`\$IP -$family route ls table $providerref->{number}`\" ]; then",
|
emit ( " if [ -z \"`\$IP -$family route ls table $providerref->{number}`\" ]; then",
|
||||||
@@ -1746,7 +1727,7 @@ EOF
|
|||||||
if ( $providerref->{pseudo} ) {
|
if ( $providerref->{pseudo} ) {
|
||||||
emit( " if [ -f \${VARDIR}/undo_${provider}_routing ]; then" );
|
emit( " if [ -f \${VARDIR}/undo_${provider}_routing ]; then" );
|
||||||
} elsif ( $providerref->{persistent} ) {
|
} elsif ( $providerref->{persistent} ) {
|
||||||
emit( " if [ ! -f \${VARDIR}/$providerref->{physical}_disabled ]; then" );
|
emit( " if [ -f \${VARDIR}/$providerref->{physical}_enabled ]; then" );
|
||||||
} else {
|
} else {
|
||||||
emit( " if [ -n \"`\$IP -$family route ls table $providerref->{number}`\" ]; then" );
|
emit( " if [ -n \"`\$IP -$family route ls table $providerref->{number}`\" ]; then" );
|
||||||
}
|
}
|
||||||
@@ -2132,31 +2113,9 @@ sub provider_realm( $ ) {
|
|||||||
#
|
#
|
||||||
sub handle_optional_interfaces( $ ) {
|
sub handle_optional_interfaces( $ ) {
|
||||||
|
|
||||||
my @interfaces;
|
my ( $interfaces, $wildcards ) = find_interfaces_by_option1 'optional';
|
||||||
my $wildcards;
|
|
||||||
|
|
||||||
#
|
if ( @$interfaces ) {
|
||||||
# First do the provider interfacess. Those that are real providers will never have wildcard physical
|
|
||||||
# names but they might derive from wildcard interface entries. Optional interfaces which do not have
|
|
||||||
# wildcard physical names are also included in the providers table.
|
|
||||||
#
|
|
||||||
for my $providerref ( grep $_->{optional} , sort { $a->{number} <=> $b->{number} } values %providers ) {
|
|
||||||
push @interfaces, $providerref->{interface};
|
|
||||||
$wildcards ||= $providerref->{wildcard};
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Now do the optional wild interfaces
|
|
||||||
#
|
|
||||||
for my $interface ( grep interface_is_optional($_) && ! $provider_interfaces{$_}, all_real_interfaces ) {
|
|
||||||
push@interfaces, $interface;
|
|
||||||
unless ( $wildcards ) {
|
|
||||||
my $interfaceref = find_interface($interface);
|
|
||||||
$wildcards = 1 if $interfaceref->{wildcard};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( @interfaces ) {
|
|
||||||
my $require = $config{REQUIRE_INTERFACE};
|
my $require = $config{REQUIRE_INTERFACE};
|
||||||
my $gencase = shift;
|
my $gencase = shift;
|
||||||
|
|
||||||
@@ -2167,7 +2126,7 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
#
|
#
|
||||||
# Clear the '_IS_USABLE' variables
|
# Clear the '_IS_USABLE' variables
|
||||||
#
|
#
|
||||||
emit( join( '_', 'SW', uc var_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @interfaces;
|
emit( join( '_', 'SW', uc var_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @$interfaces;
|
||||||
|
|
||||||
if ( $wildcards ) {
|
if ( $wildcards ) {
|
||||||
#
|
#
|
||||||
@@ -2184,109 +2143,74 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $interface ( @interfaces ) {
|
for my $interface ( grep $provider_interfaces{$_}, @$interfaces ) {
|
||||||
if ( my $provider = $provider_interfaces{ $interface } ) {
|
my $provider = $provider_interfaces{$interface};
|
||||||
my $physical = get_physical $interface;
|
my $physical = get_physical $interface;
|
||||||
my $base = uc var_base( $physical );
|
my $base = uc var_base( $physical );
|
||||||
my $providerref = $providers{$provider};
|
my $providerref = $providers{$provider};
|
||||||
my $interfaceref = known_interface( $interface );
|
|
||||||
my $wildbase = uc $interfaceref->{base};
|
|
||||||
|
|
||||||
emit( "$physical)" ), push_indent if $wildcards;
|
emit( "$physical)" ), push_indent if $wildcards;
|
||||||
|
|
||||||
if ( $provider eq $physical ) {
|
if ( $provider eq $physical ) {
|
||||||
#
|
#
|
||||||
# Just an optional interface, or provider and interface are the same
|
# Just an optional interface, or provider and interface are the same
|
||||||
#
|
#
|
||||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Provider
|
# Provider
|
||||||
#
|
#
|
||||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
push_indent;
|
||||||
|
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
||||||
|
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
||||||
|
} else {
|
||||||
|
emit qq(if interface_is_usable $physical; then);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit( ' HAVE_INTERFACE=Yes' ) if $require;
|
||||||
|
|
||||||
|
emit( " SW_${base}_IS_USABLE=Yes" ,
|
||||||
|
'fi' );
|
||||||
|
|
||||||
|
pop_indent;
|
||||||
|
|
||||||
|
emit( "fi\n" );
|
||||||
|
|
||||||
|
emit( ';;' ), pop_indent if $wildcards;
|
||||||
|
}
|
||||||
|
|
||||||
|
for my $interface ( grep ! $provider_interfaces{$_}, @$interfaces ) {
|
||||||
|
my $physical = get_physical $interface;
|
||||||
|
my $base = uc var_base( $physical );
|
||||||
|
my $case = $physical;
|
||||||
|
my $wild = $case =~ s/\+$/*/;
|
||||||
|
|
||||||
|
if ( $wildcards ) {
|
||||||
|
emit( "$case)" );
|
||||||
push_indent;
|
push_indent;
|
||||||
|
|
||||||
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
if ( $wild ) {
|
||||||
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
emit( qq(if [ -z "\$SW_${base}_IS_USABLE" ]; then) );
|
||||||
} else {
|
|
||||||
emit qq(if interface_is_usable $physical; then);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit( ' HAVE_INTERFACE=Yes' ) if $require;
|
|
||||||
|
|
||||||
emit( " SW_${base}_IS_USABLE=Yes" );
|
|
||||||
emit( " SW_${wildbase}_IS_USABLE=Yes" ) if $interfaceref->{wildcard};
|
|
||||||
emit( 'fi' );
|
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
|
||||||
my $variable = interface_address( $interface );
|
|
||||||
|
|
||||||
emit( '',
|
|
||||||
"if [ -f \${VARDIR}/${physical}.address ]; then",
|
|
||||||
" if [ \$(cat \${VARDIR}/${physical}.address) != \$$variable ]; then",
|
|
||||||
' g_forcereload=Yes',
|
|
||||||
' fi',
|
|
||||||
'fi' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
|
||||||
my $variable = interface_gateway( $interface );
|
|
||||||
|
|
||||||
emit( '',
|
|
||||||
"if [ -f \${VARDIR}/${physical}.gateway ]; then",
|
|
||||||
" if [ \$(cat \${VARDIR}/${physical}.gateway) != \"\$$variable\" ]; then",
|
|
||||||
' g_forcereload=Yes',
|
|
||||||
' fi',
|
|
||||||
'fi' );
|
|
||||||
}
|
|
||||||
|
|
||||||
pop_indent;
|
|
||||||
|
|
||||||
emit( "fi\n" );
|
|
||||||
|
|
||||||
emit( ';;' ), pop_indent if $wildcards;
|
|
||||||
} else {
|
|
||||||
my $physical = get_physical $interface;
|
|
||||||
my $base = uc var_base( $physical );
|
|
||||||
my $case = $physical;
|
|
||||||
my $wild = $case =~ s/\+$/*/;
|
|
||||||
my $variable = interface_address( $interface );
|
|
||||||
|
|
||||||
if ( $wildcards ) {
|
|
||||||
emit( "$case)" );
|
|
||||||
push_indent;
|
push_indent;
|
||||||
|
emit ( 'if interface_is_usable $interface; then' );
|
||||||
if ( $wild ) {
|
|
||||||
emit( qq(if [ -z "\$SW_${base}_IS_USABLE" ]; then) );
|
|
||||||
push_indent;
|
|
||||||
emit ( 'if interface_is_usable $interface; then' );
|
|
||||||
} else {
|
|
||||||
emit ( "if interface_is_usable $physical; then" );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
emit ( "if interface_is_usable $physical; then" );
|
emit ( "if interface_is_usable $physical; then" );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
emit ( "if interface_is_usable $physical; then" );
|
||||||
|
}
|
||||||
|
|
||||||
emit ( ' HAVE_INTERFACE=Yes' ) if $require;
|
emit ( ' HAVE_INTERFACE=Yes' ) if $require;
|
||||||
emit ( " SW_${base}_IS_USABLE=Yes" ,
|
emit ( " SW_${base}_IS_USABLE=Yes" ,
|
||||||
'fi' );
|
'fi' );
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
if ( $wildcards ) {
|
||||||
emit( '',
|
pop_indent, emit( 'fi' ) if $wild;
|
||||||
"if [ -f \${VARDIR}/${physical}.address ]; then",
|
emit( ';;' );
|
||||||
" if [ \$(cat \${VARDIR}/${physical}.address) != \$$variable ]; then",
|
pop_indent;
|
||||||
' g_forcereload=Yes',
|
|
||||||
' fi',
|
|
||||||
'fi' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $wildcards ) {
|
|
||||||
pop_indent, emit( 'fi' ) if $wild;
|
|
||||||
emit( ';;' );
|
|
||||||
pop_indent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -368,19 +368,12 @@ sub setup_conntrack($) {
|
|||||||
if ( $convert ) {
|
if ( $convert ) {
|
||||||
my $conntrack;
|
my $conntrack;
|
||||||
my $empty = 1;
|
my $empty = 1;
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
my $fn1 = find_writable_file 'conntrack';
|
|
||||||
|
|
||||||
$fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!";
|
if ( $fn ) {
|
||||||
|
open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!";
|
||||||
if ( -f $fn1 ) {
|
|
||||||
open $conntrack, '>>', $fn1 or fatal_error "Unable to open $fn for notrack conversion: $!";
|
|
||||||
} else {
|
} else {
|
||||||
open $conntrack, '>' , $fn1 or fatal_error "Unable to open $fn for notrack conversion: $!";
|
open $conntrack, '>', $fn = find_file 'conntrack' or fatal_error "Unable to open $fn for notrack conversion: $!";
|
||||||
#
|
|
||||||
# Transfer permissions from the existing notrack file
|
|
||||||
#
|
|
||||||
transfer_permissions( $fn, $fn1 );
|
|
||||||
|
|
||||||
print $conntrack <<'EOF';
|
print $conntrack <<'EOF';
|
||||||
#
|
#
|
||||||
@@ -403,6 +396,8 @@ EOF
|
|||||||
"# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" ,
|
"# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" ,
|
||||||
"#\n" );
|
"#\n" );
|
||||||
|
|
||||||
|
$fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!";
|
||||||
|
|
||||||
while ( read_a_line( PLAIN_READ ) ) {
|
while ( read_a_line( PLAIN_READ ) ) {
|
||||||
#
|
#
|
||||||
# Don't copy the header comments from the old notrack file
|
# Don't copy the header comments from the old notrack file
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -350,10 +350,9 @@ sub process_simple_device() {
|
|||||||
|
|
||||||
for ( my $i = 1; $i <= 3; $i++ ) {
|
for ( my $i = 1; $i <= 3; $i++ ) {
|
||||||
my $prio = 16 | $i;
|
my $prio = 16 | $i;
|
||||||
my $j = $i + 3;
|
|
||||||
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
|
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
|
||||||
emit "run_tc filter add dev $physical protocol all prio $prio parent $number: handle $i fw classid $number:$i";
|
emit "run_tc filter add dev $physical protocol all prio $prio parent $number: handle $i fw classid $number:$i";
|
||||||
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle $j flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
|
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle ${number}${i} flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
|
||||||
emit '';
|
emit '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +826,7 @@ sub validate_tc_class( ) {
|
|||||||
fatal_error "Invalid 'occurs' ($val)" unless defined $occurs && $occurs > 1 && $occurs <= 256;
|
fatal_error "Invalid 'occurs' ($val)" unless defined $occurs && $occurs > 1 && $occurs <= 256;
|
||||||
fatal_error "Invalid 'occurs' ($val)" if $occurs > $globals{TC_MAX};
|
fatal_error "Invalid 'occurs' ($val)" if $occurs > $globals{TC_MAX};
|
||||||
fatal_error q(Duplicate 'occurs') if $tcref->{occurs} > 1;
|
fatal_error q(Duplicate 'occurs') if $tcref->{occurs} > 1;
|
||||||
fatal_error q(The 'occurs' option is not valid with 'default') if defined($devref->{default}) && $devref->{default} == $classnumber;
|
fatal_error q(The 'occurs' option is not valid with 'default') if $devref->{default} == $classnumber;
|
||||||
fatal_error q(The 'occurs' option is not valid with 'tos') if @{$tcref->{tos}};
|
fatal_error q(The 'occurs' option is not valid with 'tos') if @{$tcref->{tos}};
|
||||||
warning_message "MARK ($mark) is ignored on an occurring class" if $mark ne '-';
|
warning_message "MARK ($mark) is ignored on an occurring class" if $mark ne '-';
|
||||||
|
|
||||||
@@ -1308,8 +1307,6 @@ sub handle_ematch( $$ ) {
|
|||||||
|
|
||||||
$setname =~ s/\+//;
|
$setname =~ s/\+//;
|
||||||
|
|
||||||
add_ipset($setname);
|
|
||||||
|
|
||||||
return "ipset\\($setname $options\\)";
|
return "ipset\\($setname $options\\)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1520,7 +1517,7 @@ sub process_tc_filter2( $$$$$$$$$ ) {
|
|||||||
$rule .= ' and' if $have_rule;
|
$rule .= ' and' if $have_rule;
|
||||||
|
|
||||||
if ( $source =~ /^\+/ ) {
|
if ( $source =~ /^\+/ ) {
|
||||||
$rule .= join( '', "\\\n ", handle_ematch( $source, 'src' ) );
|
$rule = join( '', "\\\n ", handle_ematch( $source, 'src' ) );
|
||||||
} else {
|
} else {
|
||||||
my @parts = decompose_net_u32( $source );
|
my @parts = decompose_net_u32( $source );
|
||||||
|
|
||||||
@@ -1559,9 +1556,9 @@ sub process_tc_filter2( $$$$$$$$$ ) {
|
|||||||
$rule .= ' and' if @parts;
|
$rule .= ' and' if @parts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$have_rule = 1;
|
$have_rule = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $have_rule ) {
|
if ( $have_rule ) {
|
||||||
@@ -2150,50 +2147,6 @@ sub process_secmark_rule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub convert_one_tos( $ ) {
|
|
||||||
my ( $mangle ) = @_;
|
|
||||||
|
|
||||||
my ($src, $dst, $proto, $ports, $sports , $tos, $mark ) =
|
|
||||||
split_rawline2( 'tos file entry',
|
|
||||||
{ source => 0, dest => 1, proto => 2, dport => 3, sport => 4, tos => 5, mark => 6 },
|
|
||||||
undef,
|
|
||||||
7 );
|
|
||||||
|
|
||||||
my $chain_designator = 'P';
|
|
||||||
|
|
||||||
decode_tos($tos, 1);
|
|
||||||
|
|
||||||
my ( $srczone , $source , $remainder );
|
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
|
||||||
( $srczone , $source , $remainder ) = split( /:/, $src, 3 );
|
|
||||||
fatal_error 'Invalid SOURCE' if defined $remainder;
|
|
||||||
} elsif ( $src =~ /^(.+?):<(.*)>\s*$/ || $src =~ /^(.+?):\[(.*)\]\s*$/ ) {
|
|
||||||
$srczone = $1;
|
|
||||||
$source = $2;
|
|
||||||
} else {
|
|
||||||
$srczone = $src;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $srczone eq firewall_zone ) {
|
|
||||||
$chain_designator = 'O';
|
|
||||||
$src = $source || '-';
|
|
||||||
} else {
|
|
||||||
$src =~ s/^all:?//;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dst =~ s/^all:?//;
|
|
||||||
|
|
||||||
$src = '-' unless supplied $src;
|
|
||||||
$dst = '-' unless supplied $dst;
|
|
||||||
$proto = '-' unless supplied $proto;
|
|
||||||
$ports = '-' unless supplied $ports;
|
|
||||||
$sports = '-' unless supplied $sports;
|
|
||||||
$mark = '-' unless supplied $mark;
|
|
||||||
|
|
||||||
print $mangle "TOS($tos):$chain_designator\t$src\t$dst\t$proto\t$ports\t$sports\t-\t$mark\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub convert_tos($$) {
|
sub convert_tos($$) {
|
||||||
my ( $mangle, $fn1 ) = @_;
|
my ( $mangle, $fn1 ) = @_;
|
||||||
@@ -2211,28 +2164,9 @@ sub convert_tos($$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( my $fn = open_file 'tos' ) {
|
if ( my $fn = open_file 'tos' ) {
|
||||||
directive_callback(
|
|
||||||
sub ()
|
|
||||||
{
|
|
||||||
if ( $_[0] eq 'OMITTED' ) {
|
|
||||||
#
|
|
||||||
# Convert the raw rule
|
|
||||||
#
|
|
||||||
if ( $rawcurrentline =~ /^\s*(?:#.*)?$/ ) {
|
|
||||||
print $mangle "$_[1]\n";
|
|
||||||
} else {
|
|
||||||
convert_one_tos( $mangle );
|
|
||||||
$have_tos = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
first_entry(
|
first_entry(
|
||||||
sub {
|
sub {
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
progress_message2 "Converting $fn...";
|
progress_message2 "Converting $fn...";
|
||||||
print( $mangle
|
print( $mangle
|
||||||
"#\n" ,
|
"#\n" ,
|
||||||
@@ -2243,11 +2177,47 @@ sub convert_tos($$) {
|
|||||||
|
|
||||||
while ( read_a_line( NORMAL_READ ) ) {
|
while ( read_a_line( NORMAL_READ ) ) {
|
||||||
|
|
||||||
convert_one_tos( $mangle );
|
|
||||||
$have_tos = 1;
|
$have_tos = 1;
|
||||||
}
|
|
||||||
|
|
||||||
directive_callback(0);
|
my ($src, $dst, $proto, $ports, $sports , $tos, $mark ) =
|
||||||
|
split_line( 'tos file entry',
|
||||||
|
{ source => 0, dest => 1, proto => 2, dport => 3, sport => 4, tos => 5, mark => 6 } );
|
||||||
|
|
||||||
|
my $chain_designator = 'P';
|
||||||
|
|
||||||
|
decode_tos($tos, 1);
|
||||||
|
|
||||||
|
my ( $srczone , $source , $remainder );
|
||||||
|
|
||||||
|
if ( $family == F_IPV4 ) {
|
||||||
|
( $srczone , $source , $remainder ) = split( /:/, $src, 3 );
|
||||||
|
fatal_error 'Invalid SOURCE' if defined $remainder;
|
||||||
|
} elsif ( $src =~ /^(.+?):<(.*)>\s*$/ || $src =~ /^(.+?):\[(.*)\]\s*$/ ) {
|
||||||
|
$srczone = $1;
|
||||||
|
$source = $2;
|
||||||
|
} else {
|
||||||
|
$srczone = $src;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $srczone eq firewall_zone ) {
|
||||||
|
$chain_designator = 'O';
|
||||||
|
$src = $source || '-';
|
||||||
|
} else {
|
||||||
|
$src =~ s/^all:?//;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dst =~ s/^all:?//;
|
||||||
|
|
||||||
|
$src = '-' unless supplied $src;
|
||||||
|
$dst = '-' unless supplied $dst;
|
||||||
|
$proto = '-' unless supplied $proto;
|
||||||
|
$ports = '-' unless supplied $ports;
|
||||||
|
$sports = '-' unless supplied $sports;
|
||||||
|
$mark = '-' unless supplied $mark;
|
||||||
|
|
||||||
|
print $mangle "TOS($tos):$chain_designator\t$src\t$dst\t$proto\t$ports\t$sports\t-\t$mark\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ( $have_tos ) {
|
if ( $have_tos ) {
|
||||||
progress_message2 "Converted $fn to $fn1";
|
progress_message2 "Converted $fn to $fn1";
|
||||||
@@ -2264,19 +2234,13 @@ sub convert_tos($$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub open_mangle_for_output( $ ) {
|
sub open_mangle_for_output() {
|
||||||
my ($fn ) = @_;
|
|
||||||
my ( $mangle, $fn1 );
|
my ( $mangle, $fn1 );
|
||||||
|
|
||||||
if ( -f ( $fn1 = find_writable_file( 'mangle' ) ) ) {
|
if ( -f ( $fn1 = find_writable_file( 'mangle' ) ) ) {
|
||||||
open( $mangle , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
open( $mangle , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
||||||
} else {
|
} else {
|
||||||
open( $mangle , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
open( $mangle , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
||||||
#
|
|
||||||
# Transfer permissions from the existing tcrules file to the new mangle file
|
|
||||||
#
|
|
||||||
transfer_permissions( $fn, $fn1 );
|
|
||||||
|
|
||||||
print $mangle <<'EOF';
|
print $mangle <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall version 4 - Mangle File
|
# Shorewall version 4 - Mangle File
|
||||||
@@ -2305,13 +2269,13 @@ sub setup_tc( $ ) {
|
|||||||
$convert = $_[0];
|
$convert = $_[0];
|
||||||
|
|
||||||
if ( $config{MANGLE_ENABLED} ) {
|
if ( $config{MANGLE_ENABLED} ) {
|
||||||
ensure_mangle_chain( 'tcpre', PREROUTING, PREROUTE_RESTRICT );
|
ensure_mangle_chain 'tcpre';
|
||||||
ensure_mangle_chain( 'tcout', OUTPUT , OUTPUT_RESTRICT );
|
ensure_mangle_chain 'tcout';
|
||||||
|
|
||||||
if ( have_capability( 'MANGLE_FORWARD' ) ) {
|
if ( have_capability( 'MANGLE_FORWARD' ) ) {
|
||||||
ensure_mangle_chain( 'tcfor', FORWARD , NO_RESTRICT );
|
ensure_mangle_chain 'tcfor';
|
||||||
ensure_mangle_chain( 'tcpost', POSTROUTING, POSTROUTE_RESTRICT );
|
ensure_mangle_chain 'tcpost';
|
||||||
ensure_mangle_chain( 'tcin', INPUT , INPUT_RESTRICT );
|
ensure_mangle_chain 'tcin';
|
||||||
}
|
}
|
||||||
|
|
||||||
my @mark_part;
|
my @mark_part;
|
||||||
@@ -2362,30 +2326,13 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tcrules file to the equivalent mangle file
|
# We are going to convert this tcrules file to the equivalent mangle file
|
||||||
#
|
#
|
||||||
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
( $mangle, $fn1 ) = open_mangle_for_output;
|
||||||
|
|
||||||
directive_callback(
|
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
||||||
sub ()
|
|
||||||
{
|
|
||||||
if ( $_[0] eq 'OMITTED' ) {
|
|
||||||
#
|
|
||||||
# Convert the raw rule
|
|
||||||
#
|
|
||||||
if ( $rawcurrentline =~ /^\s*(?:#.*)?$/ ) {
|
|
||||||
print $mangle "$_[1]\n";
|
|
||||||
} else {
|
|
||||||
process_tc_rule;
|
|
||||||
$have_tcrules++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
first_entry(
|
first_entry(
|
||||||
sub {
|
sub {
|
||||||
my $date = compiletime;
|
my $date = localtime;
|
||||||
progress_message2 "Converting $fn...";
|
progress_message2 "Converting $fn...";
|
||||||
print( $mangle
|
print( $mangle
|
||||||
"#\n" ,
|
"#\n" ,
|
||||||
@@ -2429,7 +2376,7 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tosfile to the equivalent mangle file
|
# We are going to convert this tosfile to the equivalent mangle file
|
||||||
#
|
#
|
||||||
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
( $mangle, $fn1 ) = open_mangle_for_output;
|
||||||
convert_tos( $mangle, $fn1 );
|
convert_tos( $mangle, $fn1 );
|
||||||
close $mangle;
|
close $mangle;
|
||||||
}
|
}
|
||||||
|
@@ -95,6 +95,7 @@ our @EXPORT = ( qw( NOTHING
|
|||||||
get_interface_origin
|
get_interface_origin
|
||||||
interface_has_option
|
interface_has_option
|
||||||
set_interface_option
|
set_interface_option
|
||||||
|
set_interface_provider
|
||||||
interface_zone
|
interface_zone
|
||||||
interface_zones
|
interface_zones
|
||||||
verify_required_interfaces
|
verify_required_interfaces
|
||||||
@@ -194,6 +195,7 @@ our %reservedName = ( all => 1,
|
|||||||
# number => <ordinal position in the interfaces file>
|
# number => <ordinal position in the interfaces file>
|
||||||
# physical => <physical interface name>
|
# physical => <physical interface name>
|
||||||
# base => <shell variable base representing this interface>
|
# base => <shell variable base representing this interface>
|
||||||
|
# provider => <Provider Name, if interface is associated with a provider>
|
||||||
# wildcard => undef|1 # Wildcard Name
|
# wildcard => undef|1 # Wildcard Name
|
||||||
# zones => { zone1 => 1, ... }
|
# zones => { zone1 => 1, ... }
|
||||||
# origin => <where defined>
|
# origin => <where defined>
|
||||||
@@ -335,7 +337,6 @@ sub initialize( $$ ) {
|
|||||||
arp_ignore => ENUM_IF_OPTION,
|
arp_ignore => ENUM_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
dbl => ENUM_IF_OPTION,
|
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
detectnets => OBSOLETE_IF_OPTION,
|
detectnets => OBSOLETE_IF_OPTION,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
@@ -386,7 +387,6 @@ sub initialize( $$ ) {
|
|||||||
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
dbl => ENUM_IF_OPTION,
|
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
@@ -396,6 +396,7 @@ sub initialize( $$ ) {
|
|||||||
nodbl => SIMPLE_IF_OPTION,
|
nodbl => SIMPLE_IF_OPTION,
|
||||||
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
optional => SIMPLE_IF_OPTION,
|
optional => SIMPLE_IF_OPTION,
|
||||||
|
optional => SIMPLE_IF_OPTION,
|
||||||
proxyndp => BINARY_IF_OPTION,
|
proxyndp => BINARY_IF_OPTION,
|
||||||
required => SIMPLE_IF_OPTION,
|
required => SIMPLE_IF_OPTION,
|
||||||
routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
|
routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
|
||||||
@@ -1116,8 +1117,6 @@ sub process_interface( $$ ) {
|
|||||||
|
|
||||||
my ($interface, $port, $extra) = split /:/ , $originalinterface, 3;
|
my ($interface, $port, $extra) = split /:/ , $originalinterface, 3;
|
||||||
|
|
||||||
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
|
|
||||||
|
|
||||||
fatal_error "Invalid INTERFACE ($originalinterface)" if ! $interface || defined $extra;
|
fatal_error "Invalid INTERFACE ($originalinterface)" if ! $interface || defined $extra;
|
||||||
|
|
||||||
if ( supplied $port ) {
|
if ( supplied $port ) {
|
||||||
@@ -1192,7 +1191,6 @@ sub process_interface( $$ ) {
|
|||||||
my %options;
|
my %options;
|
||||||
|
|
||||||
$options{port} = 1 if $port;
|
$options{port} = 1 if $port;
|
||||||
$options{dbl} = $config{DYNAMIC_BLACKLIST} =~ /^ipset(-only)?.*,src-dst/ ? '1:2' : $config{DYNAMIC_BLACKLIST} ? '1:0' : '0:0';
|
|
||||||
|
|
||||||
my $hostoptionsref = {};
|
my $hostoptionsref = {};
|
||||||
|
|
||||||
@@ -1236,8 +1234,6 @@ sub process_interface( $$ ) {
|
|||||||
} else {
|
} else {
|
||||||
warning_message "The 'blacklist' option is ignored on multi-zone interfaces";
|
warning_message "The 'blacklist' option is ignored on multi-zone interfaces";
|
||||||
}
|
}
|
||||||
} elsif ( $option eq 'nodbl' ) {
|
|
||||||
$options{dbl} = '0:0';
|
|
||||||
} else {
|
} else {
|
||||||
$options{$option} = 1;
|
$options{$option} = 1;
|
||||||
$hostoptions{$option} = 1 if $hostopt;
|
$hostoptions{$option} = 1 if $hostopt;
|
||||||
@@ -1260,11 +1256,6 @@ sub process_interface( $$ ) {
|
|||||||
} else {
|
} else {
|
||||||
$options{arp_ignore} = 1;
|
$options{arp_ignore} = 1;
|
||||||
}
|
}
|
||||||
} elsif ( $option eq 'dbl' ) {
|
|
||||||
my %values = ( none => '0:0', src => '1:0', dst => '2:0', 'src-dst' => '1:2' );
|
|
||||||
|
|
||||||
fatal_error q(The 'dbl' option requires a value) unless defined $value;
|
|
||||||
fatal_error qq(Invalid setting ($value) for 'dbl') unless defined ( $options{dbl} = $values{$value} );
|
|
||||||
} else {
|
} else {
|
||||||
assert( 0 );
|
assert( 0 );
|
||||||
}
|
}
|
||||||
@@ -1315,7 +1306,7 @@ sub process_interface( $$ ) {
|
|||||||
fatal_error "The '$option' option requires a value" unless defined $value;
|
fatal_error "The '$option' option requires a value" unless defined $value;
|
||||||
|
|
||||||
if ( $option eq 'physical' ) {
|
if ( $option eq 'physical' ) {
|
||||||
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
|
fatal_error "Invalid Physical interface name ($value)" unless $value && $value !~ /%/;
|
||||||
fatal_error "Virtual interfaces ($value) are not supported" if $value =~ /:\d+$/;
|
fatal_error "Virtual interfaces ($value) are not supported" if $value =~ /:\d+$/;
|
||||||
|
|
||||||
fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port );
|
fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port );
|
||||||
@@ -1586,7 +1577,7 @@ sub known_interface($)
|
|||||||
name => $i ,
|
name => $i ,
|
||||||
number => $interfaceref->{number} ,
|
number => $interfaceref->{number} ,
|
||||||
physical => $physical ,
|
physical => $physical ,
|
||||||
base => $interfaceref->{base} ,
|
base => var_base( $physical ) ,
|
||||||
wildcard => $interfaceref->{wildcard} ,
|
wildcard => $interfaceref->{wildcard} ,
|
||||||
zones => $interfaceref->{zones} ,
|
zones => $interfaceref->{zones} ,
|
||||||
};
|
};
|
||||||
@@ -1915,7 +1906,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
|
|
||||||
my $returnvalue = 0;
|
my $returnvalue = 0;
|
||||||
|
|
||||||
my $interfaces = find_interfaces_by_option( 'wait');
|
my $interfaces = find_interfaces_by_option 'wait';
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
if ( @$interfaces ) {
|
||||||
my $first = 1;
|
my $first = 1;
|
||||||
@@ -1981,7 +1972,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$interfaces = find_interfaces_by_option( 'required' );
|
$interfaces = find_interfaces_by_option 'required';
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
if ( @$interfaces ) {
|
||||||
|
|
||||||
@@ -2169,7 +2160,7 @@ sub process_host( ) {
|
|||||||
#
|
#
|
||||||
$interface = '%vserver%' if $type & VSERVER;
|
$interface = '%vserver%' if $type & VSERVER;
|
||||||
|
|
||||||
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref, 0 );
|
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref, 1 );
|
||||||
|
|
||||||
progress_message " Host \"$currentline\" validated";
|
progress_message " Host \"$currentline\" validated";
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
#
|
#
|
||||||
# The Shoreline Firewall Packet Filtering Firewall Compiler
|
# The Shoreline Firewall Packet Filtering Firewall Compiler - V4.4
|
||||||
#
|
#
|
||||||
# (c) 2007,2008,2009,2010,2011,2014 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2014 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
@@ -41,7 +41,10 @@
|
|||||||
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
||||||
# --config_path=<path-list> # Search path for config files
|
# --config_path=<path-list> # Search path for config files
|
||||||
# --inline # Update alternative column specifications
|
# --inline # Update alternative column specifications
|
||||||
# --update # Update configuration to current release
|
# --update # Update configuration to this release
|
||||||
|
# --tcrules # Create mangle from tcrules
|
||||||
|
# --routestopped # Create stoppedrules from routestopped
|
||||||
|
# --notrack # Create conntrack from notrack
|
||||||
#
|
#
|
||||||
use strict;
|
use strict;
|
||||||
use FindBin;
|
use FindBin;
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
# generated this program
|
# generated this program
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
# Functions imported from /usr/share/shorewall/lib.runtime
|
# Functions imported from /usr/share/shorewall/lib.core
|
||||||
################################################################################
|
################################################################################
|
||||||
# Address family-neutral Functions
|
# Address family-neutral Functions
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -599,15 +599,7 @@ debug_restore_input() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface_enabled() {
|
interface_enabled() {
|
||||||
status=0
|
return $(cat ${VARDIR}/$1.status)
|
||||||
|
|
||||||
if [ -f ${VARDIR}/${1}_disabled ]; then
|
|
||||||
status=1
|
|
||||||
elif [ -f ${VARDIR}/${1}.status ]; then
|
|
||||||
status=$(cat ${VARDIR}/${1}.status)
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $status
|
|
||||||
}
|
}
|
||||||
|
|
||||||
distribute_load() {
|
distribute_load() {
|
||||||
@@ -686,10 +678,8 @@ interface_is_usable() # $1 = interface
|
|||||||
|
|
||||||
if ! loopback_interface $1; then
|
if ! loopback_interface $1; then
|
||||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]; then
|
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]; then
|
||||||
if [ "$COMMAND" != enable ]; then
|
[ "$COMMAND" = enable ] || run_isusable_exit $1
|
||||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
status=$?
|
||||||
status=$?
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
status=1
|
status=1
|
||||||
fi
|
fi
|
||||||
@@ -1006,16 +996,9 @@ delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
|
|||||||
|
|
||||||
if [ -n "$route" ]; then
|
if [ -n "$route" ]; then
|
||||||
if echo $route | grep -qF ' nexthop '; then
|
if echo $route | grep -qF ' nexthop '; then
|
||||||
if interface_is_up $3; then
|
gateway="nexthop $gateway"
|
||||||
gateway="nexthop $gateway"
|
eval route=\`echo $route \| sed \'s/$gateway/ /\'\`
|
||||||
else
|
run_ip route replace table $2 $route
|
||||||
gateway="nexthop $gateway dead"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if eval echo $route \| fgrep -q \'$gateway\'; then
|
|
||||||
eval route=\`echo $route \| sed \'s/$gateway/ /\'\`
|
|
||||||
run_ip route replace table $2 $route
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
dev=$(find_device $route)
|
dev=$(find_device $route)
|
||||||
[ "$dev" = "$3" ] && run_ip route delete default table $2
|
[ "$dev" = "$3" ] && run_ip route delete default table $2
|
||||||
@@ -1112,10 +1095,8 @@ interface_is_usable() # $1 = interface
|
|||||||
|
|
||||||
if [ "$1" != lo ]; then
|
if [ "$1" != lo ]; then
|
||||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; then
|
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; then
|
||||||
if [ "$COMMAND" != enable ]; then
|
[ "$COMMAND" = enable ] || run_isusable_exit $1
|
||||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
status=$?
|
||||||
status=$?
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
status=1
|
status=1
|
||||||
fi
|
fi
|
||||||
@@ -1129,7 +1110,7 @@ interface_is_usable() # $1 = interface
|
|||||||
#
|
#
|
||||||
find_interface_addresses() # $1 = interface
|
find_interface_addresses() # $1 = interface
|
||||||
{
|
{
|
||||||
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2' | sed 's/\s*inet6 //;s/\/.*//;s/ peer [0-9a-f:]*//'
|
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2' | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//'
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1138,7 +1119,7 @@ find_interface_addresses() # $1 = interface
|
|||||||
|
|
||||||
find_interface_full_addresses() # $1 = interface
|
find_interface_full_addresses() # $1 = interface
|
||||||
{
|
{
|
||||||
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 ' | sed 's/\s*inet6 //;s/ scope.*//;s/ peer [0-9a-f:]*//'
|
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 ' | sed 's/\s*inet6 //;s/ scope.*//;s/ peer.*//'
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
@@ -25,7 +25,6 @@ usage() {
|
|||||||
echo " savesets <file>"
|
echo " savesets <file>"
|
||||||
echo " call <function> [ <parameter> ... ]"
|
echo " call <function> [ <parameter> ... ]"
|
||||||
echo " version"
|
echo " version"
|
||||||
echo " info"
|
|
||||||
echo
|
echo
|
||||||
echo "Options are:"
|
echo "Options are:"
|
||||||
echo
|
echo
|
||||||
@@ -128,7 +127,6 @@ g_compiled=
|
|||||||
g_file=
|
g_file=
|
||||||
g_docker=
|
g_docker=
|
||||||
g_dockernetwork=
|
g_dockernetwork=
|
||||||
g_forcereload=
|
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
|
|
||||||
@@ -471,10 +469,6 @@ case "$COMMAND" in
|
|||||||
echo $SHOREWALL_VERSION
|
echo $SHOREWALL_VERSION
|
||||||
status=0
|
status=0
|
||||||
;;
|
;;
|
||||||
info)
|
|
||||||
[ $# -ne 1 ] && usage 2
|
|
||||||
info_command
|
|
||||||
;;
|
|
||||||
help)
|
help)
|
||||||
[ $# -ne 1 ] && usage 2
|
[ $# -ne 1 ] && usage 2
|
||||||
usage 0
|
usage 0
|
||||||
|
@@ -23,12 +23,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -134,13 +128,15 @@ ADD_SNAT_ALIASES=No
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -176,8 +172,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -248,14 +242,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -34,12 +34,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -145,13 +139,15 @@ ADD_SNAT_ALIASES=No
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -187,8 +183,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -259,14 +253,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
19
Shorewall/Samples/three-interfaces/masq
Normal file
19
Shorewall/Samples/three-interfaces/masq
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Shorewall - Sample Masq file for three-interface configuration.
|
||||||
|
# Copyright (C) 2006-2015 by the Shorewall Team
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2.1 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# See the file README.txt for further details.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# For information about entries in this file, type "man shorewall-masq"
|
||||||
|
################################################################################################################
|
||||||
|
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
|
||||||
|
# GROUP DEST
|
||||||
|
eth0 10.0.0.0/8,\
|
||||||
|
169.254.0.0/16,\
|
||||||
|
172.16.0.0/12,\
|
||||||
|
192.168.0.0/16
|
@@ -31,12 +31,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -142,13 +136,15 @@ ADD_SNAT_ALIASES=No
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -184,8 +180,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -256,14 +250,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall - Sample SNAT/Masqueradee File for three-interface configuration.
|
|
||||||
# Copyright (C) 2006-2016 by the Shorewall Team
|
|
||||||
#
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
|
||||||
# License as published by the Free Software Foundation; either
|
|
||||||
# version 2.1 of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# See the file README.txt for further details.
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# For information about entries in this file, type "man shorewall-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages/shorewall-snat.html for more information
|
|
||||||
###########################################################################################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
||||||
#
|
|
||||||
# Rules generated from masq file /home/teastep/shorewall/trunk/Shorewall/Samples/three-interfaces/masq by Shorewall 5.0.13-RC1 - Sat Oct 15 11:43:47 PDT 2016
|
|
||||||
#
|
|
||||||
MASQUERADE 10.0.0.0/8,\
|
|
||||||
169.254.0.0/16,\
|
|
||||||
172.16.0.0/12,\
|
|
||||||
192.168.0.0/16 eth0
|
|
19
Shorewall/Samples/two-interfaces/masq
Normal file
19
Shorewall/Samples/two-interfaces/masq
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Shorewall - Sample Masq file for two-interface configuration.
|
||||||
|
# Copyright (C) 2006-2015 by the Shorewall Team
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2.1 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# See the file README.txt for further details.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# For information about entries in this file, type "man shorewall-masq"
|
||||||
|
################################################################################################################
|
||||||
|
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
|
||||||
|
# GROUP DEST
|
||||||
|
eth0 10.0.0.0/8,\
|
||||||
|
169.254.0.0/16,\
|
||||||
|
172.16.0.0/12,\
|
||||||
|
192.168.0.0/16
|
@@ -34,12 +34,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -145,13 +139,15 @@ ADD_SNAT_ALIASES=No
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -187,8 +183,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -259,14 +253,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall - Sample SNAT/Masqueradee File for two-interface configuration.
|
|
||||||
# Copyright (C) 2006-2016 by the Shorewall Team
|
|
||||||
#
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
|
||||||
# License as published by the Free Software Foundation; either
|
|
||||||
# version 2.1 of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# See the file README.txt for further details.
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# For information about entries in this file, type "man shorewall-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages/shorewall-snat.html for more information
|
|
||||||
###########################################################################################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
||||||
#
|
|
||||||
# Rules generated from masq file /home/teastep/shorewall/trunk/Shorewall/Samples/two-interfaces/masq by Shorewall 5.0.13-RC1 - Sat Oct 15 11:41:40 PDT 2016
|
|
||||||
#
|
|
||||||
MASQUERADE 10.0.0.0/8,\
|
|
||||||
169.254.0.0/16,\
|
|
||||||
172.16.0.0/12,\
|
|
||||||
92.168.0.0/16 eth0
|
|
@@ -23,12 +23,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -134,14 +128,16 @@ ADD_SNAT_ALIASES=No
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=No
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
CHAIN_SCRIPTS=Yes
|
CHAIN_SCRIPTS=Yes
|
||||||
@@ -176,8 +172,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=No
|
INLINE_MATCHES=No
|
||||||
@@ -248,14 +242,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /etc/shorewall/snat
|
|
||||||
#
|
|
||||||
# For information about entries in this file, type "man shorewall-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages/shorewall-snat.html for more information
|
|
||||||
#
|
|
||||||
###########################################################################################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
@@ -4,7 +4,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall
|
# /etc/shorewall
|
||||||
@@ -97,11 +97,10 @@ shorewall_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
|
echo -n "Stopping \"Shorewall firewall\": "
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
echo -n "Stopping \"Shorewall firewall\": "
|
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
echo -n "Clearing all \"Shorewall firewall\" rules: "
|
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -146,7 +145,7 @@ case "$1" in
|
|||||||
restart)
|
restart)
|
||||||
shorewall_restart
|
shorewall_restart
|
||||||
;;
|
;;
|
||||||
force-reload|reload)
|
force0reload|reload)
|
||||||
shorewall_reload
|
shorewall_reload
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
|
@@ -696,15 +696,17 @@ if [ -z "$SPARSE" -a ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/maclist ]; then
|
|||||||
echo "mac list file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/maclist"
|
echo "mac list file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/maclist"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
if [ -f masq ]; then
|
||||||
# Install the SNAT file
|
#
|
||||||
#
|
# Install the Masq file
|
||||||
run_install $OWNERSHIP -m 0644 snat ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
#
|
||||||
run_install $OWNERSHIP -m 0644 snat.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
run_install $OWNERSHIP -m 0644 masq ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
||||||
|
run_install $OWNERSHIP -m 0644 masq.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
||||||
|
|
||||||
if [ -z "$SPARSE" -a ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/snat ]; then
|
if [ -z "$SPARSE" -a ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/masq ]; then
|
||||||
run_install $OWNERSHIP -m 0600 snat${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/snat
|
run_install $OWNERSHIP -m 0600 masq${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/masq
|
||||||
echo "SNAT file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/snat"
|
echo "Masquerade file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/masq"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f arprules ]; then
|
if [ -f arprules ]; then
|
||||||
@@ -1213,7 +1215,7 @@ if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PR
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
|
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
|
||||||
echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
|
if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
|
||||||
|
@@ -316,29 +316,53 @@ get_config() {
|
|||||||
|
|
||||||
g_loopback=$(find_loopback_interfaces)
|
g_loopback=$(find_loopback_interfaces)
|
||||||
|
|
||||||
[ -n "$PAGER" ] || PAGER=$DEFAULT_PAGER
|
if [ -n "$PAGER" -a -t 1 ]; then
|
||||||
|
case $PAGER in
|
||||||
|
/*)
|
||||||
|
g_pager="$PAGER"
|
||||||
|
[ -f "$g_pager" ] || fatal_error "PAGER $PAGER does not exist"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
g_pager=$(mywhich pager 2> /dev/null)
|
||||||
|
[ -n "$g_pager" ] || fatal_error "PAGER $PAGER not found"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "$g_nopager" ]; then
|
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
|
||||||
if [ -n "$PAGER" -a -t 1 ]; then
|
|
||||||
case $PAGER in
|
|
||||||
/*)
|
|
||||||
g_pager="$PAGER"
|
|
||||||
[ -f "$g_pager" ] || fatal_error "PAGER $PAGER does not exist"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
g_pager=$(mywhich $PAGER 2> /dev/null)
|
|
||||||
[ -n "$g_pager" ] || fatal_error "PAGER $PAGER not found"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
|
g_pager="| $g_pager"
|
||||||
|
|
||||||
g_pager="| $g_pager"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DYNAMIC_BLACKLIST" ]; then
|
if [ -n "$DYNAMIC_BLACKLIST" ]; then
|
||||||
setup_dbl
|
case $DYNAMIC_BLACKLIST in
|
||||||
|
[Nn]o)
|
||||||
|
DYNAMIC_BLACKLIST='';
|
||||||
|
;;
|
||||||
|
[Yy]es)
|
||||||
|
;;
|
||||||
|
ipset|ipset::*|ipset-only|ipset-only::*|ipset,src-dst|ipset-only,src-dst::*)
|
||||||
|
g_blacklistipset=SW_DBL$g_family
|
||||||
|
;;
|
||||||
|
ipset:[a-zA-Z]*)
|
||||||
|
g_blacklistipset=${DYNAMIC_BLACKLIST#ipset:}
|
||||||
|
g_blacklistipset=${g_blacklistipset%%:*}
|
||||||
|
;;
|
||||||
|
ipset,src-dst:[a-zA-Z]*)
|
||||||
|
g_blacklistipset=${DYNAMIC_BLACKLIST#ipset,src-dst:}
|
||||||
|
g_blacklistipset=${g_blacklistipset%%:*}
|
||||||
|
;;
|
||||||
|
ipset-only:[a-zA-Z]*)
|
||||||
|
g_blacklistipset=${DYNAMIC_BLACKLIST#ipset-only:}
|
||||||
|
g_blacklistipset=${g_blacklistipset%%:*}
|
||||||
|
;;
|
||||||
|
ipset-only,src-dst:[a-zA-Z]*)
|
||||||
|
g_blacklistipset=${DYNAMIC_BLACKLIST#ipset-only,src-dst:}
|
||||||
|
g_blacklistipset=${g_blacklistipset%%:*}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fatal_error "Invalid value ($DYNAMIC_BLACKLIST) for DYNAMIC_BLACKLIST"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lib=$(find_file lib.cli-user)
|
lib=$(find_file lib.cli-user)
|
||||||
@@ -469,13 +493,13 @@ compiler() {
|
|||||||
|
|
||||||
case "$g_doing" in
|
case "$g_doing" in
|
||||||
Compiling|Checking)
|
Compiling|Checking)
|
||||||
progress_message3 "$g_doing using Shorewall $SHOREWALL_VERSION..."
|
progress_message3 "$g_doing using $g_product $SHOREWALL_VERSION..."
|
||||||
;;
|
;;
|
||||||
Updating)
|
Updating)
|
||||||
progress_message3 "Updating $g_product configuration to $SHOREWALL_VERSION..."
|
progress_message3 "Updating $g_product configuration to $SHOREWALL_VERSION..."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[ -n "$g_doing" ] && progress_message3 "$g_doing using Shorewall $SHOREWALL_VERSION..."
|
[ -n "$g_doing" ] && progress_message3 "$g_doing using $g_product $SHOREWALL_VERSION..."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
@@ -580,7 +604,7 @@ start_command() {
|
|||||||
option=${option#C}
|
option=${option#C}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -596,8 +620,7 @@ start_command() {
|
|||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
[ -n "$g_shorewalldir" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" -o -n "$g_fast" ] && usage 2
|
||||||
[ -n "$g_fast" ] && fatal_error "Directory may not be specified with the -f option"
|
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -611,7 +634,7 @@ start_command() {
|
|||||||
AUTOMAKE=
|
AUTOMAKE=
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $2
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -640,6 +663,8 @@ compile_command() {
|
|||||||
shift
|
shift
|
||||||
option=${option#-}
|
option=${option#-}
|
||||||
|
|
||||||
|
[ -z "$option" ] && usage 1
|
||||||
|
|
||||||
while [ -n "$option" ]; do
|
while [ -n "$option" ]; do
|
||||||
case $option in
|
case $option in
|
||||||
e*)
|
e*)
|
||||||
@@ -676,7 +701,7 @@ compile_command() {
|
|||||||
option=
|
option=
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -698,7 +723,7 @@ compile_command() {
|
|||||||
[ -d "$g_file" ] && fatal_error "$g_file is a directory"
|
[ -d "$g_file" ] && fatal_error "$g_file is a directory"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
[ -n "$g_shorewalldir" -a -z "$g_export" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -712,7 +737,7 @@ compile_command() {
|
|||||||
g_file=$2
|
g_file=$2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $3
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -766,7 +791,7 @@ check_command() {
|
|||||||
option=${option#i}
|
option=${option#i}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -782,7 +807,7 @@ check_command() {
|
|||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
[ -n "$g_shorewalldir" -a -z "$g_export" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -795,7 +820,7 @@ check_command() {
|
|||||||
g_shorewalldir=$(resolve_file $1)
|
g_shorewalldir=$(resolve_file $1)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $2
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -858,7 +883,7 @@ update_command() {
|
|||||||
option=${option#A}
|
option=${option#A}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -874,7 +899,7 @@ update_command() {
|
|||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
[ -n "$g_shorewalldir" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -887,7 +912,7 @@ update_command() {
|
|||||||
g_shorewalldir=$(resolve_file $1)
|
g_shorewalldir=$(resolve_file $1)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $2
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -952,7 +977,7 @@ restart_command() {
|
|||||||
option=${option#C}
|
option=${option#C}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -968,7 +993,7 @@ restart_command() {
|
|||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
[ -n "$g_shorewalldir" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -983,7 +1008,7 @@ restart_command() {
|
|||||||
AUTOMAKE=
|
AUTOMAKE=
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $2
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1061,7 +1086,7 @@ refresh_command() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -1144,7 +1169,7 @@ safe_commands() {
|
|||||||
shift;
|
shift;
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -1160,7 +1185,7 @@ safe_commands() {
|
|||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
[ -n "$g_shorewalldir" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -1173,7 +1198,7 @@ safe_commands() {
|
|||||||
g_shorewalldir=$(resolve_file $1)
|
g_shorewalldir=$(resolve_file $1)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $2
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1261,7 +1286,7 @@ try_command() {
|
|||||||
timeout=
|
timeout=
|
||||||
|
|
||||||
handle_directory() {
|
handle_directory() {
|
||||||
[ -n "$g_shorewalldir" ] && fatal_error "A directory has already been specified: $1"
|
[ -n "$g_shorewalldir" ] && usage 2
|
||||||
|
|
||||||
if [ ! -d $1 ]; then
|
if [ ! -d $1 ]; then
|
||||||
if [ -e $1 ]; then
|
if [ -e $1 ]; then
|
||||||
@@ -1291,7 +1316,7 @@ try_command() {
|
|||||||
option=${option#n}
|
option=${option#n}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -1305,7 +1330,7 @@ try_command() {
|
|||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0)
|
0)
|
||||||
missing_argument
|
usage 1
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
handle_directory $1
|
handle_directory $1
|
||||||
@@ -1316,7 +1341,7 @@ try_command() {
|
|||||||
timeout=$2
|
timeout=$2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $3
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1446,12 +1471,6 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
option=
|
option=
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
D)
|
|
||||||
[ $# -gt 1 ] || fatal_error "Missing directory name"
|
|
||||||
g_shorewalldir=$2
|
|
||||||
option=
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
T*)
|
T*)
|
||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
@@ -1461,7 +1480,7 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
option=${option#i}
|
option=${option#i}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
option_error $option
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -1474,9 +1493,6 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
done
|
done
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0)
|
|
||||||
[ -n "$g_shorewalldir" ] || g_shorewalldir='.'
|
|
||||||
;;
|
|
||||||
1)
|
1)
|
||||||
g_shorewalldir="."
|
g_shorewalldir="."
|
||||||
system=$1
|
system=$1
|
||||||
@@ -1486,7 +1502,7 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
system=$2
|
system=$2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
too_many_arguments $3
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1510,11 +1526,6 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
get_config No
|
get_config No
|
||||||
|
|
||||||
g_haveconfig=Yes
|
g_haveconfig=Yes
|
||||||
|
|
||||||
if [ -z "$system" ]; then
|
|
||||||
system=$FIREWALL
|
|
||||||
[ -n "$system" ] || fatal_error "No system name given and the FIREWALL option is not set"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
fatal_error "$g_shorewalldir/$g_program.conf does not exist"
|
fatal_error "$g_shorewalldir/$g_program.conf does not exist"
|
||||||
fi
|
fi
|
||||||
@@ -1731,7 +1742,7 @@ compiler_command() {
|
|||||||
safe_commands $@
|
safe_commands $@
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
fatal_error "Invalid command: $COMMAND"
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -154,20 +154,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>nat</option></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.13. Specifies that this action is
|
|
||||||
to be used in <ulink
|
|
||||||
url="shorewall-snat.html">shorewall-snat(5)</ulink> rather
|
|
||||||
than <ulink
|
|
||||||
url="shorewall-rules.html">shorewall-rules(5)</ulink>. The
|
|
||||||
<option>mangle</option> and <option>nat</option> options are
|
|
||||||
mutually exclusive.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>noinline</option></term>
|
<term><option>noinline</option></term>
|
||||||
|
|
||||||
|
@@ -306,72 +306,6 @@ loc eth2 -</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">dbl={none|src|dst|src-dst}</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.10. This option defined whether
|
|
||||||
or not dynamic blacklisting is applied to packets entering the
|
|
||||||
firewall through this interface and whether the source address
|
|
||||||
and/or destination address is to be compared against the
|
|
||||||
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
|
|
||||||
<ulink
|
|
||||||
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink>).
|
|
||||||
The default is determine by the setting of
|
|
||||||
DYNAMIC_BLACKLIST:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=No</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis role="bold">none</emphasis>
|
|
||||||
(e.g., no dynamic blacklist checking).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=Yes</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis role="bold">src</emphasis>
|
|
||||||
(e.g., the source IP address is checked).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=ipset[-only]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis
|
|
||||||
role="bold">src</emphasis>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=ipset[-only],src-dst...</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis
|
|
||||||
role="bold">src-dst</emphasis> (e.g., the source IP
|
|
||||||
addresses in checked against the ipset on input and the
|
|
||||||
destination IP address is checked against the ipset on
|
|
||||||
packets originating from the firewall and leaving
|
|
||||||
through this interface).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>The normal setting for this option will be <emphasis
|
|
||||||
role="bold">dst</emphasis> or <emphasis
|
|
||||||
role="bold">none</emphasis> for internal interfaces and
|
|
||||||
<emphasis role="bold">src</emphasis> or <emphasis
|
|
||||||
role="bold">src-dst</emphasis> for Internet-facing
|
|
||||||
interfaces.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">destonly</emphasis></term>
|
<term><emphasis role="bold">destonly</emphasis></term>
|
||||||
|
|
||||||
@@ -414,7 +348,7 @@ loc eth2 -</programlisting>
|
|||||||
url="../bridge-Shorewall-perl.html">Shorewall-perl for
|
url="../bridge-Shorewall-perl.html">Shorewall-perl for
|
||||||
firewall/bridging</ulink>, then you need to include
|
firewall/bridging</ulink>, then you need to include
|
||||||
DHCP-specific rules in <ulink
|
DHCP-specific rules in <ulink
|
||||||
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5).
|
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(8).
|
||||||
DHCP uses UDP ports 67 and 68.</para>
|
DHCP uses UDP ports 67 and 68.</para>
|
||||||
</note>
|
</note>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -446,7 +380,7 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">loopback</emphasis></term>
|
<term>loopback</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.6.6. Designates the interface as
|
<para>Added in Shorewall 4.6.6. Designates the interface as
|
||||||
@@ -517,8 +451,8 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold"><emphasis
|
<term><emphasis
|
||||||
role="bold">mss</emphasis>=</emphasis><emphasis>number</emphasis></term>
|
role="bold">mss</emphasis>=<emphasis>number</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.0.3. Causes forwarded TCP SYN
|
<para>Added in Shorewall 4.0.3. Causes forwarded TCP SYN
|
||||||
@@ -559,10 +493,7 @@ loc eth2 -</programlisting>
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
||||||
blacklisting is disabled on the interface. Beginning with
|
blacklisting is disabled on the interface.</para>
|
||||||
Shorewall 5.0.10, <emphasis role="bold">nodbl</emphasis> is
|
|
||||||
equivalent to <emphasis
|
|
||||||
role="bold">dbl=none</emphasis>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -137,7 +137,7 @@
|
|||||||
<replaceable>action</replaceable> must be an action declared
|
<replaceable>action</replaceable> must be an action declared
|
||||||
with the <option>mangle</option> option in <ulink
|
with the <option>mangle</option> option in <ulink
|
||||||
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>.
|
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>.
|
||||||
If the action accepts parameters, they are specified as a
|
If the action accepts paramaters, they are specified as a
|
||||||
comma-separated list within parentheses following the
|
comma-separated list within parentheses following the
|
||||||
<replaceable>action</replaceable> name.</para>
|
<replaceable>action</replaceable> name.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -355,8 +355,7 @@ DIVERTHA - - tcp</programlisting>
|
|||||||
EF => 0x2e</programlisting>
|
EF => 0x2e</programlisting>
|
||||||
|
|
||||||
<para>To indicate more than one class, add their hex values
|
<para>To indicate more than one class, add their hex values
|
||||||
together and specify the result. By default, DSCP rules are
|
together and specify the result.</para>
|
||||||
placed in the POSTROUTING chain.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -599,36 +598,6 @@ INLINE eth0 - ; -p tcp -j MARK --set
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">NFLOG</emphasis>[(<emphasis>nflog-parameters</emphasis>)]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.9. Logs matching packets using
|
|
||||||
NFLOG. The <replaceable>nflog-parameters</replaceable> are a
|
|
||||||
comma-separated list of up to 3 numbers:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>The first number specifies the netlink group
|
|
||||||
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
|
|
||||||
0 is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The second number specifies the maximum number of
|
|
||||||
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The third number specifies the number of log
|
|
||||||
messages that should be buffered in the kernel before they
|
|
||||||
are sent to user space. The default is 1.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">RESTORE</emphasis>[(<emphasis>mask</emphasis>)]</term>
|
role="bold">RESTORE</emphasis>[(<emphasis>mask</emphasis>)]</term>
|
||||||
@@ -1255,17 +1224,6 @@ Normal-Service => 0x00</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>contiguous</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shoreawll 5.0.12. When <emphasis
|
|
||||||
role="bold">timestop</emphasis> is smaller than <emphasis
|
|
||||||
role="bold">timestart</emphasis> value, match this as a single
|
|
||||||
time period instead of distinct intervals.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>utc</term>
|
<term>utc</term>
|
||||||
|
|
||||||
@@ -1376,7 +1334,7 @@ Normal-Service => 0x00</programlisting>
|
|||||||
round-robin fashion between addresses 1.1.1.1, 1.1.1.3, and 1.1.1.9
|
round-robin fashion between addresses 1.1.1.1, 1.1.1.3, and 1.1.1.9
|
||||||
(Shorewall 4.5.9 and later).</para>
|
(Shorewall 4.5.9 and later).</para>
|
||||||
|
|
||||||
<programlisting>/etc/shorewall/mangle:
|
<programlisting>/etc/shorewall/tcrules:
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
||||||
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
|
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
|
||||||
|
@@ -25,10 +25,8 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para>This file is used to define dynamic NAT (Masquerading) and to define
|
<para>Use this file to define dynamic NAT (Masquerading) and to define
|
||||||
Source NAT (SNAT). While still supported, its use is deprecated in favor
|
Source NAT (SNAT).</para>
|
||||||
of <ulink url="shorewall-snat.html">shorewall-snat</ulink>(5) which was
|
|
||||||
introduced in Shorewall 5.0.14.</para>
|
|
||||||
|
|
||||||
<warning>
|
<warning>
|
||||||
<para>The entries in this file are order-sensitive. The first entry that
|
<para>The entries in this file are order-sensitive. The first entry that
|
||||||
@@ -164,7 +162,7 @@
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">ADDRESS</emphasis> (Optional) - [<emphasis
|
<term><emphasis role="bold">ADDRESS</emphasis> (Optional) - [<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis
|
role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">NONAT</emphasis>|[<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
|
role="bold">NONAT</emphasis>|[<emphasis>address-or-address-range</emphasis>[,<emphasis>address-or-address-range</emphasis>]...][:<emphasis>lowport</emphasis><emphasis
|
||||||
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
||||||
role="bold">:random</emphasis>][:persistent]|<emphasis
|
role="bold">:random</emphasis>][:persistent]|<emphasis
|
||||||
role="bold">detect</emphasis>|<emphasis
|
role="bold">detect</emphasis>|<emphasis
|
||||||
@@ -684,7 +682,7 @@
|
|||||||
#INTERFACE SOURCE ADDRESS ...
|
#INTERFACE SOURCE ADDRESS ...
|
||||||
eth0 192.168.1.0/24 1.1.1.1 ; mark=1:C
|
eth0 192.168.1.0/24 1.1.1.1 ; mark=1:C
|
||||||
eth0 192.168.1.0/24 1.1.1.3 ; mark=2:C
|
eth0 192.168.1.0/24 1.1.1.3 ; mark=2:C
|
||||||
eth0 192.168.1.0/24 1.1.1.9 ; mark=3:C</programlisting>
|
eth0 192.168.1.0/24 1.1.1.4 ; mark=3:C</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
<para>This file determines what to do with a new connection request if
|
<para>This file determines what to do with a new connection request if
|
||||||
we don't get a match from the /etc/shorewall/rules file . For each
|
we don't get a match from the /etc/shorewall/rules file . For each
|
||||||
source/destination pair, the file is processed in order until a match is
|
source/destination pair, the file is processed in order until a match is
|
||||||
found ("all" will match any source or destination).</para>
|
found ("all" will match any client or server).</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<important>
|
<important>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> -
|
<term><emphasis role="bold">SOURCE</emphasis> -
|
||||||
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
<emphasis>zone</emphasis>|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -74,18 +74,12 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
|
||||||
separated by commas. As above, if '+' is specified after two or more
|
|
||||||
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
|
||||||
policy if the same <replaceable>zone</replaceable> appears in both
|
|
||||||
the SOURCE and DEST columns.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DEST</emphasis> -
|
<term><emphasis role="bold">DEST</emphasis> -
|
||||||
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
<emphasis>zone</emphasis>|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -101,12 +95,6 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
|
||||||
separated by commas. As above, if '+' is specified after two or more
|
|
||||||
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
|
||||||
policy if the same <replaceable>zone</replaceable> appears in both
|
|
||||||
the SOURCE and DEST columns.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -406,16 +406,6 @@
|
|||||||
are present.</para>
|
are present.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>The generated script will attempt to reenable a
|
|
||||||
disabled persistent provider during execution of the
|
|
||||||
<command>start</command>, <command>restart</command> and
|
|
||||||
<command>reload</command> commands. When
|
|
||||||
<option>persistent</option> is not specified, only the
|
|
||||||
<command>enable</command> and <command>reenable</command>
|
|
||||||
commands can reenable the provider.</para>
|
|
||||||
</note>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@@ -597,29 +597,7 @@
|
|||||||
the next rule. See <ulink
|
the next rule. See <ulink
|
||||||
url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
||||||
|
|
||||||
<para>The <replaceable>nflog-parameters</replaceable> are a
|
<para>Similar to<emphasis role="bold">
|
||||||
comma-separated list of up to 3 numbers:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>The first number specifies the netlink group
|
|
||||||
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
|
|
||||||
0 is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The second number specifies the maximum number of
|
|
||||||
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The third number specifies the number of log
|
|
||||||
messages that should be buffered in the kernel before they
|
|
||||||
are sent to user space. The default is 1.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
|
|
||||||
<para>NFLOG is similar to<emphasis role="bold">
|
|
||||||
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
|
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
|
||||||
except that the log level is not changed when this ACTION is
|
except that the log level is not changed when this ACTION is
|
||||||
used in an action or macro body and the invocation of that
|
used in an action or macro body and the invocation of that
|
||||||
@@ -653,12 +631,12 @@
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold"><emphasis
|
<term><emphasis role="bold"><emphasis
|
||||||
role="bold">NFQUEUE!</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
|
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>like NFQUEUE but exempts the rule from being suppressed
|
<para>like NFQUEUE but exempts the rule from being suppressed
|
||||||
by OPTIMIZE=1 in <ulink
|
by OPTIMIZE=1 in <ulink
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
|
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5).</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1682,17 +1660,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>contiguous</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shoreawll 5.0.12. When <emphasis
|
|
||||||
role="bold">timestop</emphasis> is smaller than <emphasis
|
|
||||||
role="bold">timestart</emphasis> value, match this as a single
|
|
||||||
time period instead of distinct intervals.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>utc</term>
|
<term>utc</term>
|
||||||
|
|
||||||
|
@@ -1,743 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
|
||||||
<refentry>
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>shorewall-snat</refentrytitle>
|
|
||||||
|
|
||||||
<manvolnum>5</manvolnum>
|
|
||||||
|
|
||||||
<refmiscinfo>Configuration Files</refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>snat</refname>
|
|
||||||
|
|
||||||
<refpurpose>Shorewall SNAT/Masquerade definition file</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>/etc/shorewall/snat</command>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Description</title>
|
|
||||||
|
|
||||||
<para>This file is used to define dynamic NAT (Masquerading) and to define
|
|
||||||
Source NAT (SNAT). It superseded <ulink
|
|
||||||
url="shorewall-masq.html">shorewall-masq</ulink>(5) in Shorewall
|
|
||||||
5.0.14.</para>
|
|
||||||
|
|
||||||
<warning>
|
|
||||||
<para>The entries in this file are order-sensitive. The first entry that
|
|
||||||
matches a particular connection will be the one that is used.</para>
|
|
||||||
</warning>
|
|
||||||
|
|
||||||
<warning>
|
|
||||||
<para>If you have more than one ISP link, adding entries to this file
|
|
||||||
will <emphasis role="bold">not</emphasis> force connections to go out
|
|
||||||
through a particular link. You must use entries in <ulink
|
|
||||||
url="/manpages/shorewall-rtrules.html">shorewall-rtrules</ulink>(5) or
|
|
||||||
PREROUTING entries in <ulink
|
|
||||||
url="/manpages/shorewall-mangle.html">shorewall-mangle</ulink>(5) to do
|
|
||||||
that.</para>
|
|
||||||
</warning>
|
|
||||||
|
|
||||||
<para>The columns in the file are as follows.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ACTION</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the type of rule to generate. Choices are:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">MASQUERADE[+]</emphasis>[([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Causes matching outgoing packages to have their source
|
|
||||||
IP address set to the primary IP address of the interface
|
|
||||||
specified in the DEST column. if
|
|
||||||
<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>
|
|
||||||
is given, that port range will be used to assign a source
|
|
||||||
port. If option <option>random</option> is used then port
|
|
||||||
mapping will be randomized. MASQUERADE should only be used
|
|
||||||
when the DEST interface has a dynamic IP address. Otherwise,
|
|
||||||
SNAT should be used and should specify the interface's static
|
|
||||||
address.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">SNAT[+]</emphasis>([<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
|
|
||||||
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
|
||||||
role="bold">:random</emphasis>][:<option>persistent</option>]|<emphasis
|
|
||||||
role="bold">detect</emphasis>|</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you specify an address here, matching packets will
|
|
||||||
have their source address set to that address. If
|
|
||||||
ADD_SNAT_ALIASES is set to Yes or yes in <ulink
|
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
|
||||||
then Shorewall will automatically add this address to the
|
|
||||||
INTERFACE named in the first column.</para>
|
|
||||||
|
|
||||||
<para>You may also specify a range of up to 256 IP addresses
|
|
||||||
if you want the SNAT address to be assigned from that range in
|
|
||||||
a round-robin fashion by connection. The range is specified by
|
|
||||||
<emphasis>first.ip.in.range</emphasis>-<emphasis>last.ip.in.range</emphasis>.
|
|
||||||
You may follow the port range with<emphasis role="bold">
|
|
||||||
:random</emphasis> in which case assignment of ports from the
|
|
||||||
list will be random. <emphasis role="bold">random</emphasis>
|
|
||||||
may also be specified by itself in this column in which case
|
|
||||||
random local port assignments are made for the outgoing
|
|
||||||
connections.</para>
|
|
||||||
|
|
||||||
<para>Example: 206.124.146.177-206.124.146.180</para>
|
|
||||||
|
|
||||||
<para>You may follow the port range (or <emphasis
|
|
||||||
role="bold">:random</emphasis>) with <emphasis
|
|
||||||
role="bold">:persistent</emphasis>. This is only useful when
|
|
||||||
an address range is specified and causes a client to be given
|
|
||||||
the same source/destination IP pair. This feature replaces the
|
|
||||||
SAME modifier which was removed from Shorewall in version
|
|
||||||
4.4.0.</para>
|
|
||||||
|
|
||||||
<para>You may also use the special value
|
|
||||||
<option>detect</option> which causes Shorewall to determine
|
|
||||||
the IP addresses configured on the interface named in the DEST
|
|
||||||
column and substitute them in this column.</para>
|
|
||||||
|
|
||||||
<para>Finally, you may also specify a comma-separated list of
|
|
||||||
ranges and/or addresses in this column.</para>
|
|
||||||
|
|
||||||
<para>DNS Names names are not allowed.</para>
|
|
||||||
|
|
||||||
<para>Normally, Netfilter will attempt to retain the source
|
|
||||||
port number. You may cause netfilter to remap the source port
|
|
||||||
by following an address or range (if any) by ":" and a port
|
|
||||||
range with the format
|
|
||||||
<emphasis>lowport</emphasis>-<emphasis>highport</emphasis>. If
|
|
||||||
this is done, you must specify "tcp", "udp", "dccp" or "stcp"
|
|
||||||
in the PROTO column.</para>
|
|
||||||
|
|
||||||
<para>Examples:</para>
|
|
||||||
|
|
||||||
<programlisting> 192.0.2.4:5000-6000
|
|
||||||
:4000-5000</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">CONTINUE</emphasis>[+]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Causes matching packets to be exempted from any
|
|
||||||
following rules in the file.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <replaceable>action</replaceable> is an action
|
|
||||||
declared in <ulink
|
|
||||||
url="shorewall-actions.html">shorewall-actions(5)</ulink> with
|
|
||||||
the <option>nat</option> option. See <ulink
|
|
||||||
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
|
|
||||||
further information.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>Normally Masq/SNAT rules are evaluated after those for
|
|
||||||
one-to-one NAT (defined in <ulink
|
|
||||||
url="/manpages/shorewall-nat.html">shorewall-nat</ulink>(5)). If you
|
|
||||||
want the rule to be applied before one-to-one NAT rules, follow the
|
|
||||||
action name with "+": This feature should only be required if you
|
|
||||||
need to insert rules in this file that preempt entries in <ulink
|
|
||||||
url="/manpages/shorewall-nat.html">shorewall-nat</ulink>(5).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> (Optional) -
|
|
||||||
[<emphasis>interface</emphasis>|<emphasis>address</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>address</emphasis>...][<emphasis>exclusion</emphasis>]]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Set of hosts that you wish to masquerade. You can specify this
|
|
||||||
as an <emphasis>address</emphasis> (net or host) or as an
|
|
||||||
<emphasis>interface</emphasis> (use of an
|
|
||||||
<emphasis>interface</emphasis> is deprecated). If you give the name
|
|
||||||
of an interface, the interface must be up before you start the
|
|
||||||
firewall and the Shorewall rules compiler will warn you of that
|
|
||||||
fact. (Shorewall will use your main routing table to determine the
|
|
||||||
appropriate addresses to masquerade).</para>
|
|
||||||
|
|
||||||
<para>The preferred way to specify the SOURCE is to supply one or
|
|
||||||
more host or network addresses separated by comma. You may use ipset
|
|
||||||
names preceded by a plus sign (+) to specify a set of hosts.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">DEST</emphasis> - {[<emphasis
|
|
||||||
role="bold">+</emphasis>]<emphasis>interface</emphasis>[<emphasis
|
|
||||||
role="bold">:</emphasis>[<emphasis>digit</emphasis>]][<emphasis
|
|
||||||
role="bold">:</emphasis>[<emphasis>dest-address</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>dest-address</emphasis>]...[<emphasis>exclusion</emphasis>]]}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Outgoing <emphasis>interface</emphasis>. This is usually your
|
|
||||||
internet interface. If ADD_SNAT_ALIASES=Yes in <ulink
|
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5), you
|
|
||||||
may add ":" and a <emphasis>digit</emphasis> to indicate that you
|
|
||||||
want the alias added with that name (e.g., eth0:0). This will allow
|
|
||||||
the alias to be displayed with ifconfig. <emphasis role="bold">That
|
|
||||||
is the only use for the alias name; it may not appear in any other
|
|
||||||
place in your Shorewall configuration.</emphasis></para>
|
|
||||||
|
|
||||||
<para>Each interface must match an entry in <ulink
|
|
||||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
|
||||||
Shorewall allows loose matches to wildcard entries in <ulink
|
|
||||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
|
||||||
For example, <filename class="devicefile">ppp0</filename> in this
|
|
||||||
file will match a <ulink
|
|
||||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
|
|
||||||
entry that defines <filename
|
|
||||||
class="devicefile">ppp+</filename>.</para>
|
|
||||||
|
|
||||||
<para>Where <ulink url="/4.4/MultiISP.html#Shared">more that one
|
|
||||||
internet provider share a single interface</ulink>, the provider is
|
|
||||||
specified by including the provider name or number in
|
|
||||||
parentheses:</para>
|
|
||||||
|
|
||||||
<programlisting> eth0(Avvanta)</programlisting>
|
|
||||||
|
|
||||||
<para>In that case, you will want to specify the interface's address
|
|
||||||
for that provider as the SNAT parameter.</para>
|
|
||||||
|
|
||||||
<para>The interface may be qualified by adding the character ":"
|
|
||||||
followed by a comma-separated list of destination host or subnet
|
|
||||||
addresses to indicate that you only want to change the source IP
|
|
||||||
address for packets being sent to those particular destinations.
|
|
||||||
Exclusion is allowed (see <ulink
|
|
||||||
url="/manpages/shorewall-exclusion.html">shorewall-exclusion</ulink>(5))
|
|
||||||
as are ipset names preceded by a plus sign '+';</para>
|
|
||||||
|
|
||||||
<para>If you wish to inhibit the action of ADD_SNAT_ALIASES for this
|
|
||||||
entry then include the ":" but omit the digit:</para>
|
|
||||||
|
|
||||||
<programlisting> eth0(Avvanta):
|
|
||||||
eth2::192.0.2.32/27</programlisting>
|
|
||||||
|
|
||||||
<para>Comments may be attached to Netfilter rules generated from
|
|
||||||
entries in this file through the use of ?COMMENT lines. These lines
|
|
||||||
begin with ?COMMENT; the remainder of the line is treated as a
|
|
||||||
comment which is attached to subsequent rules until another ?COMMENT
|
|
||||||
line is found or until the end of the file is reached. To stop
|
|
||||||
adding comments to rules, use a line containing only
|
|
||||||
?COMMENT.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">PROTO</emphasis> (Optional) - {<emphasis
|
|
||||||
role="bold">-</emphasis>|[!]{<emphasis>protocol-name</emphasis>|<emphasis>protocol-number</emphasis>}[,...]|+<replaceable>ipset</replaceable>}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you wish to restrict this entry to a particular protocol
|
|
||||||
then enter the protocol name (from protocols(5)) or number
|
|
||||||
here.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.12, this column can accept a
|
|
||||||
comma-separated list of protocols.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.6.0, an
|
|
||||||
<replaceable>ipset</replaceable> name can be specified in this
|
|
||||||
column. This is intended to be used with
|
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">PORT</emphasis> (Optional) -
|
|
||||||
{-|[!]<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the PROTO column specifies TCP (6), UDP (17), DCCP (33),
|
|
||||||
SCTP (132) or UDPLITE (136) then you may list one or more port
|
|
||||||
numbers (or names from services(5)) or port ranges separated by
|
|
||||||
commas.</para>
|
|
||||||
|
|
||||||
<para>Port ranges are of the form
|
|
||||||
<emphasis>lowport</emphasis>:<emphasis>highport</emphasis>.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.6.0, an
|
|
||||||
<replaceable>ipset</replaceable> name can be specified in this
|
|
||||||
column. This is intended to be used with
|
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">IPSEC</emphasis> (Optional) -
|
|
||||||
[<emphasis>option</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>option</emphasis>]...]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you specify a value other than "-" in this column, you must
|
|
||||||
be running kernel 2.6 and your kernel and iptables must include
|
|
||||||
policy match support.</para>
|
|
||||||
|
|
||||||
<para>Comma-separated list of options from the following. Only
|
|
||||||
packets that will be encrypted via an SA that matches these options
|
|
||||||
will have their source address changed.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">reqid=</emphasis><emphasis>number</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <emphasis>number</emphasis> is specified using
|
|
||||||
setkey(8) using the 'unique:<emphasis>number</emphasis> option
|
|
||||||
for the SPD level.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">spi=</emphasis><number></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <emphasis>number</emphasis> is the SPI of the SA
|
|
||||||
used to encrypt/decrypt packets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">proto=</emphasis><emphasis
|
|
||||||
role="bold">ah</emphasis>|<emphasis
|
|
||||||
role="bold">esp</emphasis>|<emphasis
|
|
||||||
role="bold">ipcomp</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>IPSEC Encapsulation Protocol</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">mss=</emphasis><emphasis>number</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>sets the MSS field in TCP packets</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">mode=</emphasis><emphasis
|
|
||||||
role="bold">transport</emphasis>|<emphasis
|
|
||||||
role="bold">tunnel</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>IPSEC mode</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">tunnel-src=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>only available with mode=tunnel</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">tunnel-dst=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>only available with mode=tunnel</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">strict</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Means that packets must match all rules.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">next</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Separates rules; can only be used with strict</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">yes</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>When used by itself, causes all traffic that will be
|
|
||||||
encrypted/encapsulated to match the rule.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">MARK</emphasis> - [<emphasis
|
|
||||||
role="bold">!</emphasis>]<emphasis>value</emphasis>[/<emphasis>mask</emphasis>][<emphasis
|
|
||||||
role="bold">:C</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines a test on the existing packet or connection mark. The
|
|
||||||
rule will match only if the test returns true.</para>
|
|
||||||
|
|
||||||
<para>If you don't want to define a test but need to specify
|
|
||||||
anything in the following columns, place a "-" in this field.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>!</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Inverts the test (not equal)</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis>value</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Value of the packet or connection mark.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis>mask</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>A mask to be applied to the mark before testing.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">:C</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Designates a connection mark. If omitted, the packet
|
|
||||||
mark's value is tested.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">USER</emphasis> (Optional) - [<emphasis
|
|
||||||
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
|
||||||
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
|
||||||
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>This column was formerly labelled USER/GROUP.</para>
|
|
||||||
|
|
||||||
<para>Only locally-generated connections will match if this column
|
|
||||||
is non-empty.</para>
|
|
||||||
|
|
||||||
<para>When this column is non-empty, the rule matches only if the
|
|
||||||
program generating the output is running under the effective
|
|
||||||
<emphasis>user</emphasis> and/or <emphasis>group</emphasis>
|
|
||||||
specified (or is NOT running under that id if "!" is given).</para>
|
|
||||||
|
|
||||||
<para>Examples:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>joe</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must be run by joe</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>:kids</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must be run by a member of the 'kids'
|
|
||||||
group</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>!:kids</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must not be run by a member of the 'kids'
|
|
||||||
group</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>+upnpd</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>#program named upnpd</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>The ability to specify a program name was removed from
|
|
||||||
Netfilter in kernel version 2.6.14.</para>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">SWITCH -
|
|
||||||
[!]<replaceable>switch-name</replaceable>[={0|1}]</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 4.5.1 and allows enabling and disabling the
|
|
||||||
rule without requiring <command>shorewall restart</command>.</para>
|
|
||||||
|
|
||||||
<para>The rule is enabled if the value stored in
|
|
||||||
<filename>/proc/net/nf_condition/<replaceable>switch-name</replaceable></filename>
|
|
||||||
is 1. The rule is disabled if that file contains 0 (the default). If
|
|
||||||
'!' is supplied, the test is inverted such that the rule is enabled
|
|
||||||
if the file contains 0.</para>
|
|
||||||
|
|
||||||
<para>Within the <replaceable>switch-name</replaceable>, '@0' and
|
|
||||||
'@{0}' are replaced by the name of the chain to which the rule is a
|
|
||||||
added. The <replaceable>switch-name</replaceable> (after '@...'
|
|
||||||
expansion) must begin with a letter and be composed of letters,
|
|
||||||
decimal digits, underscores or hyphens. Switch names must be 30
|
|
||||||
characters or less in length.</para>
|
|
||||||
|
|
||||||
<para>Switches are normally <emphasis role="bold">off</emphasis>. To
|
|
||||||
turn a switch <emphasis role="bold">on</emphasis>:</para>
|
|
||||||
|
|
||||||
<simplelist>
|
|
||||||
<member><command>echo 1 >
|
|
||||||
/proc/net/nf_condition/<replaceable>switch-name</replaceable></command></member>
|
|
||||||
</simplelist>
|
|
||||||
|
|
||||||
<para>To turn it <emphasis role="bold">off</emphasis> again:</para>
|
|
||||||
|
|
||||||
<simplelist>
|
|
||||||
<member><command>echo 0 >
|
|
||||||
/proc/net/nf_condition/<replaceable>switch-name</replaceable></command></member>
|
|
||||||
</simplelist>
|
|
||||||
|
|
||||||
<para>Switch settings are retained over <command>shorewall
|
|
||||||
restart</command>.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.10, when the
|
|
||||||
<replaceable>switch-name</replaceable> is followed by
|
|
||||||
<option>=0</option> or <option>=1</option>, then the switch is
|
|
||||||
initialized to off or on respectively by the
|
|
||||||
<command>start</command> command. Other commands do not affect the
|
|
||||||
switch setting.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
|
|
||||||
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>(Optional) Added in Shorewall 4.5.6. This column may be
|
|
||||||
included and may contain one or more addresses (host or network)
|
|
||||||
separated by commas. Address ranges are not allowed. When this
|
|
||||||
column is supplied, rules are generated that require that the
|
|
||||||
original destination address matches one of the listed addresses. It
|
|
||||||
is useful for specifying that SNAT should occur only for connections
|
|
||||||
that were acted on by a DNAT when they entered the firewall.</para>
|
|
||||||
|
|
||||||
<para>This column was formerly labelled ORIGINAL DEST.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">PROBABILITY</emphasis> -
|
|
||||||
[<replaceable>probability</replaceable>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.0. When non-empty, requires the
|
|
||||||
<firstterm>Statistics Match</firstterm> capability in your kernel
|
|
||||||
and ip6tables and causes the rule to match randomly but with the
|
|
||||||
given <replaceable>probability</replaceable>. The
|
|
||||||
<replaceable>probability</replaceable> is a number 0 <
|
|
||||||
<replaceable>probability</replaceable> <= 1 and may be expressed
|
|
||||||
at up to 8 decimal points of precision.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Examples</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 1:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>You have a simple masquerading setup where eth0 connects to a
|
|
||||||
DSL or cable modem and eth1 connects to your local network with
|
|
||||||
subnet 192.168.0.0/24.</para>
|
|
||||||
|
|
||||||
<para>Your entry in the file will be:</para>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST
|
|
||||||
MASQUERADE 192.168.0.0/24 eth0</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 2:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>You add a router to your local network to connect subnet
|
|
||||||
192.168.1.0/24 which you also want to masquerade. You then add a
|
|
||||||
second entry for eth0 to this file:</para>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST
|
|
||||||
MASQUERADE 192.168.0.0/24 eth0
|
|
||||||
MASQUERADE 192.168.1.0/24 eth0</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 3:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>You want all outgoing traffic from 192.168.1.0/24 through eth0
|
|
||||||
to use source address 206.124.146.176 which is NOT the primary
|
|
||||||
address of eth0. You want 206.124.146.176 to be added to eth0 with
|
|
||||||
name eth0:0.</para>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST
|
|
||||||
SNAT(206.124.146.176) 192.168.1.0/24 eth0:0</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 4:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>You want all outgoing SMTP traffic entering the firewall from
|
|
||||||
172.20.1.0/29 to be sent from eth0 with source IP address
|
|
||||||
206.124.146.177. You want all other outgoing traffic from
|
|
||||||
172.20.1.0/29 to be sent from eth0 with source IP address
|
|
||||||
206.124.146.176.</para>
|
|
||||||
|
|
||||||
<programlisting> #INTERFACE SOURCE ADDRESS PROTO DPORT
|
|
||||||
eth0 172.20.1.0/29 206.124.146.177 tcp smtp
|
|
||||||
eth0 172.20.1.0/29 206.124.146.176</programlisting>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.177) 172.20.1.0/29 eth0 tcp smtp
|
|
||||||
SNAT(206.124.146.176) 172.20.1.0/29 eth0</programlisting>
|
|
||||||
|
|
||||||
<warning>
|
|
||||||
<para>The order of the above two rules is significant!</para>
|
|
||||||
</warning>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 5:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Connections leaving on eth0 and destined to any host defined
|
|
||||||
in the ipset <emphasis>myset</emphasis> should have the source IP
|
|
||||||
address changed to 206.124.146.177.</para>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST
|
|
||||||
SNAT(206.124.146.177) - eth0+myset[dst]</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 6:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
|
|
||||||
round-robin fashion between addresses 1.1.1.1, 1.1.1.3, and 1.1.1.9
|
|
||||||
(Shorewall 4.5.9 and later).</para>
|
|
||||||
|
|
||||||
<programlisting>/etc/shorewall/tcrules:
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
|
||||||
1-3:CF 192.168.1.0/24 eth0 ; state=NEW
|
|
||||||
|
|
||||||
/etc/shorewall/snat:
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST
|
|
||||||
SNAT(1.1.1.1) 192.168.1.0/24 eth0 { mark=1:C }
|
|
||||||
SNAT(1.1.1.3) 192.168.1.0/24 eth0 { mark=2:C }
|
|
||||||
SNAT(1.1.1.9) 192.168.1.0/24 eth0 { mark=3:C }</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 7:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Your eth1 has two public IP addresses: 70.90.191.121 and
|
|
||||||
70.90.191.123. You want to use the iptables statistics match to
|
|
||||||
masquerade outgoing connections evenly between these two
|
|
||||||
addresses.</para>
|
|
||||||
|
|
||||||
<programlisting>/etc/shorewall/snat:
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST
|
|
||||||
SNAT(70.90.191.121) - eth1 { probability=.50 }
|
|
||||||
SNAT(70.90.191.123) - eth1</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>FILES</title>
|
|
||||||
|
|
||||||
<para>/etc/shorewall/snat</para>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>See ALSO</title>
|
|
||||||
|
|
||||||
<para><ulink
|
|
||||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
|
||||||
|
|
||||||
<para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
|
|
||||||
shorewall-blacklist(5), shorewall-exclusion(5), shorewall-hosts(5),
|
|
||||||
shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5),
|
|
||||||
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
|
|
||||||
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
|
|
||||||
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
|
|
||||||
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
|
|
||||||
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
|
|
||||||
shorewall-tunnels(5), shorewall-zones(5)</para>
|
|
||||||
</refsect1>
|
|
||||||
</refentry>
|
|
@@ -307,9 +307,6 @@
|
|||||||
that were active when Shorewall stopped continue to work and
|
that were active when Shorewall stopped continue to work and
|
||||||
all new connections from the firewall system itself are
|
all new connections from the firewall system itself are
|
||||||
allowed.</para>
|
allowed.</para>
|
||||||
|
|
||||||
<para>Note that the routestopped file is not supported in
|
|
||||||
Shorewall 5.0 and later versions.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -484,8 +481,8 @@
|
|||||||
|
|
||||||
<para>ALL sends all packets through the blacklist chains.</para>
|
<para>ALL sends all packets through the blacklist chains.</para>
|
||||||
|
|
||||||
<para>Note: The ESTABLISHED state may not be specified if
|
<para>Note: The ESTABLISHED state may not be specified if FASTACCEPT
|
||||||
FASTACCEPT=Yes is specified.</para>
|
is specified.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -580,14 +577,13 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
||||||
then Shorewall won't clear the current traffic control rules during
|
then Shorewall won't clear the current traffic control rules during
|
||||||
[<command>re</command>]<command>start</command> or
|
[re]start. This setting is intended for use by people who prefer to
|
||||||
<command>reload</command>. This setting is intended for use by
|
configure traffic shaping when the network interfaces come up rather
|
||||||
people who prefer to configure traffic shaping when the network
|
than when the firewall is started. If that is what you want to do,
|
||||||
interfaces come up rather than when the firewall is started. If that
|
set TC_ENABLED=Yes and CLEAR_TC=No and do not supply an
|
||||||
is what you want to do, set TC_ENABLED=Yes and CLEAR_TC=No and do
|
/etc/shorewall/tcstart file. That way, your traffic shaping rules
|
||||||
not supply an /etc/shorewall/tcstart file. That way, your traffic
|
can still use the “fwmark” classifier based on packet marking
|
||||||
shaping rules can still use the “fwmark” classifier based on packet
|
defined in <ulink
|
||||||
marking defined in <ulink
|
|
||||||
url="/manpages/shorewall-tcrules.html">shorewall-tcrules</ulink>(5).
|
url="/manpages/shorewall-tcrules.html">shorewall-tcrules</ulink>(5).
|
||||||
If not specified, CLEAR_TC=Yes is assumed.</para>
|
If not specified, CLEAR_TC=Yes is assumed.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -681,8 +677,8 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If set to Yes (the default value), entries in the
|
<para>If set to Yes (the default value), entries in the
|
||||||
/etc/shorewall/rtrules files cause an 'ip rule del' command to be
|
/etc/shorewall/route_stopped files cause an 'ip rule del' command to
|
||||||
generated in addition to an 'ip rule add' command. Setting this
|
be generated in addition to an 'ip rule add' command. Setting this
|
||||||
option to No, causes the 'ip rule del' command to be omitted.</para>
|
option to No, causes the 'ip rule del' command to be omitted.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -768,77 +764,28 @@
|
|||||||
role="bold">Yes</emphasis>|<emphasis
|
role="bold">Yes</emphasis>|<emphasis
|
||||||
role="bold">No</emphasis>||<emphasis
|
role="bold">No</emphasis>||<emphasis
|
||||||
role="bold">ipset</emphasis>[<emphasis
|
role="bold">ipset</emphasis>[<emphasis
|
||||||
role="bold">-only</emphasis>][<replaceable>,option</replaceable>[,...]][:[<replaceable>setname</replaceable>][:<replaceable>log_level</replaceable>|:l<replaceable>og_tag</replaceable>]]]}</term>
|
role="bold">-only</emphasis>][,<emphasis
|
||||||
|
role="bold">src-dst</emphasis>][:[<replaceable>setname</replaceable>][:<replaceable>log_level</replaceable>|:l<replaceable>og_tag</replaceable>]]]}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.7. When set to <emphasis
|
<para>Added in Shorewall 4.4.7. When set to <emphasis
|
||||||
role="bold">No</emphasis> or <emphasis role="bold">no</emphasis>,
|
role="bold">No</emphasis> or <emphasis role="bold">no</emphasis>,
|
||||||
chain-based dynamic blacklisting using <command>shorewall
|
chain-based dynamic blacklisting using the <command>shorewall6
|
||||||
drop</command>, <command>shorewall reject</command>,
|
drop</command>, <command>shorewall6 reject</command>,
|
||||||
<command>shorewall logdrop</command> and <command>shorewall
|
<command>shorewall6 logdrop</command> and <command>shorewall6
|
||||||
logreject</command> is disabled. Default is <emphasis
|
logreject</command> is disabled. Default is <emphasis
|
||||||
role="bold">Yes</emphasis>. Beginning with Shorewall 5.0.8,
|
role="bold">Yes</emphasis>. Beginning with Shorewall 5.0.8,
|
||||||
ipset-based dynamic blacklisting using the <command>shorewall
|
ipset-based dynamic blacklisting is also supported. The name of the
|
||||||
blacklist</command> command is also supported. The name of the set
|
set (<replaceable>setname</replaceable>) and the level
|
||||||
(<replaceable>setname</replaceable>) and the level
|
|
||||||
(<replaceable>log_level</replaceable>), if any, at which blacklisted
|
(<replaceable>log_level</replaceable>), if any, at which blacklisted
|
||||||
traffic is to be logged may also be specified. The default set name
|
traffic is to be logged may also be specified. The default set name
|
||||||
is SW_DBL4 and the default log level is <option>none</option> (no
|
is SW_DBL4 and the default log level is <option>none</option> (no
|
||||||
logging). If <option>ipset-only</option> is given, then chain-based
|
logging). if <option>ipset-only</option> is given, then chain-based
|
||||||
dynamic blacklisting is disabled just as if DYNAMIC_BLACKLISTING=No
|
dynamic blacklisting is disabled just as if DYNAMIC_BLACKLISTING=No
|
||||||
had been specified.</para>
|
had been specified. Normally, only packets whose source address
|
||||||
|
matches an entry in the ipsec are dropped. If
|
||||||
<para>Possible <replaceable>option</replaceable>s are:</para>
|
<option>src-dst</option> is included, then packets whose destination
|
||||||
|
address matches an entry in the ipset are also dropped.</para>
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>src-dst</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Normally, only packets whose source address matches an
|
|
||||||
entry in the ipset are dropped. If <option>src-dst</option> is
|
|
||||||
included, then packets whose destination address matches an
|
|
||||||
entry in the ipset are also dropped.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>disconnect</option></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The <option>disconnect</option> option was added in
|
|
||||||
Shorewall 5.0.13 and requires that the conntrack utility be
|
|
||||||
installed on the firewall system. When an address is
|
|
||||||
blacklisted using the <command>blacklist</command> command,
|
|
||||||
all connections originating from that address are
|
|
||||||
disconnected. if the <option>src-dst</option> option was also
|
|
||||||
specified, then all connections to that address are also
|
|
||||||
disconnected.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>timeout</option>=<replaceable>seconds</replaceable></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.13. Normally, Shorewall creates
|
|
||||||
the dynamic blacklisting ipset with timeout 0 which means that
|
|
||||||
entries are permanent. If you want entries in the set that are
|
|
||||||
not accessed for a period of time to be deleted from the set,
|
|
||||||
you may specify that period using this option. Note that the
|
|
||||||
<command>blacklist</command> command can override the ipset's
|
|
||||||
timeout setting.</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>Once the dynamic blacklisting ipset has been created,
|
|
||||||
changing this option setting requires a complete restart of
|
|
||||||
the firewall; <command>shorewall restart</command> if
|
|
||||||
RESTART=restart, otherwise <command>shorewall stop
|
|
||||||
&& shorewall start</command></para>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>When ipset-based dynamic blacklisting is enabled, the contents
|
<para>When ipset-based dynamic blacklisting is enabled, the contents
|
||||||
of the blacklist will be preserved over
|
of the blacklist will be preserved over
|
||||||
@@ -882,7 +829,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
helpers file from the administrative system into the script. When
|
helpers file from the administrative system into the script. When
|
||||||
set to No or not specified, the compiler will not copy the modules
|
set to No or not specified, the compiler will not copy the modules
|
||||||
or helpers file from <filename>/usr/share/shorewall</filename> but
|
or helpers file from <filename>/usr/share/shorewall</filename> but
|
||||||
will copy those found in another location on the CONFIG_PATH.</para>
|
will copy the found in another location on the CONFIG_PATH.</para>
|
||||||
|
|
||||||
<para>When compiling for direct use by Shorewall, causes the
|
<para>When compiling for direct use by Shorewall, causes the
|
||||||
contents of the local module or helpers file to be copied into the
|
contents of the local module or helpers file to be copied into the
|
||||||
@@ -911,27 +858,12 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">FIREWALL</emphasis>=[<emphasis>dnsname-or-ip-address</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>This option was added in Shorewall 5.0.13 and may be used on
|
|
||||||
an administrative system in directories containing the
|
|
||||||
configurations of remote firewalls. The contents of the variable are
|
|
||||||
the default value for the <replaceable>system</replaceable>
|
|
||||||
parameter to the <command>remote-start</command>,
|
|
||||||
<command>remote-reload</command> and
|
|
||||||
<command>remote-restart</command> commands.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">FORWARD_CLEAR_MARK=</emphasis>{<emphasis
|
<term><emphasis role="bold">FORWARD_CLEAR_MARK=</emphasis>{<emphasis
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.11. Traditionally, Shorewall has
|
<para>Added in Shorewall 4.4.11 Beta 3. Traditionally, Shorewall has
|
||||||
cleared the packet mark in the first rule in the mangle FORWARD
|
cleared the packet mark in the first rule in the mangle FORWARD
|
||||||
chain. This behavior is maintained with the default setting of this
|
chain. This behavior is maintained with the default setting of this
|
||||||
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
||||||
@@ -1087,12 +1019,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.0, it is no longer necessary to
|
<para>Beginning with Shorewall 5.0.0, it is no longer necessary to
|
||||||
set INLINE_MATCHES=Yes in order to be able to specify your own
|
set INLINE_MATCHES=Yes in order to be able to specify your own
|
||||||
iptables text in a rule and INLINE_MATCHES=Yes is deprecated.
|
iptables text in a rule. You may simply preface that text with a
|
||||||
Beginning with 5.0.0, you may simply preface your text with a pair
|
pair of semicolons (";;"). If alternate input is also specified in
|
||||||
of semicolons (";;"). If alternate input is also specified in the
|
the rule, it should appear before the semicolons and may be
|
||||||
rule, it should appear before the semicolons and may be separated
|
separated from normal column input by a single semicolon.</para>
|
||||||
from normal column input by a single semicolon or enclosed in curly
|
|
||||||
braces ("{....}").</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1424,7 +1354,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</term>
|
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This parameter tells the /sbin/shorewall program where to look
|
<para>This parameter tells the /sbin/shorewall program where to look
|
||||||
@@ -1434,10 +1364,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
||||||
If not assigned or if assigned an empty value, /var/log/messages is
|
If not assigned or if assigned an empty value, /var/log/messages is
|
||||||
assumed. For further information, see <ulink
|
assumed. For further information, see <ulink
|
||||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.
|
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
||||||
Beginning with Shorewall 5.0.10.1, you may specify
|
|
||||||
<option>systemd</option> to use <command>journelctl -r</command> to
|
|
||||||
read the log.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2075,9 +2002,6 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
When PAGER is given, the output of verbose <command>status</command>
|
When PAGER is given, the output of verbose <command>status</command>
|
||||||
commands and the <command>dump</command> command are piped through
|
commands and the <command>dump</command> command are piped through
|
||||||
the named program when the output file is a terminal.</para>
|
the named program when the output file is a terminal.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, the default value of this
|
|
||||||
option is the DEFAULT_PAGER setting in shorewallrc.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2267,18 +2191,18 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
#TARGET SOURCE DEST PROTO
|
#TARGET SOURCE DEST PROTO
|
||||||
Broadcast(DROP) - - -
|
Broadcast(DROP) - - -
|
||||||
DROP - - 2
|
DROP - - 2
|
||||||
INLINE - - 6 ;; -j REJECT --reject-with tcp-reset
|
INLINE - - 6 ; -j REJECT --reject-with tcp-reset
|
||||||
?if __ENHANCED_REJECT
|
?if __ENHANCED_REJECT
|
||||||
INLINE - - 17 ;; -j REJECT
|
INLINE - - 17 ; -j REJECT
|
||||||
?if __IPV4
|
?if __IPV4
|
||||||
INLINE - - 1 ;; -j REJECT --reject-with icmp-host-unreachable
|
INLINE - - 1 ; -j REJECT --reject-with icmp-host-unreachable
|
||||||
INLINE - - - ;; -j REJECT --reject-with icmp-host-prohibited
|
INLINE - - - ; -j REJECT --reject-with icmp-host-prohibited
|
||||||
?else
|
?else
|
||||||
INLINE - - 58 ;; -j REJECT --reject-with icmp6-addr-unreachable
|
INLINE - - 58 ; -j REJECT --reject-with icmp6-addr-unreachable
|
||||||
INLINE - - - ;; -j REJECT --reject-with icmp6-adm-prohibited
|
INLINE - - - ; -j REJECT --reject-with icmp6-adm-prohibited
|
||||||
?endif
|
?endif
|
||||||
?else
|
?else
|
||||||
INLINE - - - ;; -j REJECT
|
INLINE - - - ; -j REJECT
|
||||||
?endif</programlisting>
|
?endif</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -2348,7 +2272,7 @@ INLINE - - - ;; -j REJECT
|
|||||||
restored unconditionally at the top of the mangle OUTPUT and
|
restored unconditionally at the top of the mangle OUTPUT and
|
||||||
PREROUTING chains, even if the saved mark is zero. When this option
|
PREROUTING chains, even if the saved mark is zero. When this option
|
||||||
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
||||||
only if it is non-zero. If you have problems with IPSEC ESP packets
|
even when it is zero. If you have problems with IPSEC ESP packets
|
||||||
not being routed correctly on output, try setting this option to
|
not being routed correctly on output, try setting this option to
|
||||||
<emphasis role="bold">No</emphasis>.</para>
|
<emphasis role="bold">No</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -2524,9 +2448,10 @@ INLINE - - - ;; -j REJECT
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This option is used to specify the shell program to be used to
|
<para>This option is used to specify the shell program to be used to
|
||||||
interpret the compiled script. If not specified or specified as a
|
run the Shorewall compiler and to interpret the compiled script. If
|
||||||
null value, /bin/sh is assumed. Using a light-weight shell such as
|
not specified or specified as a null value, /bin/sh is assumed.
|
||||||
ash or dash can significantly improve performance.</para>
|
Using a light-weight shell such as ash or dash can significantly
|
||||||
|
improve performance.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2583,7 +2508,7 @@ INLINE - - - ;; -j REJECT
|
|||||||
role="bold">refresh</emphasis>, <emphasis
|
role="bold">refresh</emphasis>, <emphasis
|
||||||
role="bold">try</emphasis>, and <emphasis
|
role="bold">try</emphasis>, and <emphasis
|
||||||
role="bold">safe-</emphasis>* command. Logging verbosity is
|
role="bold">safe-</emphasis>* command. Logging verbosity is
|
||||||
determined by the setting of LOG_VERBOSITY above.</para>
|
determined by the setting of LOG_VERBOSITY above. </para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2939,20 +2864,6 @@ INLINE - - - ;; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">VERBOSE_MESSAGES=</emphasis>[<emphasis
|
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.9. When Yes (the default), messages
|
|
||||||
produced by the ?INFO and ?WARNING directives include the filename
|
|
||||||
and linenumber of the directive. When set to No, that additional
|
|
||||||
information is omitted. The setting may be overridden on a directive
|
|
||||||
by directive basis by following ?INFO or ?WARNING with '!' (no
|
|
||||||
intervening white space).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
||||||
@@ -3013,23 +2924,6 @@ INLINE - - - ;; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ZERO_MARKS=</emphasis>[<emphasis
|
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.12, this is a workaround for an issue
|
|
||||||
where packet marks are not zeroed by the kernel. It should be set to
|
|
||||||
No (the default) unless you find that incoming packets are being
|
|
||||||
mis-routed for no apparent reasons.</para>
|
|
||||||
|
|
||||||
<caution>
|
|
||||||
<para>Do not set this option to Yes if you have IPSEC software
|
|
||||||
running on the firewall system.</para>
|
|
||||||
</caution>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>
|
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>
|
||||||
|
@@ -59,9 +59,7 @@
|
|||||||
|
|
||||||
<arg choice="plain"><option>blacklist</option></arg>
|
<arg choice="plain"><option>blacklist</option></arg>
|
||||||
|
|
||||||
<arg
|
<arg choice="plain"><replaceable>address</replaceable></arg>
|
||||||
choice="plain"><replaceable>address</replaceable><arg><replaceable>option</replaceable>
|
|
||||||
...</arg></arg>
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -451,9 +449,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><arg><replaceable>system</replaceable></arg></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -475,9 +473,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><arg><replaceable>system</replaceable></arg></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -499,9 +497,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><arg><replaceable>system</replaceable></arg></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -966,9 +964,7 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
role="bold">logreject</emphasis> command.</para>
|
||||||
5.0.10, this command can also re-enable addresses blacklisted using
|
|
||||||
the <command>blacklist</command> command.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -988,23 +984,6 @@
|
|||||||
<replaceable>address</replaceable> along with any
|
<replaceable>address</replaceable> along with any
|
||||||
<replaceable>option</replaceable>s are passed to the <command>ipset
|
<replaceable>option</replaceable>s are passed to the <command>ipset
|
||||||
add</command> command.</para>
|
add</command> command.</para>
|
||||||
|
|
||||||
<para>If the <option>disconnect</option> option is specified in the
|
|
||||||
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
|
|
||||||
determines the amount of information displayed:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 0, then a message
|
|
||||||
giving the number of conntrack flows deleted by the command is
|
|
||||||
displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 1, then the conntrack
|
|
||||||
table entries deleted by the command are also displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1631,8 +1610,8 @@
|
|||||||
<term><emphasis role="bold">remote-start</emphasis>
|
<term><emphasis role="bold">remote-start</emphasis>
|
||||||
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
|
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
|
||||||
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
|
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
|
||||||
[-<option>i</option>] [ [ -D ] <replaceable>directory</replaceable> ]
|
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
|
||||||
[ <replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was renamed from <command>load</command> in
|
<para>This command was renamed from <command>load</command> in
|
||||||
@@ -1658,13 +1637,7 @@
|
|||||||
directory. If compilation succeeds, then firewall is copied to
|
directory. If compilation succeeds, then firewall is copied to
|
||||||
<replaceable>system</replaceable> using scp. If the copy succeeds,
|
<replaceable>system</replaceable> using scp. If the copy succeeds,
|
||||||
Shorewall Lite on <replaceable>system</replaceable> is started via
|
Shorewall Lite on <replaceable>system</replaceable> is started via
|
||||||
ssh. Beginning with Shorewall 5.0.13, if
|
ssh.</para>
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
||||||
<emphasis role="bold">start</emphasis> command succeeds, then the
|
<emphasis role="bold">start</emphasis> command succeeds, then the
|
||||||
@@ -1699,9 +1672,9 @@
|
|||||||
<term><emphasis role="bold">remote-reload
|
<term><emphasis role="bold">remote-reload
|
||||||
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
||||||
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
||||||
[-<option>T</option>] [-<option>i</option>] [ [ -D ]
|
[-<option>T</option>] [-<option>i</option>] [
|
||||||
<replaceable>directory</replaceable> ] [
|
<replaceable>directory</replaceable> ]
|
||||||
<replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was added in Shorewall 5.0.0.</para>
|
<para>This command was added in Shorewall 5.0.0.</para>
|
||||||
@@ -1725,14 +1698,8 @@
|
|||||||
defaulted) directory is compiled to a file called firewall in that
|
defaulted) directory is compiled to a file called firewall in that
|
||||||
directory. If compilation succeeds, then firewall is copied to
|
directory. If compilation succeeds, then firewall is copied to
|
||||||
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
||||||
Shorewall Lite on <emphasis>system</emphasis> is restarted via ssh.
|
Shorewall Lite on <emphasis>system</emphasis> is restarted via
|
||||||
Beginning with Shorewall 5.0.13, if
|
ssh.</para>
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
||||||
<emphasis role="bold">restart</emphasis> command succeeds, then the
|
<emphasis role="bold">restart</emphasis> command succeeds, then the
|
||||||
@@ -1767,9 +1734,9 @@
|
|||||||
<term><emphasis role="bold">remote-restart
|
<term><emphasis role="bold">remote-restart
|
||||||
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
||||||
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
||||||
[-<option>T</option>] [-<option>i</option>] [ [ -D ]
|
[-<option>T</option>] [-<option>i</option>] [
|
||||||
<replaceable>directory</replaceable> ] [
|
<replaceable>directory</replaceable> ]
|
||||||
<replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was renamed from <command>reload</command> in
|
<para>This command was renamed from <command>reload</command> in
|
||||||
@@ -1794,14 +1761,8 @@
|
|||||||
defaulted) directory is compiled to a file called firewall in that
|
defaulted) directory is compiled to a file called firewall in that
|
||||||
directory. If compilation succeeds, then firewall is copied to
|
directory. If compilation succeeds, then firewall is copied to
|
||||||
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
||||||
Shorewall Lite on <emphasis>system</emphasis> is restarted via ssh.
|
Shorewall Lite on <emphasis>system</emphasis> is restarted via
|
||||||
Beginning with Shorewall 5.0.13, if
|
ssh.</para>
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
<para>If <emphasis role="bold">-s</emphasis> is specified and the
|
||||||
<emphasis role="bold">restart</emphasis> command succeeds, then the
|
<emphasis role="bold">restart</emphasis> command succeeds, then the
|
||||||
@@ -2602,10 +2563,8 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>With the exception of the
|
<para>INCLUDEd files will be expanded inline in the output
|
||||||
<filename>notrack</filename>-><filename>conntrack</filename>
|
file.</para>
|
||||||
conversion, INCLUDEd files will be expanded inline in the
|
|
||||||
output file.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -2613,26 +2572,6 @@
|
|||||||
tab character; there is no attempt made to otherwise align the
|
tab character; there is no attempt made to otherwise align the
|
||||||
columns.</para>
|
columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Prior to Shorewall 5.0.15, shell variables will be
|
|
||||||
expanded in the output file.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Prior to Shorewall 5.0.15, lines omitted by compiler
|
|
||||||
directives (?if ...., etc.) will not appear in the output
|
|
||||||
file.</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>Because the translation of the 'blacklist' and
|
|
||||||
'routestopped' files is not 1:1, omitted lines and compiler
|
|
||||||
directives are not transferred to the converted files. If
|
|
||||||
either are present, the compiler issues a warning: </para>
|
|
||||||
|
|
||||||
<programlisting> WARNING: "Omitted rules and compiler directives were not translated</programlisting>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
|
@@ -215,7 +215,7 @@ rm -rf ${SHAREDIR}/shorewall/configfiles/
|
|||||||
rm -rf ${SHAREDIR}/shorewall/Samples/
|
rm -rf ${SHAREDIR}/shorewall/Samples/
|
||||||
rm -rf ${SHAREDIR}/shorewall/Shorewall/
|
rm -rf ${SHAREDIR}/shorewall/Shorewall/
|
||||||
rm -f ${SHAREDIR}/shorewall/lib.cli-std
|
rm -f ${SHAREDIR}/shorewall/lib.cli-std
|
||||||
rm -f ${SHAREDIR}/shorewall/lib.runtime
|
rm -f ${SHAREDIR}/shorewall/lib.core
|
||||||
rm -f ${SHAREDIR}/shorewall/compiler.pl
|
rm -f ${SHAREDIR}/shorewall/compiler.pl
|
||||||
rm -f ${SHAREDIR}/shorewall/prog.*
|
rm -f ${SHAREDIR}/shorewall/prog.*
|
||||||
rm -f ${SHAREDIR}/shorewall/module*
|
rm -f ${SHAREDIR}/shorewall/module*
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall6-lite
|
# /etc/shorewall6-lite
|
||||||
@@ -92,11 +92,10 @@ shorewall6_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall6_stop () {
|
shorewall6_stop () {
|
||||||
|
echo -n "Stopping \"Shorewall6 Lite firewall\": "
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
echo -n "Stopping \"Shorewall6 Lite firewall\": "
|
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
echo -n "Clearing all \"Shorewall6 Lite firewall\" rules: "
|
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -679,9 +679,7 @@
|
|||||||
<para>Re-enables receipt of packets from hosts previously
|
<para>Re-enables receipt of packets from hosts previously
|
||||||
blacklisted by a <command>drop</command>,
|
blacklisted by a <command>drop</command>,
|
||||||
<command>logdrop</command>, <command>reject</command>, or
|
<command>logdrop</command>, <command>reject</command>, or
|
||||||
<command>logreject</command> command. Beginning with Shorewall
|
<command>logreject</command> command.</para>
|
||||||
5.0.10, this command can also re-enable addresses blacklisted using
|
|
||||||
the <command>blacklist</command> command.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -701,23 +699,6 @@
|
|||||||
The <replaceable>address</replaceable> along with any
|
The <replaceable>address</replaceable> along with any
|
||||||
<replaceable>option</replaceable>s are passed to the <command>ipset
|
<replaceable>option</replaceable>s are passed to the <command>ipset
|
||||||
add</command> command.</para>
|
add</command> command.</para>
|
||||||
|
|
||||||
<para>If the <option>disconnect</option> option is specified in the
|
|
||||||
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
|
|
||||||
determines the amount of information displayed:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 0, then a message
|
|
||||||
giving the number of conntrack flows deleted by the command is
|
|
||||||
displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 1, then the conntrack
|
|
||||||
table entries deleted by the command are also displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall6 -- /usr/share/shorewall6/macro.mDNSbi
|
|
||||||
#
|
|
||||||
# This macro handles bidirectional multicast DNS traffic.
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
|
|
||||||
PARAM - [ff02::fb] udp 5353
|
|
||||||
PARAM - - udp 1024: 5353
|
|
||||||
PARAM - [ff02::fb] 2
|
|
||||||
PARAM DEST SOURCE:[ff02::fb] udp 5353
|
|
||||||
PARAM DEST SOURCE udp 1024: 5353
|
|
||||||
PARAM DEST SOURCE:[ff02::fb] 2
|
|
@@ -24,12 +24,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -127,13 +121,15 @@ ACCOUNTING_TABLE=filter
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -163,8 +159,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -219,14 +213,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -25,12 +25,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -128,13 +122,15 @@ ACCOUNTING_TABLE=filter
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -164,8 +160,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -220,14 +214,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -24,12 +24,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -127,13 +121,15 @@ ACCOUNTING_TABLE=filter
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -163,8 +159,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -219,14 +213,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -24,12 +24,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -127,13 +121,15 @@ ACCOUNTING_TABLE=filter
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=Yes
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
@@ -163,8 +159,6 @@ FORWARD_CLEAR_MARK=
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
INLINE_MATCHES=Yes
|
||||||
@@ -219,14 +213,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -24,12 +24,6 @@ VERBOSITY=1
|
|||||||
|
|
||||||
PAGER=
|
PAGER=
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# F I R E W A L L
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
FIREWALL=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# L O G G I N G
|
# L O G G I N G
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -127,14 +121,16 @@ ACCOUNTING_TABLE=filter
|
|||||||
|
|
||||||
ADMINISABSENTMINDED=Yes
|
ADMINISABSENTMINDED=Yes
|
||||||
|
|
||||||
|
BASIC_FILTERS=No
|
||||||
|
|
||||||
|
IGNOREUNKNOWNVARIABLES=No
|
||||||
|
|
||||||
AUTOCOMMENT=Yes
|
AUTOCOMMENT=Yes
|
||||||
|
|
||||||
AUTOHELPERS=Yes
|
AUTOHELPERS=Yes
|
||||||
|
|
||||||
AUTOMAKE=No
|
AUTOMAKE=No
|
||||||
|
|
||||||
BASIC_FILTERS=No
|
|
||||||
|
|
||||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||||
|
|
||||||
CHAIN_SCRIPTS=Yes
|
CHAIN_SCRIPTS=Yes
|
||||||
@@ -163,8 +159,6 @@ FORWARD_CLEAR_MARK=Yes
|
|||||||
|
|
||||||
HELPERS=
|
HELPERS=
|
||||||
|
|
||||||
IGNOREUNKNOWNVARIABLES=No
|
|
||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=No
|
INLINE_MATCHES=No
|
||||||
@@ -219,14 +213,10 @@ USE_PHYSICAL_NAMES=No
|
|||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
|
||||||
VERBOSE_MESSAGES=Yes
|
|
||||||
|
|
||||||
WARNOLDCAPVERSION=Yes
|
WARNOLDCAPVERSION=Yes
|
||||||
|
|
||||||
WORKAROUNDS=No
|
WORKAROUNDS=No
|
||||||
|
|
||||||
ZERO_MARKS=No
|
|
||||||
|
|
||||||
ZONE2ZONE=-
|
ZONE2ZONE=-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall6 -- /etc/shorewall6/snat
|
|
||||||
#
|
|
||||||
# For information about entries in this file, type "man shorewall6-snat"
|
|
||||||
#
|
|
||||||
# See http://shorewall.net/manpages6/shorewall6-snat.html for more information
|
|
||||||
#
|
|
||||||
###########################################################################################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
@@ -4,7 +4,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall6
|
# /etc/shorewall6
|
||||||
@@ -97,11 +97,10 @@ shorewall6_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall6_stop () {
|
shorewall6_stop () {
|
||||||
|
echo -n "Stopping \"Shorewall6 firewall\": "
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
echo -n "Stopping \"Shorewall6 firewall\": "
|
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
echo -n "Clearing all \"Shorewall6 firewall\" rules: "
|
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -83,7 +83,7 @@ case "$command" in
|
|||||||
exec ${SBINDIR}/shorewall6 $OPTIONS restart $RESTARTOPTIONS
|
exec ${SBINDIR}/shorewall6 $OPTIONS restart $RESTARTOPTIONS
|
||||||
;;
|
;;
|
||||||
status|stop)
|
status|stop)
|
||||||
exec ${SBINDIR}/shorewall6 $OPTIONS $command $@
|
exec ${SBINDIR}/shorewall6 $OPTIONS $command
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
|
@@ -131,18 +131,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>logjump</option></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.8. Performs the same function as
|
|
||||||
<option>nolog</option> (below), with the addition that the
|
|
||||||
jump to the actions chain is logged if a log level is
|
|
||||||
specified on the action invocation. For inline actions, this
|
|
||||||
option is identical to <option>nolog</option>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>mangle</option></term>
|
<term><option>mangle</option></term>
|
||||||
|
|
||||||
@@ -155,20 +143,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>nat</option></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.13. Specifies that this action is
|
|
||||||
to be used in <ulink
|
|
||||||
url="shorewall6-snat.html">shorewall6-snat(5)</ulink> rather
|
|
||||||
than <ulink
|
|
||||||
url="shorewall6-rules.html">shorewall6-rules(5)</ulink>. The
|
|
||||||
<option>mangle</option> and <option>nat</option> options are
|
|
||||||
mutually exclusive.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>noinline</option></term>
|
<term><option>noinline</option></term>
|
||||||
|
|
||||||
|
@@ -237,66 +237,6 @@ loc eth2 -</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">dbl={none|src|dst|src-dst}</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.10. This option defined whether
|
|
||||||
or not dynamic blacklisting is applied to packets entering the
|
|
||||||
firewall through this interface and whether the source address
|
|
||||||
and/or destination address is to be compared against the
|
|
||||||
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
|
|
||||||
<ulink
|
|
||||||
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>).
|
|
||||||
The default is determine by the setting of
|
|
||||||
DYNAMIC_BLACKLIST:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=No</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis role="bold">none</emphasis>
|
|
||||||
(e.g., no dynamic blacklist checking).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=Yes</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis role="bold">src</emphasis>
|
|
||||||
(e.g., the source IP address is checked against the
|
|
||||||
ipset).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=ipset[-only]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis
|
|
||||||
role="bold">src</emphasis>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>DYNAMIC_BLACKLIST=ipset[-only],src-dst...</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Default is <emphasis
|
|
||||||
role="bold">src-dst</emphasis> (e.g., the source IP
|
|
||||||
addresses in checked against the ipset on input and the
|
|
||||||
destination IP address is checked against the ipset on
|
|
||||||
packets originating from the firewall and leaving
|
|
||||||
through this interface).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">destonly</emphasis></term>
|
<term><emphasis role="bold">destonly</emphasis></term>
|
||||||
|
|
||||||
@@ -381,7 +321,7 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">loopback</emphasis></term>
|
<term>loopback</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.6.6. Designates the interface as
|
<para>Added in Shorewall 4.6.6. Designates the interface as
|
||||||
@@ -430,10 +370,7 @@ loc eth2 -</programlisting>
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
||||||
blacklisting is disabled on the interface. Beginning with
|
blacklisting is disabled on the interface.</para>
|
||||||
Shorewall 5.0.10, <emphasis role="bold">nodbl</emphasis> is
|
|
||||||
equivalent to <emphasis
|
|
||||||
role="bold">dbl=none</emphasis>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@
|
|||||||
<replaceable>action</replaceable> must be an action declared
|
<replaceable>action</replaceable> must be an action declared
|
||||||
with the <option>mangle</option> option in <ulink
|
with the <option>mangle</option> option in <ulink
|
||||||
url="manpages6/shorewall6-actions.html">shorewall6-actions(5)</ulink>.
|
url="manpages6/shorewall6-actions.html">shorewall6-actions(5)</ulink>.
|
||||||
If the action accepts parameters, they are specified as a
|
If the action accepts paramaters, they are specified as a
|
||||||
comma-separated list within parentheses following the
|
comma-separated list within parentheses following the
|
||||||
<replaceable>action</replaceable> name.</para>
|
<replaceable>action</replaceable> name.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -356,8 +356,7 @@ DIVERTHA - - tcp</programlisting>
|
|||||||
EF => 0x2e</programlisting>
|
EF => 0x2e</programlisting>
|
||||||
|
|
||||||
<para>To indicate more than one class, add their hex values
|
<para>To indicate more than one class, add their hex values
|
||||||
together and specify the result. By default, DSCP rules are
|
together and specify the result.</para>
|
||||||
placed in the POSTROUTING chain.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -610,36 +609,6 @@ INLINE eth0 - ; -p tcp -j MARK --set
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">NFLOG</emphasis>[(<emphasis>nflog-parameters</emphasis>)]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.9. Logs matching packets using
|
|
||||||
NFLOG. The <replaceable>nflog-parameters</replaceable> are a
|
|
||||||
comma-separated list of up to 3 numbers:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>The first number specifies the netlink group
|
|
||||||
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
|
|
||||||
0 is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The second number specifies the maximum number of
|
|
||||||
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The third number specifies the number of log
|
|
||||||
messages that should be buffered in the kernel before they
|
|
||||||
are sent to user space. The default is 1.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">RESTORE</emphasis>[(<emphasis>mask</emphasis>)]</term>
|
role="bold">RESTORE</emphasis>[(<emphasis>mask</emphasis>)]</term>
|
||||||
@@ -1331,17 +1300,6 @@ Normal-Service => 0x00</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>contiguous</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shoreawll 5.0.12. When <emphasis
|
|
||||||
role="bold">timestop</emphasis> is smaller than <emphasis
|
|
||||||
role="bold">timestart</emphasis> value, match this as a single
|
|
||||||
time period instead of distinct intervals.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>utc</term>
|
<term>utc</term>
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">ADDRESS</emphasis> (Optional) - [<emphasis
|
<term><emphasis role="bold">ADDRESS</emphasis> (Optional) - [<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis
|
role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">NONAT</emphasis>|[<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
|
role="bold">NONAT</emphasis>|[<emphasis>address-or-address-range</emphasis>[,<emphasis>address-or-address-range</emphasis>]...][:<emphasis>lowport</emphasis><emphasis
|
||||||
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
||||||
role="bold">:random</emphasis>][:persistent]|<emphasis
|
role="bold">:random</emphasis>][:persistent]|<emphasis
|
||||||
role="bold">detect</emphasis>|<emphasis
|
role="bold">detect</emphasis>|<emphasis
|
||||||
@@ -551,8 +551,8 @@
|
|||||||
<programlisting>/etc/shorewall/masq:
|
<programlisting>/etc/shorewall/masq:
|
||||||
|
|
||||||
#INTERFACE SOURCE ADDRESS
|
#INTERFACE SOURCE ADDRESS
|
||||||
INLINE(sit1) ::/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
|
INLINE(sit1) 0.0.0.0/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
|
||||||
sit1 ::/0 2001:470:a:227::2
|
sit1 0.0.0.0/0 2001:470:a:227::2
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>If INLINE_MATCHES=Yes in <ulink
|
<para>If INLINE_MATCHES=Yes in <ulink
|
||||||
@@ -562,8 +562,9 @@
|
|||||||
<programlisting>/etc/shorewall/masq:
|
<programlisting>/etc/shorewall/masq:
|
||||||
|
|
||||||
#INTERFACE SOURCE ADDRESS
|
#INTERFACE SOURCE ADDRESS
|
||||||
sit1 ::/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
|
sit1 0.0.0.0/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
|
||||||
sit1 ::/0 2001:470:a:227::2</programlisting>
|
sit1 0.0.0.0/0 2001:470:a:227::2
|
||||||
|
</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
<para>This file determines what to do with a new connection request if
|
<para>This file determines what to do with a new connection request if
|
||||||
we don't get a match from the /etc/shorewall6/rules file . For each
|
we don't get a match from the /etc/shorewall6/rules file . For each
|
||||||
source/destination pair, the file is processed in order until a match is
|
source/destination pair, the file is processed in order until a match is
|
||||||
found ("all" will match any source or destination).</para>
|
found ("all" will match any client or server).</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<important>
|
<important>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> -
|
<term><emphasis role="bold">SOURCE</emphasis> -
|
||||||
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
<emphasis>zone</emphasis>|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -74,18 +74,12 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
|
||||||
separated by commas. As above, if '+' is specified after two or more
|
|
||||||
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
|
||||||
policy if the same <replaceable>zone</replaceable> appears in both
|
|
||||||
the SOURCE and DEST columns.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DEST</emphasis> -
|
<term><emphasis role="bold">DEST</emphasis> -
|
||||||
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
<emphasis>zone</emphasis>|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -101,12 +95,6 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
|
||||||
separated by commas. As above, if '+' is specified after two or more
|
|
||||||
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
|
||||||
policy if the same <replaceable>zone</replaceable> appears in both
|
|
||||||
the SOURCE and DEST columns.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -159,40 +159,26 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis role="bold">balance</emphasis></term>
|
||||||
role="bold">balance[=<replaceable>weight</replaceable>]</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.25. The providers that have
|
<para>Added in Shorewall 4.4.25. Causes a default route to
|
||||||
<option>balance</option> specified will get outbound traffic
|
this provider's gateway to be added to the <emphasis
|
||||||
load-balanced among them. By default, all interfaces with
|
role="bold">main</emphasis> routing table (USE_DEFAULT_RT=No)
|
||||||
<option>balance</option> specified will have the same weight
|
or to the <emphasis role="bold">balance</emphasis> routing
|
||||||
(1). Beginning with Shorewall 5.0.13, you can change the
|
table (USE_DEFAULT_RT=Yes). Only one provider can specify this
|
||||||
weight of an interface by specifying
|
option.</para>
|
||||||
<option>balance=</option><replaceable>weight</replaceable>
|
|
||||||
where <replaceable>weight</replaceable> is the weight of the
|
|
||||||
route out of this interface. Prior to Shorewall 5.0.13, only
|
|
||||||
one provider can specify this option.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis role="bold">fallback</emphasis></term>
|
||||||
role="bold">fallback[=<replaceable>weight</replaceable>]</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.25. Indicates that a default
|
<para>Added in Shorewall 4.4.25. Causes a default route to
|
||||||
route through the provider should be added to the default
|
this provider's gateway to be added to the <emphasis
|
||||||
routing table (table 253). If a
|
role="bold">default</emphasis> routing table.At most one
|
||||||
<replaceable>weight</replaceable> is given, a balanced route
|
provider can specify this option.</para>
|
||||||
is added with the weight of this provider equal to the
|
|
||||||
specified <replaceable>weight</replaceable>. If the option is
|
|
||||||
given without a <replaceable>weight</replaceable>, an separate
|
|
||||||
default route is added through the provider's gateway; the
|
|
||||||
route has a metric equal to the provider's NUMBER. Prior to
|
|
||||||
Shorewall 5.0.13, at most one provider can specify this option
|
|
||||||
and a <replaceable>weight</replaceable> may not be
|
|
||||||
given.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -391,16 +377,6 @@
|
|||||||
are present.</para>
|
are present.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>The generated script will attempt to reenable a
|
|
||||||
disabled persistent provider during execution of the
|
|
||||||
<command>start</command>, <command>restart</command> and
|
|
||||||
<command>reload</command> commands. When
|
|
||||||
<option>persistent</option> is not specified, only the
|
|
||||||
<command>enable</command> and <command>reenable</command>
|
|
||||||
commands can reenable the provider.</para>
|
|
||||||
</note>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@@ -574,29 +574,7 @@
|
|||||||
the next rule. See <ulink
|
the next rule. See <ulink
|
||||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
||||||
|
|
||||||
<para>The <replaceable>nflog-parameters</replaceable> are a
|
<para>Similar to<emphasis role="bold">
|
||||||
comma-separated list of up to 3 numbers:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>The first number specifies the netlink group
|
|
||||||
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
|
|
||||||
0 is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The second number specifies the maximum number of
|
|
||||||
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The third number specifies the number of log
|
|
||||||
messages that should be buffered in the kernel before they
|
|
||||||
are sent to user space. The default is 1.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
|
|
||||||
<para>NFLOG is similar to<emphasis role="bold">
|
|
||||||
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
|
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
|
||||||
except that the log level is not changed when this ACTION is
|
except that the log level is not changed when this ACTION is
|
||||||
used in an action or macro and the invocation of that action
|
used in an action or macro and the invocation of that action
|
||||||
@@ -630,7 +608,7 @@
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold"><emphasis
|
<term><emphasis role="bold"><emphasis
|
||||||
role="bold">NFQUEUE!</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
|
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>like NFQUEUE but exempts the rule from being suppressed
|
<para>like NFQUEUE but exempts the rule from being suppressed
|
||||||
@@ -1547,17 +1525,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>contiguous</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shoreawll 5.0.12. When <emphasis
|
|
||||||
role="bold">timestop</emphasis> is smaller than <emphasis
|
|
||||||
role="bold">timestart</emphasis> value, match this as a single
|
|
||||||
time period instead of distinct intervals.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>utc</term>
|
<term>utc</term>
|
||||||
|
|
||||||
@@ -1669,7 +1636,7 @@
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">route</emphasis>, <emphasis
|
<term><emphasis role="bold">route</emphasis>, <emphasis
|
||||||
role="bold">ipv6-route</emphasis> or <emphasis
|
role="bold">ipv6-route</emphasis> or <emphasis
|
||||||
role="bold">43</emphasis></term>
|
role="bold">41</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>IPv6 Route extension header.</para>
|
<para>IPv6 Route extension header.</para>
|
||||||
|
@@ -1,615 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
|
||||||
<refentry>
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>shorewall6-masq</refentrytitle>
|
|
||||||
|
|
||||||
<manvolnum>5</manvolnum>
|
|
||||||
|
|
||||||
<refmiscinfo>Configuration Files</refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>snat</refname>
|
|
||||||
|
|
||||||
<refpurpose>Shorewall6 SNAT/Masquerade definition file</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>/etc/shorewall6/snat</command>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Description</title>
|
|
||||||
|
|
||||||
<para>This file is used to define dynamic NAT (Masquerading) and to define
|
|
||||||
Source NAT (SNAT). While still supported, its use is deprecated in favor
|
|
||||||
of <ulink url="shorewall6-snat.html">shorewall6-snat</ulink>(5) which was
|
|
||||||
introduced in Shorewall 5.0.14.</para>
|
|
||||||
|
|
||||||
<warning>
|
|
||||||
<para>The entries in this file are order-sensitive. The first entry that
|
|
||||||
matches a particular connection will be the one that is used.</para>
|
|
||||||
</warning>
|
|
||||||
|
|
||||||
<warning>
|
|
||||||
<para>If you have more than one ISP link, adding entries to this file
|
|
||||||
will <emphasis role="bold">not</emphasis> force connections to go out
|
|
||||||
through a particular link. You must use entries in <ulink
|
|
||||||
url="/manpages6/shorewall6-rtrules.html">shorewall6-rtrules</ulink>(5)
|
|
||||||
or PREROUTING entries in <ulink
|
|
||||||
url="/manpages6/shorewall6-tcrules.html">shorewall-tcrules</ulink>(5) to
|
|
||||||
do that.</para>
|
|
||||||
</warning>
|
|
||||||
|
|
||||||
<para>The columns in the file are as follows.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ACTION</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the type of rule to generate. Choices are:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">MASQUERADE</emphasis>[+][([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Causes matching outgoing packages to have their source
|
|
||||||
IP address set to the primary IP address of the interface
|
|
||||||
specified in the DEST column. if
|
|
||||||
<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>
|
|
||||||
is given, that port range will be used to assign a source
|
|
||||||
port. If option <option>random</option> is used then port
|
|
||||||
mapping will be randomized. MASQUERADE should only be used
|
|
||||||
when the DEST interface has a dynamic IP address. Otherwise,
|
|
||||||
SNAT should be used and should specify the interface's static
|
|
||||||
address.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">SNAT</emphasis>[+]([<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
|
|
||||||
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
|
||||||
role="bold">:random</emphasis>][:<option>persistent</option>]|<emphasis
|
|
||||||
role="bold">detect</emphasis>|</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you specify an address here, matching packets will
|
|
||||||
have their source address set to that address. If
|
|
||||||
ADD_SNAT_ALIASES is set to Yes or yes in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf</ulink>(5) then
|
|
||||||
Shorewall will automatically add this address to the INTERFACE
|
|
||||||
named in the first column.</para>
|
|
||||||
|
|
||||||
<para>You may also specify a range of up to 256 IP addresses
|
|
||||||
if you want the SNAT address to be assigned from that range in
|
|
||||||
a round-robin fashion by connection. The range is specified by
|
|
||||||
<emphasis>first.ip.in.range</emphasis>-<emphasis>last.ip.in.range</emphasis>.
|
|
||||||
You may follow the port range with<emphasis role="bold">
|
|
||||||
:random</emphasis> in which case assignment of ports from the
|
|
||||||
list will be random. <emphasis role="bold">random</emphasis>
|
|
||||||
may also be specified by itself in this column in which case
|
|
||||||
random local port assignments are made for the outgoing
|
|
||||||
connections.</para>
|
|
||||||
|
|
||||||
<para>Example: 206.124.146.177-206.124.146.180</para>
|
|
||||||
|
|
||||||
<para>You may follow the port range (or <emphasis
|
|
||||||
role="bold">:random</emphasis>) with <emphasis
|
|
||||||
role="bold">:persistent</emphasis>. This is only useful when
|
|
||||||
an address range is specified and causes a client to be given
|
|
||||||
the same source/destination IP pair. This feature replaces the
|
|
||||||
SAME modifier which was removed from Shorewall in version
|
|
||||||
4.4.0.</para>
|
|
||||||
|
|
||||||
<para>You may also use the special value
|
|
||||||
<option>detect</option> which causes Shorewall to determine
|
|
||||||
the IP addresses configured on the interface named in the DEST
|
|
||||||
column and substitute them in this column.</para>
|
|
||||||
|
|
||||||
<para>Finally, you may also specify a comma-separated list of
|
|
||||||
ranges and/or addresses in this column.</para>
|
|
||||||
|
|
||||||
<para>DNS Names names are not allowed.</para>
|
|
||||||
|
|
||||||
<para>Normally, Netfilter will attempt to retain the source
|
|
||||||
port number. You may cause netfilter to remap the source port
|
|
||||||
by following an address or range (if any) by ":" and a port
|
|
||||||
range with the format
|
|
||||||
<emphasis>lowport</emphasis>-<emphasis>highport</emphasis>. If
|
|
||||||
this is done, you must specify "tcp", "udp", "dccp" or "stcp"
|
|
||||||
in the PROTO column.</para>
|
|
||||||
|
|
||||||
<para>Example:</para>
|
|
||||||
|
|
||||||
<programlisting> [2001:470:a:787::2]:5000-6000</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>CONTINUE[+]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Causes matching packets to be exempted from any
|
|
||||||
following rules in the file.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <replaceable>action</replaceable> is an action
|
|
||||||
declared in <ulink
|
|
||||||
url="shorewall6-actions.html">shorewall6-actions(5)</ulink>
|
|
||||||
with the <option>nat</option> option. See <ulink
|
|
||||||
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
|
|
||||||
further information.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>Normally Masq/SNAT rules are evaluated after those for
|
|
||||||
one-to-one NAT (defined in <ulink
|
|
||||||
url="/manpages6/shorewall6-nat.html">shorewall6-nat</ulink>(5)). If
|
|
||||||
you want the rule to be applied before one-to-one NAT rules, follow
|
|
||||||
the action name with "+": This feature should only be required if
|
|
||||||
you need to insert rules in this file that preempt entries in <ulink
|
|
||||||
url="/manpages6/shorewall6-nat.html">shorewall6-nat</ulink>(5).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> (Optional) -
|
|
||||||
[<emphasis>interface</emphasis>|<emphasis>address</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>address</emphasis>...][<emphasis>exclusion</emphasis>]]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Set of hosts that you wish to SNAT; one or more host or
|
|
||||||
network addresses separated by comma. You may use ipset names
|
|
||||||
preceded by a plus sign (+) to specify a set of hosts.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">DEST</emphasis> -
|
|
||||||
{<emphasis>interface</emphasis>|[<emphasis
|
|
||||||
role="bold">:</emphasis>[<emphasis>dest-address</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>dest-address</emphasis>]...[<emphasis>exclusion</emphasis>]]|?COMMENT}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Outgoing <emphasis>interface</emphasis>. This is usually your
|
|
||||||
internet interface.</para>
|
|
||||||
|
|
||||||
<para>The <replaceable>interface</replaceable> must match an entry
|
|
||||||
in <ulink
|
|
||||||
url="/manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>(5).
|
|
||||||
Shorewall allows loose matches to wildcard entries in <ulink
|
|
||||||
url="/manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>(5).
|
|
||||||
For example, <filename class="devicefile">ppp0</filename> in this
|
|
||||||
file will match a <ulink
|
|
||||||
url="/manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>(5)
|
|
||||||
entry that defines <filename
|
|
||||||
class="devicefile">ppp+</filename>.</para>
|
|
||||||
|
|
||||||
<para>Where <ulink url="/4.4/MultiISP.html#Shared">more that one
|
|
||||||
internet provider share a single interface</ulink>, the provider is
|
|
||||||
specified by including the provider name or number in
|
|
||||||
parentheses:</para>
|
|
||||||
|
|
||||||
<programlisting> eth0(Avvanta)</programlisting>
|
|
||||||
|
|
||||||
<para>In that case, you will want to specify the interface's address
|
|
||||||
for that provider as the SNAT parameter.</para>
|
|
||||||
|
|
||||||
<para>The interface may be qualified by adding the character ":"
|
|
||||||
followed by a comma-separated list of destination host or subnet
|
|
||||||
addresses to indicate that you only want to change the source IP
|
|
||||||
address for packets being sent to those particular destinations.
|
|
||||||
Exclusion is allowed (see <ulink
|
|
||||||
url="/manpages6/shorewall6-exclusion.html">shorewall6-exclusion</ulink>(5))
|
|
||||||
as are ipset names preceded by a plus sign '+'.</para>
|
|
||||||
|
|
||||||
<para>Comments may be attached to Netfilter rules generated from
|
|
||||||
entries in this file through the use of ?COMMENT lines. These lines
|
|
||||||
begin with ?COMMENT; the remainder of the line is treated as a
|
|
||||||
comment which is attached to subsequent rules until another ?COMMENT
|
|
||||||
line is found or until the end of the file is reached. To stop
|
|
||||||
adding comments to rules, use a line containing only
|
|
||||||
?COMMENT.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">PROTO</emphasis> (Optional) - {<emphasis
|
|
||||||
role="bold">-</emphasis>|[!]{<emphasis>protocol-name</emphasis>|<emphasis>protocol-number</emphasis>}[,...]|+<replaceable>ipset</replaceable>}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you wish to restrict this entry to a particular protocol
|
|
||||||
then enter the protocol name (from protocols(5)) or number
|
|
||||||
here.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.12, this column can accept a
|
|
||||||
comma-separated list of protocols.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.6.0, an
|
|
||||||
<replaceable>ipset</replaceable> name can be specified in this
|
|
||||||
column. This is intended to be used with
|
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">DPORT</emphasis> (Optional) -
|
|
||||||
{-|[!]<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the PROTO column specifies TCP (6), UDP (17), DCCP (33),
|
|
||||||
SCTP (132) or UDPLITE (136) then you may list one or more port
|
|
||||||
numbers (or names from services(5)) or port ranges separated by
|
|
||||||
commas.</para>
|
|
||||||
|
|
||||||
<para>Port ranges are of the form
|
|
||||||
<emphasis>lowport</emphasis>:<emphasis>highport</emphasis>.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.6.0, an
|
|
||||||
<replaceable>ipset</replaceable> name can be specified in this
|
|
||||||
column. This is intended to be used with
|
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">IPSEC</emphasis> (Optional) -
|
|
||||||
[<emphasis>option</emphasis>[<emphasis
|
|
||||||
role="bold">,</emphasis><emphasis>option</emphasis>]...]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If you specify a value other than "-" in this column, you must
|
|
||||||
be running kernel 2.6 and your kernel and iptables must include
|
|
||||||
policy match support.</para>
|
|
||||||
|
|
||||||
<para>Comma-separated list of options from the following. Only
|
|
||||||
packets that will be encrypted via an SA that matches these options
|
|
||||||
will have their source address changed.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">reqid=</emphasis><emphasis>number</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <emphasis>number</emphasis> is specified using
|
|
||||||
setkey(8) using the 'unique:<emphasis>number</emphasis> option
|
|
||||||
for the SPD level.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">spi=</emphasis><number></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <emphasis>number</emphasis> is the SPI of the SA
|
|
||||||
used to encrypt/decrypt packets.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">proto=</emphasis><emphasis
|
|
||||||
role="bold">ah</emphasis>|<emphasis
|
|
||||||
role="bold">esp</emphasis>|<emphasis
|
|
||||||
role="bold">ipcomp</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>IPSEC Encapsulation Protocol</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">mss=</emphasis><emphasis>number</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>sets the MSS field in TCP packets</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">mode=</emphasis><emphasis
|
|
||||||
role="bold">transport</emphasis>|<emphasis
|
|
||||||
role="bold">tunnel</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>IPSEC mode</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">tunnel-src=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>only available with mode=tunnel</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">tunnel-dst=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>only available with mode=tunnel</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">strict</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Means that packets must match all rules.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">next</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Separates rules; can only be used with strict</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">yes</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>When used by itself, causes all traffic that will be
|
|
||||||
encrypted/encapsulated to match the rule.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">MARK</emphasis> - [<emphasis
|
|
||||||
role="bold">!</emphasis>]<emphasis>value</emphasis>[/<emphasis>mask</emphasis>][<emphasis
|
|
||||||
role="bold">:C</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines a test on the existing packet or connection mark. The
|
|
||||||
rule will match only if the test returns true.</para>
|
|
||||||
|
|
||||||
<para>If you don't want to define a test but need to specify
|
|
||||||
anything in the following columns, place a "-" in this field.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>!</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Inverts the test (not equal)</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis>value</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Value of the packet or connection mark.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis>mask</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>A mask to be applied to the mark before testing.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">:C</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Designates a connection mark. If omitted, the packet
|
|
||||||
mark's value is tested.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">USER</emphasis> (Optional) - [<emphasis
|
|
||||||
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
|
||||||
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
|
||||||
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Only locally-generated connections will match if this column
|
|
||||||
is non-empty.</para>
|
|
||||||
|
|
||||||
<para>When this column is non-empty, the rule matches only if the
|
|
||||||
program generating the output is running under the effective
|
|
||||||
<emphasis>user</emphasis> and/or <emphasis>group</emphasis>
|
|
||||||
specified (or is NOT running under that id if "!" is given).</para>
|
|
||||||
|
|
||||||
<para>Examples:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>joe</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must be run by joe</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>:kids</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must be run by a member of the 'kids'
|
|
||||||
group</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>!:kids</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>program must not be run by a member of the 'kids'
|
|
||||||
group</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>+upnpd</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>#program named upnpd</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>The ability to specify a program name was removed from
|
|
||||||
Netfilter in kernel version 2.6.14.</para>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">SWITCH -
|
|
||||||
[!]<replaceable>switch-name</replaceable>[={0|1}]</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 4.5.1 and allows enabling and disabling the
|
|
||||||
rule without requiring <command>shorewall restart</command>.</para>
|
|
||||||
|
|
||||||
<para>The rule is enabled if the value stored in
|
|
||||||
<filename>/proc/net/nf_condition/<replaceable>switch-name</replaceable></filename>
|
|
||||||
is 1. The rule is disabled if that file contains 0 (the default). If
|
|
||||||
'!' is supplied, the test is inverted such that the rule is enabled
|
|
||||||
if the file contains 0.</para>
|
|
||||||
|
|
||||||
<para>Within the <replaceable>switch-name</replaceable>, '@0' and
|
|
||||||
'@{0}' are replaced by the name of the chain to which the rule is a
|
|
||||||
added. The <replaceable>switch-name</replaceable> (after '@...'
|
|
||||||
expansion) must begin with a letter and be composed of letters,
|
|
||||||
decimal digits, underscores or hyphens. Switch names must be 30
|
|
||||||
characters or less in length.</para>
|
|
||||||
|
|
||||||
<para>Switches are normally <emphasis role="bold">off</emphasis>. To
|
|
||||||
turn a switch <emphasis role="bold">on</emphasis>:</para>
|
|
||||||
|
|
||||||
<simplelist>
|
|
||||||
<member><command>echo 1 >
|
|
||||||
/proc/net/nf_condition/<replaceable>switch-name</replaceable></command></member>
|
|
||||||
</simplelist>
|
|
||||||
|
|
||||||
<para>To turn it <emphasis role="bold">off</emphasis> again:</para>
|
|
||||||
|
|
||||||
<simplelist>
|
|
||||||
<member><command>echo 0 >
|
|
||||||
/proc/net/nf_condition/<replaceable>switch-name</replaceable></command></member>
|
|
||||||
</simplelist>
|
|
||||||
|
|
||||||
<para>Switch settings are retained over <command>shorewall
|
|
||||||
restart</command>.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.10, when the
|
|
||||||
<replaceable>switch-name</replaceable> is followed by
|
|
||||||
<option>=0</option> or <option>=1</option>, then the switch is
|
|
||||||
initialized to off or on respectively by the
|
|
||||||
<command>start</command> command. Other commands do not affect the
|
|
||||||
switch setting.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
|
|
||||||
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>(Optional) This column may be included and may contain one or
|
|
||||||
more addresses (host or network) separated by commas. Address ranges
|
|
||||||
are not allowed. When this column is supplied, rules are generated
|
|
||||||
that require that the original destination address matches one of
|
|
||||||
the listed addresses. It is useful for specifying that SNAT should
|
|
||||||
occur only for connections that were acted on by a DNAT when they
|
|
||||||
entered the firewall.</para>
|
|
||||||
|
|
||||||
<para>This column was formerly labelled ORIGINAL DEST.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">PROBABILITY</emphasis> -
|
|
||||||
[<replaceable>probability</replaceable>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.0. When non-empty, requires the
|
|
||||||
<firstterm>Statistics Match</firstterm> capability in your kernel
|
|
||||||
and ip6tables and causes the rule to match randomly but with the
|
|
||||||
given <replaceable>probability</replaceable>. The
|
|
||||||
<replaceable>probability</replaceable> is a number 0 <
|
|
||||||
<replaceable>probability</replaceable> <= 1 and may be expressed
|
|
||||||
at up to 8 decimal points of precision.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Examples</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 1:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>You have a simple 'masquerading' setup where eth0 connects to
|
|
||||||
a DSL or cable modem and eth1 connects to your local network with
|
|
||||||
subnet 2001:470:b:787::0/64</para>
|
|
||||||
|
|
||||||
<para>Your entry in the file will be:</para>
|
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST
|
|
||||||
MASQUERADE 2001:470:b:787::0/64 eth0</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Example 2:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Your sit1 interface has two public IP addresses:
|
|
||||||
2001:470:a:227::1 and 2001:470:b:227::1. You want to use the
|
|
||||||
iptables statistics match to masquerade outgoing connections evenly
|
|
||||||
between these two addresses.</para>
|
|
||||||
|
|
||||||
<programlisting>/etc/shorewall/snat:
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST
|
|
||||||
SNAT(2001:470:a:227::1) ::/0 sit1 { probability=0.50 }
|
|
||||||
SNAT(2001:470:a:227::2) ::/0 sit</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>FILES</title>
|
|
||||||
|
|
||||||
<para>/etc/shorewall6/snat</para>
|
|
||||||
</refsect1>
|
|
||||||
</refentry>
|
|
@@ -239,9 +239,6 @@
|
|||||||
that were active when Shorewall stopped continue to work and
|
that were active when Shorewall stopped continue to work and
|
||||||
all new connections from the firewall system itself are
|
all new connections from the firewall system itself are
|
||||||
allowed.</para>
|
allowed.</para>
|
||||||
|
|
||||||
<para>Note that the routestopped file is not supported in
|
|
||||||
Shorewall 5.0 and later versions.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -500,14 +497,13 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
||||||
then Shorewall6 won't clear the current traffic control rules during
|
then Shorewall6 won't clear the current traffic control rules during
|
||||||
[<command>re</command>]<command>start</command> or
|
[re]start. This setting is intended for use by people that prefer to
|
||||||
<command>reload</command>. This setting is intended for use by
|
configure traffic shaping when the network interfaces come up rather
|
||||||
people that prefer to configure traffic shaping when the network
|
than when the firewall is started. If that is what you want to do,
|
||||||
interfaces come up rather than when the firewall is started. If that
|
set TC_ENABLED=Yes and CLEAR_TC=No and do not supply an
|
||||||
is what you want to do, set TC_ENABLED=Yes and CLEAR_TC=No and do
|
/etc/shorewall6/tcstart file. That way, your traffic shaping rules
|
||||||
not supply an /etc/shorewall6/tcstart file. That way, your traffic
|
can still use the “fwmark” classifier based on packet marking
|
||||||
shaping rules can still use the “fwmark” classifier based on packet
|
defined in <ulink
|
||||||
marking defined in <ulink
|
|
||||||
url="/manpages6/shorewall6-tcrules.html">shorewall6-tcrules</ulink>(5).
|
url="/manpages6/shorewall6-tcrules.html">shorewall6-tcrules</ulink>(5).
|
||||||
If not specified, CLEAR_TC=No is assumed.</para>
|
If not specified, CLEAR_TC=No is assumed.</para>
|
||||||
|
|
||||||
@@ -608,9 +604,10 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If set to Yes (the default value), entries in the
|
<para>If set to Yes (the default value), entries in the
|
||||||
/etc/shorewall6/rtrules file cause an 'ip rule del' command to be
|
/etc/shorewall6/route_stopped files cause an 'ip rule del' command
|
||||||
generated in addition to an 'ip rule add' command. Setting this
|
to be generated in addition to an 'ip rule add' command. Setting
|
||||||
option to No, causes the 'ip rule del' command to be omitted.</para>
|
this option to No, causes the 'ip rule del' command to be
|
||||||
|
omitted.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -629,77 +626,28 @@
|
|||||||
role="bold">Yes</emphasis>|<emphasis
|
role="bold">Yes</emphasis>|<emphasis
|
||||||
role="bold">No</emphasis>||<emphasis
|
role="bold">No</emphasis>||<emphasis
|
||||||
role="bold">ipset</emphasis>[<emphasis
|
role="bold">ipset</emphasis>[<emphasis
|
||||||
role="bold">-only</emphasis>][<replaceable>,option</replaceable>[,...]][:[<replaceable>setname</replaceable>][:<replaceable>log_level</replaceable>|:l<replaceable>og_tag</replaceable>]]]}</term>
|
role="bold">-only</emphasis>][,<emphasis
|
||||||
|
role="bold">src-dst</emphasis>][:[<replaceable>setname</replaceable>][:<replaceable>log_level</replaceable>|:l<replaceable>og_tag</replaceable>]]]}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.7. When set to <emphasis
|
<para>Added in Shorewall 4.4.7. When set to <emphasis
|
||||||
role="bold">No</emphasis> or <emphasis role="bold">no</emphasis>,
|
role="bold">No</emphasis> or <emphasis role="bold">no</emphasis>,
|
||||||
chain-based dynamic blacklisting using <command>shorewall6
|
chain-based dynamic blacklisting using the <command>shorewall6
|
||||||
drop</command>, <command>shorewall6 reject</command>,
|
drop</command>, <command>shorewall6 reject</command>,
|
||||||
<command>shorewall6 logdrop</command> and <command>shorewall6
|
<command>shorewall6 logdrop</command> and <command>shorewall6
|
||||||
logreject</command> is disabled. Default is <emphasis
|
logreject</command> is disabled. Default is <emphasis
|
||||||
role="bold">Yes</emphasis>. Beginning with Shorewall 5.0.8,
|
role="bold">Yes</emphasis>. Beginning with Shorewall 5.0.8,
|
||||||
ipset-based dynamic blacklisting using <command>shorewall6
|
ipset-based dynamic blacklisting is also supported. The name of the
|
||||||
blacklist</command> is also supported. The name of the set
|
set (<replaceable>setname</replaceable>) and the level
|
||||||
(<replaceable>setname</replaceable>) and the level
|
|
||||||
(<replaceable>log_level</replaceable>), if any, at which blacklisted
|
(<replaceable>log_level</replaceable>), if any, at which blacklisted
|
||||||
traffic is to be logged may also be specified. The default set name
|
traffic is to be logged may also be specified. The default set name
|
||||||
is SW_DBL6 and the default log level is <option>none</option> (no
|
is SW_DBL6 and the default log level is <option>none</option> (no
|
||||||
logging). if <option>ipset-only</option> is given, then chain-based
|
logging). if <option>ipset-only</option> is given, then chain-based
|
||||||
dynamic blacklisting is disabled just as if DYNAMIC_BLACKLISTING=No
|
dynamic blacklisting is disabled just as if DYNAMIC_BLACKLISTING=No
|
||||||
had been specified.</para>
|
had been specified. Normally, only packets whose source address
|
||||||
|
matches an entry in the ipsec are dropped. If
|
||||||
<para>Possible <replaceable>option</replaceable>s are:</para>
|
<option>src-dst</option> is included, then packets whose destination
|
||||||
|
address matches an entry in the ipset are also dropped.</para>
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>src-dst</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Normally, only packets whose source address matches an
|
|
||||||
entry in the ipset are dropped. If <option>src-dst</option> is
|
|
||||||
included, then packets whose destination address matches an
|
|
||||||
entry in the ipset are also dropped.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>disconnect</option></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>The <option>disconnect</option> option was added in
|
|
||||||
Shorewall 5.0.13 and requires that the conntrack utility be
|
|
||||||
installed on the firewall system. When an address is
|
|
||||||
blacklisted using the <command>blacklist</command> command,
|
|
||||||
all connections originating from that address are
|
|
||||||
disconnected. if the <option>src-dst</option> option was also
|
|
||||||
specified, then all connections to that address are also
|
|
||||||
disconnected.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>timeout</option>=<replaceable>seconds</replaceable></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.13. Normally, Shorewall creates
|
|
||||||
the dynamic blacklisting ipset with timeout 0 which means that
|
|
||||||
entries are permanent. If you want entries in the set that are
|
|
||||||
not accessed for a period of time to be deleted from the set,
|
|
||||||
you may specify that period using this option. Note that the
|
|
||||||
<command>blacklist</command> command can override the ipset's
|
|
||||||
timeout setting.</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>Once the dynamic blacklisting ipset has been created,
|
|
||||||
changing this option setting requires a complete restart of
|
|
||||||
the firewall; <command>shorewall6 restart</command> if
|
|
||||||
RESTART=restart, otherwise <command>shorewall6 stop
|
|
||||||
&& shorewall6 start</command></para>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>When ipset-based dynamic blacklisting is enabled, the contents
|
<para>When ipset-based dynamic blacklisting is enabled, the contents
|
||||||
of the blacklist will be preserved over
|
of the blacklist will be preserved over
|
||||||
@@ -743,7 +691,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
helpers file from the administrative system into the script. When
|
helpers file from the administrative system into the script. When
|
||||||
set to No or not specified, the compiler will not copy the modules
|
set to No or not specified, the compiler will not copy the modules
|
||||||
or helpers file from <filename>/usr/share/shorewall6</filename> but
|
or helpers file from <filename>/usr/share/shorewall6</filename> but
|
||||||
will copy those found in another location on the CONFIG_PATH.</para>
|
will copy the found in another location on the CONFIG_PATH.</para>
|
||||||
|
|
||||||
<para>When compiling for direct use by Shorewall6, causes the
|
<para>When compiling for direct use by Shorewall6, causes the
|
||||||
contents of the local module or helpers file to be copied into the
|
contents of the local module or helpers file to be copied into the
|
||||||
@@ -772,27 +720,12 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis
|
|
||||||
role="bold">FIREWALL</emphasis>=[<emphasis>dnsname-or-ip-address</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>This option was added in Shorewall 5.0.13 and may be used on
|
|
||||||
an administrative system in directories containing the
|
|
||||||
configurations of remote firewalls. The contents of the variable are
|
|
||||||
the default value for the <replaceable>system</replaceable>
|
|
||||||
parameter to the <command>remote-start</command>,
|
|
||||||
<command>remote-reload</command> and
|
|
||||||
<command>remote-restart</command> commands.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">FORWARD_CLEAR_MARK=</emphasis>{<emphasis
|
<term><emphasis role="bold">FORWARD_CLEAR_MARK=</emphasis>{<emphasis
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.11. Traditionally, Shorewall has
|
<para>Added in Shorewall 4.4.11 Beta 3. Traditionally, Shorewall has
|
||||||
cleared the packet mark in the first rule in the mangle FORWARD
|
cleared the packet mark in the first rule in the mangle FORWARD
|
||||||
chain. This behavior is maintained with the default setting of this
|
chain. This behavior is maintained with the default setting of this
|
||||||
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
||||||
@@ -920,13 +853,13 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.6.0. Traditionally in <ulink
|
<para>Added in Shorewall 4.6.0. Traditionally in <ulink
|
||||||
url="/manpages6/shorewall6-rules.html">shorewall6-rules</ulink>(5),
|
url="/manpages6/shorewall6-rules.html">shorewall6-rules(5)</ulink>,
|
||||||
a semicolon separates column-oriented specifications on the left
|
a semicolon separates column-oriented specifications on the left
|
||||||
from <ulink url="/configuration_file_basics.htm#Pairs">alternative
|
from <ulink url="/configuration_file_basics.htm#Pairs">alternative
|
||||||
specificaitons</ulink> on the right.. When INLINE_MATCHES=Yes is
|
specificaitons</ulink> on the right.. When INLINE_MATCHES=Yes is
|
||||||
specified, the specifications on the right are interpreted as if
|
specified, the specifications on the right are interpreted as if
|
||||||
INLINE had been specified in the ACTION column. This also applies to
|
INLINE had been specified in the ACTION column. This also applies to
|
||||||
<ulink url="shorewall-masq.html">shorewall6-masq(5)</ulink> and
|
<ulink url="shorewall6-masq.html">shorewall6-masq(5)</ulink> and
|
||||||
<ulink url="shorewall6-mangle.html">shorewall6-mangle(5</ulink>)
|
<ulink url="shorewall6-mangle.html">shorewall6-mangle(5</ulink>)
|
||||||
which also support INLINE. If not specified or if specified as the
|
which also support INLINE. If not specified or if specified as the
|
||||||
empty value, the value 'No' is assumed for backward
|
empty value, the value 'No' is assumed for backward
|
||||||
@@ -934,12 +867,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.0, it is no longer necessary to
|
<para>Beginning with Shorewall 5.0.0, it is no longer necessary to
|
||||||
set INLINE_MATCHES=Yes in order to be able to specify your own
|
set INLINE_MATCHES=Yes in order to be able to specify your own
|
||||||
iptables text in a rule and INLINE_MATCHES=Yes is deprecated.
|
iptables text in a rule. You may simply preface that text with a
|
||||||
Beginning with 5.0.0, you may simply preface your text with a pair
|
pair of semicolons (";;"). If alternate input is also specified in
|
||||||
of semicolons (";;"). If alternate input is also specified in the
|
the rule, it should appear before the semicolons and may be
|
||||||
rule, it should appear before the semicolons and may be separated
|
separated from normal column input by a single semicolon.</para>
|
||||||
from normal column input by a single semicolon or enclosed in curly
|
|
||||||
braces ("{....}").</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1235,7 +1166,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</term>
|
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This parameter tells the /sbin/shorewall6 program where to
|
<para>This parameter tells the /sbin/shorewall6 program where to
|
||||||
@@ -1244,9 +1175,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
role="bold">logwatch</emphasis>, <emphasis role="bold">show
|
role="bold">logwatch</emphasis>, <emphasis role="bold">show
|
||||||
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
||||||
If not assigned or if assigned an empty value, /var/log/messages is
|
If not assigned or if assigned an empty value, /var/log/messages is
|
||||||
assumed. Beginning with Shorewall 5.0.10.1, you may specify
|
assumed.</para>
|
||||||
<option>systemd</option> to use <command>journelctl -r</command> to
|
|
||||||
read the log.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1800,9 +1729,6 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
When PAGER is given, the output of verbose <command>status</command>
|
When PAGER is given, the output of verbose <command>status</command>
|
||||||
commands and the <command>dump</command> command are piped through
|
commands and the <command>dump</command> command are piped through
|
||||||
the named program when the output file is a terminal.</para>
|
the named program when the output file is a terminal.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.12, the default value of this
|
|
||||||
option is the DEFAULT_PAGER setting in shorewallrc.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1994,18 +1920,18 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
#TARGET SOURCE DEST PROTO
|
#TARGET SOURCE DEST PROTO
|
||||||
Broadcast(DROP) - - -
|
Broadcast(DROP) - - -
|
||||||
DROP - - 2
|
DROP - - 2
|
||||||
INLINE - - 6 ;; -j REJECT --reject-with tcp-reset
|
INLINE - - 6 ; -j REJECT --reject-with tcp-reset
|
||||||
?if __ENHANCED_REJECT
|
?if __ENHANCED_REJECT
|
||||||
INLINE - - 17 ;; -j REJECT
|
INLINE - - 17 ; -j REJECT
|
||||||
?if __IPV4
|
?if __IPV4
|
||||||
INLINE - - 1 ;; -j REJECT --reject-with icmp-host-unreachable
|
INLINE - - 1 ; -j REJECT --reject-with icmp-host-unreachable
|
||||||
INLINE - - - ;; -j REJECT --reject-with icmp-host-prohibited
|
INLINE - - - ; -j REJECT --reject-with icmp-host-prohibited
|
||||||
?else
|
?else
|
||||||
INLINE - - 58 ;; -j REJECT --reject-with icmp6-addr-unreachable
|
INLINE - - 58 ; -j REJECT --reject-with icmp6-addr-unreachable
|
||||||
INLINE - - - ;; -j REJECT --reject-with icmp6-adm-prohibited
|
INLINE - - - ; -j REJECT --reject-with icmp6-adm-prohibited
|
||||||
?endif
|
?endif
|
||||||
?else
|
?else
|
||||||
INLINE - - - ;; -j REJECT
|
INLINE - - - ; -j REJECT
|
||||||
?endif</programlisting>
|
?endif</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -2054,7 +1980,7 @@ INLINE - - - ;; -j REJECT
|
|||||||
restored unconditionally at the top of the mangle OUTPUT and
|
restored unconditionally at the top of the mangle OUTPUT and
|
||||||
PREROUTING chains, even if the saved mark is zero. When this option
|
PREROUTING chains, even if the saved mark is zero. When this option
|
||||||
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
||||||
only if it is non-zero. If you have problems with IPSEC ESP packets
|
even when it is zero. If you have problems with IPSEC ESP packets
|
||||||
not being routed correctly on output, try setting this option to
|
not being routed correctly on output, try setting this option to
|
||||||
<emphasis role="bold">No</emphasis>.</para>
|
<emphasis role="bold">No</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -2580,20 +2506,6 @@ INLINE - - - ;; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">VERBOSE_MESSAGES=</emphasis>[<emphasis
|
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.9. When Yes (the default), messages
|
|
||||||
produced by the ?INFO and ?WARNING directives include the filename
|
|
||||||
and linenumber of the directive. When set to No, that additional
|
|
||||||
information is omitted. The setting may be overridden on a directive
|
|
||||||
by directive basis by following ?INFO or ?WARNING with '!' (no
|
|
||||||
intervening white space).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
role="bold">VERBOSITY=</emphasis>[<emphasis>number</emphasis>]</term>
|
||||||
@@ -2670,23 +2582,6 @@ INLINE - - - ;; -j REJECT
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">ZERO_MARKS=</emphasis>[<emphasis
|
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.12, this is a workaround for an issue
|
|
||||||
where packet marks are not zeroed by the kernel. It should be set to
|
|
||||||
No (the default) unless you find that incoming packets are being
|
|
||||||
mis-routed for no apparent reasons.</para>
|
|
||||||
|
|
||||||
<caution>
|
|
||||||
<para>Do not set this option to Yes if you have IPSEC software
|
|
||||||
running on the firewall system.</para>
|
|
||||||
</caution>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>
|
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>
|
||||||
|
@@ -44,6 +44,8 @@
|
|||||||
<arg>-<replaceable>options</replaceable></arg>
|
<arg>-<replaceable>options</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><option>allow</option></arg>
|
<arg choice="plain"><option>allow</option></arg>
|
||||||
|
|
||||||
|
<arg choice="plain"><replaceable>address</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -56,9 +58,7 @@
|
|||||||
|
|
||||||
<arg choice="plain"><option>blacklist</option></arg>
|
<arg choice="plain"><option>blacklist</option></arg>
|
||||||
|
|
||||||
<arg choice="plain"><replaceable>address</replaceable><arg
|
<arg choice="plain"><replaceable>address</replaceable></arg>
|
||||||
choice="plain"><arg><replaceable>option
|
|
||||||
...</replaceable></arg></arg></arg>
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -403,9 +403,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="opt"><replaceable>system</replaceable></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -427,9 +427,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="opt"><replaceable>system</replaceable></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -451,9 +451,9 @@
|
|||||||
|
|
||||||
<arg><option>-i</option></arg>
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="opt"><replaceable>system</replaceable></arg>
|
<arg choice="plain"><replaceable>system</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -932,9 +932,7 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
role="bold">logreject</emphasis> command.</para>
|
||||||
5.0.10, this command can also re-enable addresses blacklisted using
|
|
||||||
the <command>blacklist</command> command.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -954,23 +952,6 @@
|
|||||||
The <replaceable>address</replaceable> along with any
|
The <replaceable>address</replaceable> along with any
|
||||||
<replaceable>option</replaceable>s are passed to the <command>ipset
|
<replaceable>option</replaceable>s are passed to the <command>ipset
|
||||||
add</command> command.</para>
|
add</command> command.</para>
|
||||||
|
|
||||||
<para>If the <option>disconnect</option> option is specified in the
|
|
||||||
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
|
|
||||||
determines the amount of information displayed:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 0, then a message
|
|
||||||
giving the number of conntrack flows deleted by the command is
|
|
||||||
displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>If the effective verbosity is > 1, then the conntrack
|
|
||||||
table entries deleted by the command are also displayed.</para>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1565,11 +1546,9 @@
|
|||||||
<term><emphasis role="bold">remote-reload
|
<term><emphasis role="bold">remote-reload
|
||||||
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
||||||
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
||||||
[-<option>T</option>] [-<option>i</option>] [ [ -D ]
|
[-<option>T</option>] [-<option>i</option>] [
|
||||||
<replaceable>directory</replaceable> ] [
|
<replaceable>directory</replaceable> ]
|
||||||
<replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<term/>
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was added in Shorewall 5.0.0.</para>
|
<para>This command was added in Shorewall 5.0.0.</para>
|
||||||
@@ -1593,14 +1572,8 @@
|
|||||||
defaulted) directory is compiled to a file called firewall in that
|
defaulted) directory is compiled to a file called firewall in that
|
||||||
directory. If compilation succeeds, then firewall is copied to
|
directory. If compilation succeeds, then firewall is copied to
|
||||||
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
<emphasis>system</emphasis> using scp. If the copy succeeds,
|
||||||
Shorewall6 Lite on <emphasis>system</emphasis> is restarted via ssh.
|
Shorewall6 Lite on <emphasis>system</emphasis> is restarted via
|
||||||
Beginning with Shorewall 5.0.13, if
|
ssh.</para>
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <option>-s</option> is specified and the
|
<para>If <option>-s</option> is specified and the
|
||||||
<command>restart</command> command succeeds, then the remote
|
<command>restart</command> command succeeds, then the remote
|
||||||
@@ -1635,9 +1608,9 @@
|
|||||||
<term><emphasis role="bold">remote- restart
|
<term><emphasis role="bold">remote- restart
|
||||||
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
</emphasis>[-<option>s</option>] [-<option>c</option>]
|
||||||
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
||||||
[-<option>T</option>] [-<option>i</option>] [ [ -D ]
|
[-<option>T</option>] [-<option>i</option>] [
|
||||||
<replaceable>directory</replaceable> ] [
|
<replaceable>directory</replaceable> ]
|
||||||
<replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was renamed from <command>reload</command> in
|
<para>This command was renamed from <command>reload</command> in
|
||||||
@@ -1665,14 +1638,6 @@
|
|||||||
Shorewall6 Lite on <emphasis>system</emphasis> is restarted via
|
Shorewall6 Lite on <emphasis>system</emphasis> is restarted via
|
||||||
ssh.</para>
|
ssh.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.13, if
|
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <option>-s</option> is specified and the
|
<para>If <option>-s</option> is specified and the
|
||||||
<command>restart</command> command succeeds, then the remote
|
<command>restart</command> command succeeds, then the remote
|
||||||
Shorewall6-lite configuration is saved by executing
|
Shorewall6-lite configuration is saved by executing
|
||||||
@@ -1706,8 +1671,8 @@
|
|||||||
<term><emphasis role="bold">remote-start </emphasis>
|
<term><emphasis role="bold">remote-start </emphasis>
|
||||||
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
|
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
|
||||||
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
|
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
|
||||||
[-<option>i</option>] [ [-D ] <replaceable>directory</replaceable> ] [
|
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
|
||||||
<replaceable>system</replaceable> ]</term>
|
<replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This command was added in Shorewall 5.0.0.</para>
|
<para>This command was added in Shorewall 5.0.0.</para>
|
||||||
@@ -1732,13 +1697,7 @@
|
|||||||
directory. If compilation succeeds, then firewall is copied to
|
directory. If compilation succeeds, then firewall is copied to
|
||||||
<replaceable>system</replaceable> using scp. If the copy succeeds,
|
<replaceable>system</replaceable> using scp. If the copy succeeds,
|
||||||
Shorewall6 Lite on <replaceable>system</replaceable> is started via
|
Shorewall6 Lite on <replaceable>system</replaceable> is started via
|
||||||
ssh. Beginning with Shorewall 5.0.13, if
|
ssh.</para>
|
||||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
|
||||||
option setting in <ulink
|
|
||||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> is assumed. In
|
|
||||||
that case, if you want to specify a
|
|
||||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
|
||||||
option must be given.</para>
|
|
||||||
|
|
||||||
<para>If <option>-s</option> is specified and the <emphasis
|
<para>If <option>-s</option> is specified and the <emphasis
|
||||||
role="bold">start</emphasis> command succeeds, then the remote
|
role="bold">start</emphasis> command succeeds, then the remote
|
||||||
@@ -2480,10 +2439,8 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>With the exception of the
|
<para>INCLUDEd files will be expanded inline in the output
|
||||||
<filename>notrack</filename>-><filename>conntrack</filename>
|
file.</para>
|
||||||
conversion, INCLUDEd files will be expanded inline in the
|
|
||||||
output file.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -2491,26 +2448,6 @@
|
|||||||
tab character; there is no attempt made to otherwise align the
|
tab character; there is no attempt made to otherwise align the
|
||||||
columns.</para>
|
columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Prior to Shorewall 5.0.15, shell variables will be
|
|
||||||
expanded in the output file.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Prior to Shorewall 5.0.15, lines omitted by compiler
|
|
||||||
directives (?if ...., etc.) will not appear in the output
|
|
||||||
file.</para>
|
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>Because the translation of the 'blacklist' and
|
|
||||||
'routestopped' files is not 1:1, omitted lines and compiler
|
|
||||||
directives are not transferred to the converted files. If
|
|
||||||
either are present, the compiler issues a warning:</para>
|
|
||||||
|
|
||||||
<programlisting> WARNING: "Omitted rules and compiler directives were not translated</programlisting>
|
|
||||||
</important>
|
|
||||||
</listitem>
|
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
|
145
docs/Actions.xml
145
docs/Actions.xml
@@ -417,8 +417,8 @@ REDIRECT net - tcp 80 - 1.2.3.4</programlisting>
|
|||||||
|
|
||||||
<para>To create a mangle action, follow the steps in the preceding
|
<para>To create a mangle action, follow the steps in the preceding
|
||||||
section, but use the
|
section, but use the
|
||||||
<filename>/usr/share/shorewall/action.mangletemplate</filename>
|
<filename>/usr/share/shorewall/action.mangletemplate</filename> file.
|
||||||
file.</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -1011,145 +1011,4 @@ add_rule $chainref, '-j ACCEPT';
|
|||||||
1; </programlisting>
|
1; </programlisting>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
|
||||||
<title>Mangle Actions</title>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.7, actions are supported in <ulink
|
|
||||||
url="manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink>. Like
|
|
||||||
actions used out of <ulink
|
|
||||||
url="manpages/shorewall-rules.html">shorewall-rules(5)</ulink>, they must
|
|
||||||
be declared in <ulink
|
|
||||||
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>. These
|
|
||||||
<firstterm>mangle actions</firstterm> must have the
|
|
||||||
<option>mangle</option> option specified on <ulink
|
|
||||||
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>. Like
|
|
||||||
the actions described in the preceding sections, mangle actions are
|
|
||||||
defined in a files with names of the form
|
|
||||||
action.<replaceable>action</replaceable>. Rules in those files have the
|
|
||||||
same format as those in <ulink
|
|
||||||
url="manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink> with the
|
|
||||||
restriction that chain designators (:P, :F, etc.) are not permitted in the
|
|
||||||
ACTION column. Both regular and inline actions are supported.</para>
|
|
||||||
|
|
||||||
<para>Inline Example</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/actions</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION OPTIONS
|
|
||||||
Divert inline,mangle # TProxy Rules
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/action.Divert</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
DIVERT COMB_IF - tcp - 80
|
|
||||||
DIVERT COMC_IF - tcp - 80
|
|
||||||
DIVERT DMZ_IF 172.20.1.0/24 tcp - 80
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/mangle</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
Divert</programlisting>
|
|
||||||
|
|
||||||
<para>More efficient way to do this:</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/actions</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION OPTIONS
|
|
||||||
Divert inline # TProxy Rules
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/action.Divert</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
DIVERT COMB_IF -
|
|
||||||
DIVERT COMC_IF -
|
|
||||||
DIVERT DMZ_IF 172.20.1.0/24
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/mangle</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
Divert - - tcp - 80</programlisting>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<title>SNAT Actions</title>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.14, actions are supported in <ulink
|
|
||||||
url="manpages/shorewall-snat.html">shorewall-snat(5</ulink>); that file
|
|
||||||
supercedes <ulink
|
|
||||||
url="manpages/shorewall-masq.html">shorewall-masq(5)</ulink> which is
|
|
||||||
still supported. The shorewall update command will convert a
|
|
||||||
<filename>masq</filename> file into the equivalent
|
|
||||||
<filename>snat</filename> file. Like actions used out of <ulink
|
|
||||||
url="manpages/shorewall-rules.html">shorewall-rules(5)</ulink>,
|
|
||||||
<firstterm>SNAT actions</firstterm> must be declared in <ulink
|
|
||||||
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>. These
|
|
||||||
<firstterm>mangle actions</firstterm> must have the <option>nat</option>
|
|
||||||
option specified on <ulink
|
|
||||||
url="manpages/shorewall-actions.html">shorewall-actions(5)</ulink>. Like
|
|
||||||
the actions described in the preceding sections, SNAT actions are defined
|
|
||||||
in a files with names of the form
|
|
||||||
action.<replaceable>action</replaceable>. Rules in those files have the
|
|
||||||
same format as those in <ulink
|
|
||||||
url="manpages/shorewall-snat.html">shorewall-snat(5)</ulink> with two
|
|
||||||
restrictions:</para>
|
|
||||||
|
|
||||||
<orderedlist>
|
|
||||||
<listitem>
|
|
||||||
<para>The plus sign ("+") is not allowed in the ACTION column, so all
|
|
||||||
rules in the action will either be pre-nat or post-nat depending on
|
|
||||||
whether '+' was present in the action's invocation.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Interface names are not allowed in the DEST column, so all rules
|
|
||||||
in the action will apply to the interface specified in the action's
|
|
||||||
invocation.</para>
|
|
||||||
</listitem>
|
|
||||||
</orderedlist>
|
|
||||||
|
|
||||||
<para>Both regular and inline actions are supported.</para>
|
|
||||||
|
|
||||||
<para>Example:</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/actions</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION OPTIONS
|
|
||||||
custEPTs nat,inline</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/action.custEPTs</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT($GW_IP) { proto=udp port=1146 }
|
|
||||||
SNAT($GW_IP) { proto=tcp port=1156,7221,21000 }
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/snat</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>ACTION SOURCE DEST PROTO PORT
|
|
||||||
custEPTs { source=$EPT_LIST dest=$IF_NET:$EPT_SERVERS }</programlisting>
|
|
||||||
|
|
||||||
<para>More effeciently:</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/actions</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION OPTIONS
|
|
||||||
custEPTs nat</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/action.custEPTs</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT($GW_IP) { proto=udp port=1146 }
|
|
||||||
SNAT($GW_IP) { proto=tcp port=1156,7221,21000 }
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/snat</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>ACTION SOURCE DEST PROTO PORT
|
|
||||||
custEPT { source=$EPT_LIST dest=$IF_NET:$EPT_SERVERS }</programlisting>
|
|
||||||
</section>
|
|
||||||
</article>
|
</article>
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
||||||
requires the Shorewall package and adds those components needed to
|
requires the Shorewall package and adds those components needed to
|
||||||
create an IPv6 firewall.</para>
|
create an IPv6 fireawall.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -106,17 +106,8 @@
|
|||||||
url="Install.htm#idp8774904608">configure scripts included with Shorewall
|
url="Install.htm#idp8774904608">configure scripts included with Shorewall
|
||||||
Core</ulink>.</para>
|
Core</ulink>.</para>
|
||||||
|
|
||||||
<important>
|
|
||||||
<para>Since Shorewall 4.5.2, each of these directories is now
|
|
||||||
relocatable using the <ulink url="Install.htm#idp8774904608">configure
|
|
||||||
scripts included with Shorewall Core</ulink>. These scripts set shell
|
|
||||||
variables in the shorewallrc file which is normally installed in
|
|
||||||
/usr/share/shorewall/. The name of the variable is included in
|
|
||||||
parentheses in the section headings below.</para>
|
|
||||||
</important>
|
|
||||||
|
|
||||||
<section id="sbin">
|
<section id="sbin">
|
||||||
<title>/sbin ($SBINDIR)</title>
|
<title>/sbin</title>
|
||||||
|
|
||||||
<para>The <filename>/sbin/shorewall</filename> shell program is used to
|
<para>The <filename>/sbin/shorewall</filename> shell program is used to
|
||||||
interact with Shorewall. See <ulink
|
interact with Shorewall. See <ulink
|
||||||
@@ -124,7 +115,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="share-shorewall">
|
<section id="share-shorewall">
|
||||||
<title>/usr/share/shorewall (${SHAREDIR}/shorewall)</title>
|
<title>/usr/share/shorewall</title>
|
||||||
|
|
||||||
<para>The bulk of Shorewall is installed here.</para>
|
<para>The bulk of Shorewall is installed here.</para>
|
||||||
|
|
||||||
@@ -229,28 +220,22 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="shorewall">
|
<section id="shorewall">
|
||||||
<title>/etc/shorewall (${CONFDIR}/shorewall)</title>
|
<title>/etc/shorewall</title>
|
||||||
|
|
||||||
<para>This is where the modifiable IPv4 configuration files are
|
<para>This is where the modifiable IPv4 configuration files are
|
||||||
installed.</para>
|
installed.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="init">
|
<section id="init">
|
||||||
<title>/etc/init.d or /etc/rc.d (depends on distribution)
|
<title>/etc/init.d or /etc/rc.d (depends on distribution)</title>
|
||||||
($INITDIR)</title>
|
|
||||||
|
|
||||||
<para>An init script is installed here. Depending on the distribution,
|
<para>An init script is installed here. Depending on the distribution,
|
||||||
it is named <filename>shorewall</filename> or
|
it is named <filename>shorewall</filename> or
|
||||||
<filename>rc.firewall</filename>. Only installed on systems where
|
<filename>rc.firewall</filename>.</para>
|
||||||
systemd is not installed.</para>
|
|
||||||
|
|
||||||
<para>When systemd is installed, the Shorewall .service files are
|
|
||||||
installed in the directory specified by the SERVICEDIR variable in
|
|
||||||
<filename>/usr/share/shorewall/shorewallrc</filename>.</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="var">
|
<section id="var">
|
||||||
<title>/var/lib/shorewall (${VARLIB}/shorewall)</title>
|
<title>/var/lib/shorewall</title>
|
||||||
|
|
||||||
<para>Shorewall doesn't install any files in this directory but rather
|
<para>Shorewall doesn't install any files in this directory but rather
|
||||||
uses the directory for storing state information. This directory may be
|
uses the directory for storing state information. This directory may be
|
||||||
@@ -347,7 +332,7 @@
|
|||||||
<para>Shorewall6 installs its files in a number of directories:</para>
|
<para>Shorewall6 installs its files in a number of directories:</para>
|
||||||
|
|
||||||
<section id="sbin6">
|
<section id="sbin6">
|
||||||
<title>/sbin ($SBINDIR)</title>
|
<title>/sbin</title>
|
||||||
|
|
||||||
<para>The <filename>/sbin/shorewall6</filename> shell program is used to
|
<para>The <filename>/sbin/shorewall6</filename> shell program is used to
|
||||||
interact with Shorewall6. See <ulink
|
interact with Shorewall6. See <ulink
|
||||||
@@ -355,7 +340,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="share-shorewall6">
|
<section id="share-shorewall6">
|
||||||
<title>/usr/share/shorewall6 (${SHAREDIR}/shorewall6)</title>
|
<title>/usr/share/shorewall6</title>
|
||||||
|
|
||||||
<para>The bulk of Shorewall6 is installed here.</para>
|
<para>The bulk of Shorewall6 is installed here.</para>
|
||||||
|
|
||||||
@@ -432,28 +417,14 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="etc-shorewall6">
|
<section id="etc-shorewall6">
|
||||||
<title>/etc/shorewall6 (${CONFDIR}/</title>
|
<title>/etc/shorewall6</title>
|
||||||
|
|
||||||
<para>This is where the modifiable IPv6 configuration files are
|
<para>This is where the modifiable IPv6 configuration files are
|
||||||
installed.</para>
|
installed.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="init">
|
|
||||||
<title>/etc/init.d or /etc/rc.d (depends on distribution)
|
|
||||||
($INITDIR)</title>
|
|
||||||
|
|
||||||
<para>An init script is installed here. Depending on the distribution,
|
|
||||||
it is named <filename>shorewall6</filename> or
|
|
||||||
<filename>rc.firewall</filename>. Only installed on systems where
|
|
||||||
systemd is not installed.</para>
|
|
||||||
|
|
||||||
<para>When systemd is installed, the Shorewall .service files are
|
|
||||||
installed in the directory specified by the SERVICEDIR variable in
|
|
||||||
<filename>/usr/share/shorewall/shorewallrc</filename>.</para>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="var-shorewall6">
|
<section id="var-shorewall6">
|
||||||
<title>/var/lib/shorewall6 (${VARLIB}/shorewall6)</title>
|
<title>/var/lib/shorewall6</title>
|
||||||
|
|
||||||
<para>Shorewall6 doesn't install any files in this directory but rather
|
<para>Shorewall6 doesn't install any files in this directory but rather
|
||||||
uses the directory for storing state information. This directory may be
|
uses the directory for storing state information. This directory may be
|
||||||
@@ -543,7 +514,7 @@
|
|||||||
in the sub-sections that follow.</para>
|
in the sub-sections that follow.</para>
|
||||||
|
|
||||||
<section id="sbin-lite">
|
<section id="sbin-lite">
|
||||||
<title>/sbin ($SBINDIR_</title>
|
<title>/sbin</title>
|
||||||
|
|
||||||
<para>The <filename>/sbin/shorewall-lite</filename> shell program is
|
<para>The <filename>/sbin/shorewall-lite</filename> shell program is
|
||||||
used to interact with Shorewall lite. See <ulink
|
used to interact with Shorewall lite. See <ulink
|
||||||
@@ -551,28 +522,22 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="init-lite">
|
<section id="init-lite">
|
||||||
<title>/etc/init.d or /etc/rc.d (depends on distribution)
|
<title>/etc/init.d or /etc/rc.d (depends on distribution)</title>
|
||||||
($INITDIR)</title>
|
|
||||||
|
|
||||||
<para>An init script is installed here. Depending on the distribution,
|
<para>An init script is installed here. Depending on the distribution,
|
||||||
it is named <filename>shorewall-lite</filename> or
|
it is named <filename>shorewall-lite</filename> or
|
||||||
<filename>rc.firewall</filename>. Only installed on systems where
|
<filename>rc.firewall</filename>.</para>
|
||||||
systemd is not installed.</para>
|
|
||||||
|
|
||||||
<para>When systemd is installed, the Shorewall .service files are
|
|
||||||
installed in the directory specified by the SERVICEDIR variable in
|
|
||||||
<filename>/usr/share/shorewall/shorewallrc</filename>.</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="shorewall-lite">
|
<section id="shorewall-lite">
|
||||||
<title>/etc/shorewall-lite (${CONFDIR}/shorewall-lite)</title>
|
<title>/etc/shorewall-lite</title>
|
||||||
|
|
||||||
<para>This is where the modifiable configuration files are
|
<para>This is where the modifiable configuration files are
|
||||||
installed.</para>
|
installed.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="share-lite">
|
<section id="share-lite">
|
||||||
<title>/usr/share/shorewall-lite (${SHAREDIR}/shorewall-lite)</title>
|
<title>/usr/share/shorewall-lite</title>
|
||||||
|
|
||||||
<para>The bulk of Shorewall-lite is installed here.</para>
|
<para>The bulk of Shorewall-lite is installed here.</para>
|
||||||
|
|
||||||
@@ -621,7 +586,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="var-lite">
|
<section id="var-lite">
|
||||||
<title>/var/lib/shorewall-lite (${VARLIB}/shorewall-lite)</title>
|
<title>/var/lib/shorewall-lite</title>
|
||||||
|
|
||||||
<para>Shorewall-lite doesn't install any files in this directory but
|
<para>Shorewall-lite doesn't install any files in this directory but
|
||||||
rather uses the directory for storing state information. This directory
|
rather uses the directory for storing state information. This directory
|
||||||
@@ -754,29 +719,15 @@
|
|||||||
<filename>rc.firewall</filename>.</para>
|
<filename>rc.firewall</filename>.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="init">
|
|
||||||
<title>/etc/init.d or /etc/rc.d (depends on distribution)
|
|
||||||
($INITDIR)</title>
|
|
||||||
|
|
||||||
<para>An init script is installed here. Depending on the distribution,
|
|
||||||
it is named <filename>shorewall</filename>6-lite or
|
|
||||||
<filename>rc.firewall</filename>. Only installed on systems where
|
|
||||||
systemd is not installed.</para>
|
|
||||||
|
|
||||||
<para>When systemd is installed, the Shorewall .service files are
|
|
||||||
installed in the directory specified by the SERVICEDIR variable in
|
|
||||||
<filename>/usr/share/shorewall/shorewallrc</filename>.</para>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="etc-shorewall6-lite">
|
<section id="etc-shorewall6-lite">
|
||||||
<title>/etc/shorewall6-lite (${CONFDIR}/shorewall6-lite)</title>
|
<title>/etc/shorewall6-lite</title>
|
||||||
|
|
||||||
<para>This is where the modifiable configuration files are
|
<para>This is where the modifiable configuration files are
|
||||||
installed.</para>
|
installed.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="share-lite6">
|
<section id="share-lite6">
|
||||||
<title>/usr/share/shorewall6-lite (${SHAREDIR}/shorewall6-lite)</title>
|
<title>/usr/share/shorewall6-lite</title>
|
||||||
|
|
||||||
<para>The bulk of Shorewall-lite is installed here.</para>
|
<para>The bulk of Shorewall-lite is installed here.</para>
|
||||||
|
|
||||||
@@ -825,7 +776,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="var-lite6">
|
<section id="var-lite6">
|
||||||
<title>/var/lib/shorewall6-lite (${VARLIB}/shorewall6-lite)</title>
|
<title>/var/lib/shorewall6-lite</title>
|
||||||
|
|
||||||
<para>Shorewall6-lite doesn't install any files in this directory but
|
<para>Shorewall6-lite doesn't install any files in this directory but
|
||||||
rather uses the directory for storing state information. This directory
|
rather uses the directory for storing state information. This directory
|
||||||
|
@@ -95,11 +95,6 @@ rsyncok eth1:<emphasis role="bold">dynamic</emphasis></programlisting>
|
|||||||
<para>When the <emphasis role="bold">dynamic_shared</emphasis> option is
|
<para>When the <emphasis role="bold">dynamic_shared</emphasis> option is
|
||||||
specified, a single ipset is created; the ipset has the same name as the
|
specified, a single ipset is created; the ipset has the same name as the
|
||||||
zone.</para>
|
zone.</para>
|
||||||
|
|
||||||
<para>In the above example, <emphasis role="bold">rsyncok</emphasis> is
|
|
||||||
a sub-zone of the single zone <emphasis role="bold">loc</emphasis>.
|
|
||||||
Making a dynamic zone a sub-zone of multiple other zones is also
|
|
||||||
supported.</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Adding">
|
<section id="Adding">
|
||||||
|
43
docs/FAQ.xml
43
docs/FAQ.xml
@@ -494,12 +494,6 @@ DNAT net loc:192.168.1.4 tcp 21 - 206.1
|
|||||||
<filename>/etc/shorewall/masq</filename>:<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
<filename>/etc/shorewall/masq</filename>:<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
||||||
eth1:192.168.1.4 0.0.0.0/0 192.168.1.1 tcp 21</programlisting></para>
|
eth1:192.168.1.4 0.0.0.0/0 192.168.1.1 tcp 21</programlisting></para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the eqivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> file is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(192.168.1.1) 0.0.0.0/0 eth1:192.168.1.4 tcp 21</programlisting>
|
|
||||||
|
|
||||||
<para>This rule has the undesirable side effect of making all FTP
|
<para>This rule has the undesirable side effect of making all FTP
|
||||||
connections from the net appear to the FTP server as if they
|
connections from the net appear to the FTP server as if they
|
||||||
originated on the Shorewall system. But it will force the FTP server
|
originated on the Shorewall system. But it will force the FTP server
|
||||||
@@ -537,12 +531,6 @@ net eth0 <emphasis role="bold">routeback</emphasi
|
|||||||
<para><filename>/etc/shorewall/masq</filename>;<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
<para><filename>/etc/shorewall/masq</filename>;<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
||||||
eth0:66.249.93.111 0.0.0.0/0 206.124.146.176 tcp 993</programlisting></para>
|
eth0:66.249.93.111 0.0.0.0/0 206.124.146.176 tcp 993</programlisting></para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
/etc/shorewall/snat file is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.176) 0.0.0.0/0 eth0:66.249.93.111 tcp 993</programlisting>
|
|
||||||
|
|
||||||
<para>and in
|
<para>and in
|
||||||
<filename>/etc/shorewall/shorewall.conf</filename>:</para>
|
<filename>/etc/shorewall/shorewall.conf</filename>:</para>
|
||||||
|
|
||||||
@@ -730,12 +718,6 @@ loc eth1 <emphasis role="bold">routeback</emphasi
|
|||||||
<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
||||||
<emphasis role="bold">eth1:192.168.1.5 192.168.1.0/24 192.168.1.254 tcp www</emphasis></programlisting>
|
<emphasis role="bold">eth1:192.168.1.5 192.168.1.0/24 192.168.1.254 tcp www</emphasis></programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the corresponding
|
|
||||||
<filename>/etc/shorewall/snat</filename> file is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
<emphasis role="bold">SNAT(192.168.1.254) 192.168.1.0/24 eth1:192.168.1.5 tcp www</emphasis></programlisting>
|
|
||||||
|
|
||||||
<para>Note: The technique described here is known as
|
<para>Note: The technique described here is known as
|
||||||
<firstterm>hairpinning NAT</firstterm> and is described in section 6
|
<firstterm>hairpinning NAT</firstterm> and is described in section 6
|
||||||
of <ulink url="http://www.faqs.org/rfcs/rfc4787.html">RFC
|
of <ulink url="http://www.faqs.org/rfcs/rfc4787.html">RFC
|
||||||
@@ -745,11 +727,6 @@ loc eth1 <emphasis role="bold">routeback</emphasi
|
|||||||
|
|
||||||
<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
<programlisting>#INTERFACE SOURCE ADDRESS PROTO PORT
|
||||||
eth1:192.168.1.5 192.168.1.0/24 <emphasis role="bold">130.151.100.69</emphasis> tcp www</programlisting>
|
eth1:192.168.1.5 192.168.1.0/24 <emphasis role="bold">130.151.100.69</emphasis> tcp www</programlisting>
|
||||||
|
|
||||||
<para>Equivalent <filename>/etc/shorewall/snat</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(<emphasis role="bold">130.151.100.69</emphasis>) 192.168.1.0/24 eth1:192.168.1.5 tcp www</programlisting>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -875,12 +852,6 @@ dmz eth2 <emphasis role="bold">routeback</emphasi
|
|||||||
<programlisting>#INTERFACE SOURCE
|
<programlisting>#INTERFACE SOURCE
|
||||||
eth2:192.168.1.2 192.168.2.0/24</programlisting>
|
eth2:192.168.1.2 192.168.2.0/24</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
MASQUERADE 192.168.1.0/24 eth2:192.168.1.2 tcp www</programlisting>
|
|
||||||
|
|
||||||
<para>In <filename>/etc/shorewall/nat</filename>, be sure that you
|
<para>In <filename>/etc/shorewall/nat</filename>, be sure that you
|
||||||
have <quote>Yes</quote> in the ALL INTERFACES column.</para>
|
have <quote>Yes</quote> in the ALL INTERFACES column.</para>
|
||||||
</example>
|
</example>
|
||||||
@@ -3220,17 +3191,11 @@ loc $FW ACCEPT</programlisting>
|
|||||||
|
|
||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SOURCE ADDRESS
|
||||||
|
|
||||||
?COMMENT DSL Modem
|
COMMENT DSL Modem
|
||||||
|
|
||||||
EXT_IF:172.20.1.2 0.0.0.0/0 172.20.1.254
|
EXT_IF:172.20.1.2 0.0.0.0/0 172.20.1.254
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(172.20.1.254) 0.0.0.0/0 EXT_IF:192.168.1.2 tcp www</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/proxyarp</filename>:</para>
|
<para><filename>/etc/shorewall/proxyarp</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#ADDRESS INTERFACE EXTERNAL HAVEROUTE PERSISTENT
|
<programlisting>#ADDRESS INTERFACE EXTERNAL HAVEROUTE PERSISTENT
|
||||||
@@ -3268,12 +3233,6 @@ COMMENT DSL Modem
|
|||||||
|
|
||||||
EXT_IF:192.168.1.1 0.0.0.0/0 192.168.1.254
|
EXT_IF:192.168.1.1 0.0.0.0/0 192.168.1.254
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(192.168.1.254) 0.0.0.0/0 EXT_IF:192.168.1.1 tcp www</programlisting>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
@@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
<year>2011</year>
|
<year>2011</year>
|
||||||
|
|
||||||
<year>2016</year>
|
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
@@ -91,9 +89,7 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para><ulink url="two-interface.htm">Two-interface</ulink> Linux System
|
<para><ulink url="two-interface.htm">Two-interface</ulink> Linux System
|
||||||
acting as a firewall/router for a small local network. For
|
acting as a firewall/router for a small local network</para>
|
||||||
Redhat-specific install/configure information, see <ulink url="???">this
|
|
||||||
article </ulink>contributed by Digimer.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -152,13 +152,11 @@
|
|||||||
|
|
||||||
<orderedlist>
|
<orderedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>In <filename>/etc/shorewall/masq</filename>
|
<para>In <filename>/etc/shorewall/masq</filename>, traffic that will
|
||||||
(<filename>/etc/shorewall/snat</filename> when running Shorewall
|
later be encrypted is exempted from MASQUERADE/SNAT using existing
|
||||||
5.0.14 or later), traffic that will later be encrypted is exempted
|
entries. If you want to MASQUERADE/SNAT outgoing traffic that will
|
||||||
from MASQUERADE/SNAT using existing entries. If you want to
|
later be encrypted, you must include the appropriate indication in the
|
||||||
MASQUERADE/SNAT outgoing traffic that will later be encrypted, you
|
new IPSEC column in that file.</para>
|
||||||
must include the appropriate indication in the IPSEC column in that
|
|
||||||
file. </para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -398,7 +398,7 @@ ACCEPT net $FW tcp 22</programlisting>
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
||||||
requires the Shorewall package and adds those components needed to
|
requires the Shorewall package and adds those components needed to
|
||||||
create an IPv6 firewall.</para>
|
create an IPv6 fireawall.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -766,7 +766,7 @@ fi</programlisting>
|
|||||||
provider interfaces as <emphasis role="bold">optional</emphasis> (<ulink
|
provider interfaces as <emphasis role="bold">optional</emphasis> (<ulink
|
||||||
url="manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>)
|
url="manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>)
|
||||||
then <link linkend="LinkMonitor">install and configure
|
then <link linkend="LinkMonitor">install and configure
|
||||||
FOOLSM</link>.</para>
|
LSM</link>.</para>
|
||||||
|
|
||||||
<para><ulink url="Shorewall-init.html">Shorewall-init</ulink> provides
|
<para><ulink url="Shorewall-init.html">Shorewall-init</ulink> provides
|
||||||
for handling links that go hard down and are later brought back
|
for handling links that go hard down and are later brought back
|
||||||
@@ -774,7 +774,7 @@ fi</programlisting>
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="masq">
|
<section id="masq">
|
||||||
<title>./etc/shorewall/masq (/etc/shorewall/snat) and Multi-ISP</title>
|
<title>./etc/shorewall/masq and Multi-ISP</title>
|
||||||
|
|
||||||
<para>If you masquerade a local network, you will need to add masquerade
|
<para>If you masquerade a local network, you will need to add masquerade
|
||||||
rules for both external interfaces. Referring to the diagram above, if
|
rules for both external interfaces. Referring to the diagram above, if
|
||||||
@@ -786,13 +786,6 @@ fi</programlisting>
|
|||||||
eth0 0.0.0.0/0 206.124.146.176
|
eth0 0.0.0.0/0 206.124.146.176
|
||||||
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.176) 0.0.0.0/0 eth0
|
|
||||||
SNAT(130252.99.27) 0.0.0.0/0 eth1</programlisting>
|
|
||||||
|
|
||||||
<para>If you have a public subnet (for example 206.124.146.176/30)
|
<para>If you have a public subnet (for example 206.124.146.176/30)
|
||||||
behind your firewall, then use exclusion:</para>
|
behind your firewall, then use exclusion:</para>
|
||||||
|
|
||||||
@@ -800,12 +793,6 @@ SNAT(130252.99.27) 0.0.0.0/0 eth1</programlisting>
|
|||||||
eth0 !206.124.146.176/29 206.124.146.176
|
eth0 !206.124.146.176/29 206.124.146.176
|
||||||
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
||||||
|
|
||||||
<para>The equivalent <filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.176) !206.124.146.176/29 eth0
|
|
||||||
SNAT(130.252.99.27) 0.0.0.0/0 eth1</programlisting>
|
|
||||||
|
|
||||||
<para>Note that exclusion is only used on the interface corresponding to
|
<para>Note that exclusion is only used on the interface corresponding to
|
||||||
internal subnetwork.</para>
|
internal subnetwork.</para>
|
||||||
|
|
||||||
@@ -814,10 +801,10 @@ SNAT(130.252.99.27) 0.0.0.0/0 eth1</programlisting>
|
|||||||
contains all of those addresses from being masqueraded.</para>
|
contains all of those addresses from being masqueraded.</para>
|
||||||
|
|
||||||
<warning>
|
<warning>
|
||||||
<para>Entries in <filename>/etc/shorewall/masq</filename>
|
<para>Entries in <filename>/etc/shorewall/masq</filename> have no
|
||||||
(<filename>/etc/shorewall/snat</filename>) have no effect on which ISP
|
effect on which ISP a particular connection will be sent through. That
|
||||||
a particular connection will be sent through. That is rather the
|
is rather the purpose of entries in
|
||||||
purpose of entries in <filename>/etc/shorewall/mangle</filename> and
|
<filename>/etc/shorewall/mangle</filename> and
|
||||||
<filename>/etc/shorewall/rtrules</filename>.</para>
|
<filename>/etc/shorewall/rtrules</filename>.</para>
|
||||||
</warning>
|
</warning>
|
||||||
</section>
|
</section>
|
||||||
@@ -843,8 +830,7 @@ Feb 9 17:23:45 gw.ilinx kernel: ll header: 00:a0:24:2a:1f:72:00:13:5f:07:97:05:
|
|||||||
206.124.146.176. Another gotcha is that the incoming packet has already
|
206.124.146.176. Another gotcha is that the incoming packet has already
|
||||||
had the destination IP address changed for DNAT or because the original
|
had the destination IP address changed for DNAT or because the original
|
||||||
outgoing connection was altered by an entry in
|
outgoing connection was altered by an entry in
|
||||||
<filename>/etc/shorewall/masq</filename> or
|
<filename>/etc/shorewall/masq</filename> (SNAT or Masquerade). So the
|
||||||
<filename>/etc/shorewall/snat</filename> (SNAT or Masquerade). So the
|
|
||||||
destination IP address (206.124.146.176) may not have been the
|
destination IP address (206.124.146.176) may not have been the
|
||||||
destination IP address in the packet as it was initially
|
destination IP address in the packet as it was initially
|
||||||
received.</para>
|
received.</para>
|
||||||
@@ -940,7 +926,7 @@ eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Example2">
|
<section id="Example2">
|
||||||
<title id="Example99">Example using USE_DEFAULT_RT=Yes</title>
|
<title id="Example99"> Example using USE_DEFAULT_RT=Yes</title>
|
||||||
|
|
||||||
<para>This section shows the differences in configuring the above
|
<para>This section shows the differences in configuring the above
|
||||||
example with USE_DEFAULT_RT=Yes. The changes are confined to the
|
example with USE_DEFAULT_RT=Yes. The changes are confined to the
|
||||||
@@ -974,13 +960,6 @@ net net DROP</programlisting>
|
|||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SOURCE ADDRESS
|
||||||
eth0 0.0.0.0/0 206.124.146.176
|
eth0 0.0.0.0/0 206.124.146.176
|
||||||
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
eth1 0.0.0.0/0 130.252.99.27</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.176) 0.0.0.0/0 eth0
|
|
||||||
SNAT(130.252.99.27) 0.0.0.0/0 eth1</programlisting>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Applications">
|
<section id="Applications">
|
||||||
@@ -1071,8 +1050,7 @@ DNAT net loc:192.168.1.3 tcp 25 <
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>For each external interface, you need to add an entry to
|
<para>For each external interface, you need to add an entry to
|
||||||
<filename>/etc/shorewall/masq</filename>
|
<filename>/etc/shorewall/masq</filename>.</para>
|
||||||
(<filename>/etc/shorewall/snat</filename>).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
|
|
||||||
@@ -1088,14 +1066,6 @@ ISP3 3 3 main eth3 16.105.78.254 track,ba
|
|||||||
eth0 0.0.0.0/0 206.124.146.176
|
eth0 0.0.0.0/0 206.124.146.176
|
||||||
eth1 0.0.0.0/0 130.252.99.27
|
eth1 0.0.0.0/0 130.252.99.27
|
||||||
eth3 0.0.0.0/0 16.105.78.4</programlisting></para>
|
eth3 0.0.0.0/0 16.105.78.4</programlisting></para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.176) 0.0.0.0/0 eth0
|
|
||||||
SNAT(130.252.99.27) 0.0.0.0/0 eth1
|
|
||||||
SNAT(16.105.78.4) 0.0.0.0/0 eth2</programlisting>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="rtrules">
|
<section id="rtrules">
|
||||||
@@ -1967,8 +1937,8 @@ if [ $2 != down ]; then
|
|||||||
[ -f /var/lib/shorewall/eth0.info ] && . /var/lib/shorewall/eth0.info
|
[ -f /var/lib/shorewall/eth0.info ] && . /var/lib/shorewall/eth0.info
|
||||||
|
|
||||||
if [ "$GATEWAYS" != "$ETH0_GATEWAY" -o "$IPADDR" != "$ETH0_ADDRESS" ]; then
|
if [ "$GATEWAYS" != "$ETH0_GATEWAY" -o "$IPADDR" != "$ETH0_ADDRESS" ]; then
|
||||||
logger -p daemon.info "eth0 IP configuration changed - restarting foolsm and Shorewall"
|
logger -p daemon.info "eth0 IP configuration changed - restarting lsm and Shorewall"
|
||||||
killall foolsm
|
killall lsm
|
||||||
/sbin/shorewall restart
|
/sbin/shorewall restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -1983,9 +1953,9 @@ fi
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>It assumes the use of <link linkend="lsm">FOOLSM</link>;
|
<para>It assumes the use of <link linkend="lsm">LSM</link>; If
|
||||||
If you aren't using foolsm, you can change the log message and
|
you aren't using lSM, you can change the log message and remove
|
||||||
remove the 'killall foolsm'</para>
|
the 'killall lsm'</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -2120,9 +2090,9 @@ ComcastC 2 - - eth0 detect loose,fallback,load=0.33
|
|||||||
<section id="LinkMonitor">
|
<section id="LinkMonitor">
|
||||||
<title>Gateway Monitoring and Failover</title>
|
<title>Gateway Monitoring and Failover</title>
|
||||||
|
|
||||||
<para>There is an option (FOOLSM) available for monitoring the status of
|
<para>There is an option (LSM) available for monitoring the status of
|
||||||
provider links and taking action when a failure occurs. FOOLSM assumes
|
provider links and taking action when a failure occurs. LSM assumes that
|
||||||
that each provider has a unique nexthop gateway.</para>
|
each provider has a unique nexthop gateway.</para>
|
||||||
|
|
||||||
<para>You specify the <option>optional</option> option in
|
<para>You specify the <option>optional</option> option in
|
||||||
<filename>/etc/shorewall/interfaces</filename>:</para>
|
<filename>/etc/shorewall/interfaces</filename>:</para>
|
||||||
@@ -2132,7 +2102,7 @@ net eth0 detect <emphasis role="bold">optional</emphasis>
|
|||||||
net eth1 detect <emphasis role="bold">optional</emphasis></programlisting>
|
net eth1 detect <emphasis role="bold">optional</emphasis></programlisting>
|
||||||
|
|
||||||
<section id="lsm">
|
<section id="lsm">
|
||||||
<title>Link Status Monitor (FOOLSM)</title>
|
<title>Link Status Monitor (LSM)</title>
|
||||||
|
|
||||||
<para><ulink url="http://lsm.foobar.fi/">Link Status Monitor</ulink>
|
<para><ulink url="http://lsm.foobar.fi/">Link Status Monitor</ulink>
|
||||||
was written by Mika Ilmaranta <ilmis at nullnet.fi> and performs
|
was written by Mika Ilmaranta <ilmis at nullnet.fi> and performs
|
||||||
@@ -2146,25 +2116,19 @@ net eth1 detect <emphasis role="bold">optional</emphasis><
|
|||||||
file</ulink>) before installing LSM.</para>
|
file</ulink>) before installing LSM.</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<important>
|
<para>Like many Open Source products, LSM is poorly documented. It's
|
||||||
<para>To avoid an achronym clash with <emphasis>Linux Security
|
main configuration file is normally kept in
|
||||||
Module</emphasis>, the Link Status Monitor is now called
|
<filename>/etc/lsm/lsm.conf</filename>, but the file's name is passed
|
||||||
<emphasis>foolsm</emphasis>.</para>
|
as an argument to the lsm program so you can name it anything you
|
||||||
</important>
|
want.</para>
|
||||||
|
|
||||||
<para>Like many Open Source products, FOOLSM is poorly documented.
|
<para>The sample <filename>lsm.conf</filename> included with the
|
||||||
It's main configuration file is normally kept in
|
|
||||||
<filename>/etc/foolsm/foolsm.conf</filename>, but the file's name is
|
|
||||||
passed as an argument to the foolsm program so you can name it
|
|
||||||
anything you want.</para>
|
|
||||||
|
|
||||||
<para>The sample <filename>foolsm.conf</filename> included with the
|
|
||||||
product shows some of the possibilities for configuration. One feature
|
product shows some of the possibilities for configuration. One feature
|
||||||
that is not mentioned in the sample is that an "include" directive is
|
that is not mentioned in the sample is that an "include" directive is
|
||||||
supported. This allows additional files to be sourced in from the main
|
supported. This allows additional files to be sourced in from the main
|
||||||
configuration file.</para>
|
configuration file.</para>
|
||||||
|
|
||||||
<para>FOOLSM monitors the status of the links defined in its
|
<para>LSM monitors the status of the links defined in its
|
||||||
configuration file and runs a user-provided script when the status of
|
configuration file and runs a user-provided script when the status of
|
||||||
a link changes. The script name is specified in the
|
a link changes. The script name is specified in the
|
||||||
<firstterm>eventscript</firstterm> option in the configuration file.
|
<firstterm>eventscript</firstterm> option in the configuration file.
|
||||||
@@ -2211,33 +2175,33 @@ net eth1 detect <emphasis role="bold">optional</emphasis><
|
|||||||
|
|
||||||
<para>It is the responsibility of the script to perform any action
|
<para>It is the responsibility of the script to perform any action
|
||||||
needed in reaction to the connection state change. The default script
|
needed in reaction to the connection state change. The default script
|
||||||
supplied with FOOLSM composes an email and sends it to $5.</para>
|
supplied with LSM composes an email and sends it to $5.</para>
|
||||||
|
|
||||||
<para>I personally use FOOLSM here at shorewall.net (configuration is
|
<para>I personally use LSM here at shorewall.net (configuration is
|
||||||
described <link linkend="Complete">below</link>). I have set things up
|
described <link linkend="Complete">below</link>). I have set things up
|
||||||
so that:</para>
|
so that:</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shorewall [re]starts foolsm during processing of the
|
<para>Shorewall [re]starts lsm during processing of the
|
||||||
<command>start</command> and <command>restore</command> commands.
|
<command>start</command> and <command>restore</command> commands.
|
||||||
I don't have Shorewall restart foolsm during Shorewall
|
I don't have Shorewall restart lsm during Shorewall
|
||||||
<command>restart</command> because I restart Shorewall much more
|
<command>restart</command> because I restart Shorewall much more
|
||||||
often than the average user is likely to do.</para>
|
often than the average user is likely to do.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shorewall starts foolsm because I have a dynamic IP address
|
<para>Shorewall starts lsm because I have a dynamic IP address
|
||||||
from one of my providers (Comcast); Shorewall detects the default
|
from one of my providers (Comcast); Shorewall detects the default
|
||||||
gateway to that provider and creates a secondary configuration
|
gateway to that provider and creates a secondary configuration
|
||||||
file (<filename>/etc/foolsm/shorewall.conf</filename>) that
|
file (<filename>/etc/lsm/shorewall.conf</filename>) that contains
|
||||||
contains the link configurations. That file is included by
|
the link configurations. That file is included by
|
||||||
<filename>/etc/foolsm/foolsm.conf</filename>.</para>
|
<filename>/etc/lsm/lsm.conf</filename>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The script run by FOOLSM during state change
|
<para>The script run by LSM during state change
|
||||||
(<filename>/etc/foolsm/script) </filename>writes a<filename>
|
(<filename>/etc/lsm/script) </filename>writes a<filename>
|
||||||
${VARDIR}/xxx.status</filename> file when the status of an
|
${VARDIR}/xxx.status</filename> file when the status of an
|
||||||
interface changes. Those files are read by the
|
interface changes. Those files are read by the
|
||||||
<filename>isusable</filename> extension script (see below).</para>
|
<filename>isusable</filename> extension script (see below).</para>
|
||||||
@@ -2260,7 +2224,7 @@ COM_IF=eth1</programlisting>
|
|||||||
|
|
||||||
<programlisting>local status=0
|
<programlisting>local status=0
|
||||||
#
|
#
|
||||||
# Read the status file (if any) created by /etc/foolsm/script
|
# Read the status file (if any) created by /etc/lsm/script
|
||||||
#
|
#
|
||||||
[ -f ${VARDIR}/${1}.status ] && status=$(cat ${VARDIR}/${1}.status)
|
[ -f ${VARDIR}/${1}.status ] && status=$(cat ${VARDIR}/${1}.status)
|
||||||
|
|
||||||
@@ -2269,22 +2233,22 @@ return $status</programlisting>
|
|||||||
<para><filename>/etc/shorewall/lib.private</filename>:</para>
|
<para><filename>/etc/shorewall/lib.private</filename>:</para>
|
||||||
|
|
||||||
<programlisting>###############################################################################
|
<programlisting>###############################################################################
|
||||||
# Create /etc/foolsm/shorewall.conf
|
# Create /etc/lsm/shorewall.conf
|
||||||
# Remove the current interface status files
|
# Remove the current interface status files
|
||||||
# Start foolsm
|
# Start lsm
|
||||||
###############################################################################
|
###############################################################################
|
||||||
start_foolsm() {
|
start_lsm() {
|
||||||
#
|
#
|
||||||
# Kill any existing foolsm process(es)
|
# Kill any existing lsm process(es)
|
||||||
#
|
#
|
||||||
killall foolsm 2> /dev/null
|
killall lsm 2> /dev/null
|
||||||
#
|
#
|
||||||
# Create the Shorewall-specific part of the FOOLSM configuration. This file is
|
# Create the Shorewall-specific part of the LSM configuration. This file is
|
||||||
# included by /etc/foolsm/foolsm.conf
|
# included by /etc/lsm/lsm.conf
|
||||||
#
|
#
|
||||||
# Avvanta has a static gateway while Comcast's is dynamic
|
# Avvanta has a static gateway while Comcast's is dynamic
|
||||||
#
|
#
|
||||||
cat <<EOF > /etc/foolsm/shorewall.conf
|
cat <<EOF > /etc/lsm/shorewall.conf
|
||||||
connection {
|
connection {
|
||||||
name=Avvanta
|
name=Avvanta
|
||||||
checkip=206.124.146.254
|
checkip=206.124.146.254
|
||||||
@@ -2300,9 +2264,14 @@ connection {
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
#
|
#
|
||||||
# Run FOOLSM -- by default, it forks into the background
|
# Since LSM assumes that interfaces start in the 'up' state, remove any
|
||||||
|
# existing status files that might have an interface in the down state
|
||||||
#
|
#
|
||||||
/usr/sbin/foolsm -c /etc/foolsm/foolsm.conf >> /var/log/foolsm
|
rm -f /var/lib/shorewall/*.status
|
||||||
|
#
|
||||||
|
# Run LSM -- by default, it forks into the background
|
||||||
|
#
|
||||||
|
/usr/sbin/lsm -c /etc/lsm/lsm.conf >> /var/log/lsm
|
||||||
}</programlisting>
|
}</programlisting>
|
||||||
|
|
||||||
<para>eth0 has a dynamic IP address so I need to use the
|
<para>eth0 has a dynamic IP address so I need to use the
|
||||||
@@ -2317,22 +2286,22 @@ EOF
|
|||||||
<para><filename>/etc/shorewall/started</filename>:</para>
|
<para><filename>/etc/shorewall/started</filename>:</para>
|
||||||
|
|
||||||
<programlisting>##################################################################################
|
<programlisting>##################################################################################
|
||||||
# [re]start foolsm if this is a 'start' command or if foolsm isn't running
|
# [re]start lsm if this is a 'start' command or if lsm isn't running
|
||||||
##################################################################################
|
##################################################################################
|
||||||
if [ "$COMMAND" = start -o -z "$(ps ax | grep 'foolsm ' | grep -v 'grep ' )" ]; then
|
if [ "$COMMAND" = start -o -z "$(ps ax | grep 'lsm ' | grep -v 'grep ' )" ]; then
|
||||||
start_foolsm
|
start_lsm
|
||||||
fi</programlisting>
|
fi</programlisting>
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/restored</filename>:</para>
|
<para><filename>/etc/shorewall/restored</filename>:</para>
|
||||||
|
|
||||||
<programlisting>##################################################################################
|
<programlisting>##################################################################################
|
||||||
# Start foolsm if it isn't running
|
# Start lsm if it isn't running
|
||||||
##################################################################################
|
##################################################################################
|
||||||
if [ -z "$(ps ax | grep 'foolsm ' | grep -v 'grep ' )" ]; then
|
if [ -z "$(ps ax | grep 'lsm ' | grep -v 'grep ' )" ]; then
|
||||||
start_foolsm
|
start_lsm
|
||||||
fi</programlisting>
|
fi</programlisting>
|
||||||
|
|
||||||
<para><filename>/etc/foolsm/foolsm.conf</filename>:</para>
|
<para><filename>/etc/lsm/lsm.conf</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#
|
<programlisting>#
|
||||||
# Defaults for the connection entries
|
# Defaults for the connection entries
|
||||||
@@ -2340,7 +2309,7 @@ fi</programlisting>
|
|||||||
defaults {
|
defaults {
|
||||||
name=defaults
|
name=defaults
|
||||||
checkip=127.0.0.1
|
checkip=127.0.0.1
|
||||||
eventscript=/etc/foolsm/script
|
eventscript=/etc/lsm/script
|
||||||
max_packet_loss=20
|
max_packet_loss=20
|
||||||
max_successive_pkts_lost=7
|
max_successive_pkts_lost=7
|
||||||
min_packet_loss=5
|
min_packet_loss=5
|
||||||
@@ -2353,11 +2322,10 @@ defaults {
|
|||||||
ttl=0
|
ttl=0
|
||||||
}
|
}
|
||||||
|
|
||||||
include /etc/foolsm/shorewall.conf</programlisting>
|
include /etc/lsm/shorewall.conf</programlisting>
|
||||||
|
|
||||||
<para><filename>/etc/foolsm/script</filename> (Shorewall 4.4.23 and
|
<para><filename>/etc/lsm/script</filename> (Shorewall 4.4.23 and later
|
||||||
later - note that this script must be executable by
|
- note that this script must be executable by root)<programlisting>#!/bin/sh
|
||||||
root)<programlisting>#!/bin/sh
|
|
||||||
#
|
#
|
||||||
# (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
|
# (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
|
||||||
# (C) 2009 Tom Eastep <teastep@shorewall.net>
|
# (C) 2009 Tom Eastep <teastep@shorewall.net>
|
||||||
@@ -2414,7 +2382,7 @@ cons_wait = ${CONS_WAIT} consecutive packets waiting for reply
|
|||||||
cons_miss = ${CONS_MISS} consecutive packets that have timed out
|
cons_miss = ${CONS_MISS} consecutive packets that have timed out
|
||||||
avg_rtt = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
|
avg_rtt = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
|
||||||
|
|
||||||
Your FOOLSM Daemon
|
Your LSM Daemon
|
||||||
|
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
@@ -2426,7 +2394,7 @@ else
|
|||||||
${VARDIR}/firewall disable ${DEVICE}
|
${VARDIR}/firewall disable ${DEVICE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$TOOL show routing >> /var/log/foolsm
|
$TOOL show routing >> /var/log/lsm
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@@ -2489,7 +2457,7 @@ cons_wait = ${CONS_WAIT} consecutive packets waiting for reply
|
|||||||
cons_miss = ${CONS_MISS} consecutive packets that have timed out
|
cons_miss = ${CONS_MISS} consecutive packets that have timed out
|
||||||
avg_rtt = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
|
avg_rtt = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
|
||||||
|
|
||||||
Your FOOLSM Daemon
|
Your LSM Daemon
|
||||||
|
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
@@ -2498,9 +2466,9 @@ EOM
|
|||||||
# [ ${STATE} = up ] && state=0 || state=1
|
# [ ${STATE} = up ] && state=0 || state=1
|
||||||
# echo $state > ${VARDIR}/${DEVICE}.status
|
# echo $state > ${VARDIR}/${DEVICE}.status
|
||||||
|
|
||||||
<emphasis role="bold">$TOOL restart -f >> /var/log/foolsm 2>&1</emphasis>
|
<emphasis role="bold">$TOOL restart -f >> /var/log/lsm 2>&1</emphasis>
|
||||||
|
|
||||||
$TOOL show routing >> /var/log/foolsm
|
$TOOL show routing >> /var/log/lsm
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@@ -2528,9 +2496,8 @@ exit 0
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Entries in <filename>/etc/shorewall/masq</filename> and
|
<para>Entries in <filename>/etc/shorewall/masq</filename> must be
|
||||||
<filename>/etc/shorewall/snat</filename> must be qualified by the
|
qualified by the provider name (or number).</para>
|
||||||
provider name (or number).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -349,12 +349,6 @@ loc eth0:192.168.1.0/24 maclist</programlisting>
|
|||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SOURCE ADDRESS
|
||||||
eth0:!192.168.1.0/24 192.168.1.0/24</programlisting>
|
eth0:!192.168.1.0/24 192.168.1.0/24</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
MASQUERADE 0.0.0.0/0 eth0:!192.168.1.0/24</programlisting>
|
|
||||||
|
|
||||||
<para>Note that the <emphasis role="bold">maclist</emphasis> option is
|
<para>Note that the <emphasis role="bold">maclist</emphasis> option is
|
||||||
specified in <filename>/etc/shorewall/interfaces</filename>. This is to
|
specified in <filename>/etc/shorewall/interfaces</filename>. This is to
|
||||||
help protect your router from unauthorized access by your friends and
|
help protect your router from unauthorized access by your friends and
|
||||||
|
@@ -79,8 +79,7 @@
|
|||||||
|
|
||||||
<para>Be sure that the internal system(s) (10.1.1.2 and 10.1.1.3 in the
|
<para>Be sure that the internal system(s) (10.1.1.2 and 10.1.1.3 in the
|
||||||
above example) is (are) not included in any specification in
|
above example) is (are) not included in any specification in
|
||||||
<filename>/etc/shorewall/masq</filename>
|
<filename>/etc/shorewall/masq</filename> or
|
||||||
(<filename>/etc/shorewall/snat</filename>) or
|
|
||||||
<filename>/etc/shorewall/proxyarp</filename>.</para>
|
<filename>/etc/shorewall/proxyarp</filename>.</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
|
@@ -311,10 +311,9 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The source IP address may be rewritten according to an entry in
|
<para>The source IP address may be rewritten according to an entry in
|
||||||
the <filename>/etc/shorewall/masq</filename> or
|
the <filename>/etc/shorewall/masq</filename> file. If this is a new
|
||||||
<filename>/etc/shorewall/snat</filename> file (Shorewall 5.0.14 or
|
connection request, then the rewriting occurs in a
|
||||||
later). If this is a new connection request, then the rewriting occurs
|
<emphasis>nat</emphasis> table chain called <emphasis
|
||||||
in a <emphasis>nat</emphasis> table chain called <emphasis
|
|
||||||
role="bold"><emphasis>interface</emphasis>_masq</emphasis> where
|
role="bold"><emphasis>interface</emphasis>_masq</emphasis> where
|
||||||
<emphasis>interface</emphasis> is the interface on which the packet
|
<emphasis>interface</emphasis> is the interface on which the packet
|
||||||
will be sent. For packets that are part of an already established
|
will be sent. For packets that are part of an already established
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
</caution>
|
</caution>
|
||||||
|
|
||||||
<important>
|
<important>
|
||||||
<para>/etc/shorewall/mangle superseded /etc/shorewall/tcrules in Shorewall
|
<para>/etc/shorewall/mangle superseded /etc/shorewall/tcruels in Shorewall
|
||||||
4.6.0. /etc/shorwall/tcrules is still supported but its use is
|
4.6.0. /etc/shorwall/tcrules is still supported but its use is
|
||||||
deprecated.</para>
|
deprecated.</para>
|
||||||
</important>
|
</important>
|
||||||
|
@@ -98,8 +98,7 @@
|
|||||||
|
|
||||||
<para><emphasis role="bold">Be sure that the internal systems
|
<para><emphasis role="bold">Be sure that the internal systems
|
||||||
(130.242.100.18 and 130.252.100.19 in the above example) are not included
|
(130.242.100.18 and 130.252.100.19 in the above example) are not included
|
||||||
in any specification in <filename>/etc/shorewall/masq</filename>
|
in any specification in <filename>/etc/shorewall/masq</filename> or
|
||||||
(/etc/shorewall/snat on Shorewall 5.0.14 or later) or
|
|
||||||
<filename>/etc/shorewall/nat</filename>.</emphasis></para>
|
<filename>/etc/shorewall/nat</filename>.</emphasis></para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
|
@@ -301,8 +301,8 @@
|
|||||||
|
|
||||||
<para>COMMENT, FORMAT and SECTION Lines now require the leading question
|
<para>COMMENT, FORMAT and SECTION Lines now require the leading question
|
||||||
mark ("?"). In earlier releases, the question mark was optional. The
|
mark ("?"). In earlier releases, the question mark was optional. The
|
||||||
<command>shorewall[6] update -D</command> command in Shorewall 4.6 will
|
<command>shorewall[6] update -D</command> command will insert the
|
||||||
insert the question marks for you.</para>
|
question marks for you.</para>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@
|
|||||||
|
|
||||||
<para>It is strongly recommended that you first upgrade your installation
|
<para>It is strongly recommended that you first upgrade your installation
|
||||||
to a 4.6 release that supports the <option>-A</option> option to the
|
to a 4.6 release that supports the <option>-A</option> option to the
|
||||||
<command>update</command> command; 4.6.13.2 or later is preferred.</para>
|
<command>update</command> command; 4.6.13 is preferred.</para>
|
||||||
|
|
||||||
<para>Once you are on that release, execute the <command>shorewall update
|
<para>Once you are on that release, execute the <command>shorewall update
|
||||||
-A</command> command (and <command>shorewall6 update -A</command> if you
|
-A</command> command (and <command>shorewall6 update -A</command> if you
|
||||||
@@ -374,11 +374,11 @@
|
|||||||
likely won't start or work correctly until you do.</para>
|
likely won't start or work correctly until you do.</para>
|
||||||
|
|
||||||
<para>The <command>update</command> command in Shorewall 5 has many fewer
|
<para>The <command>update</command> command in Shorewall 5 has many fewer
|
||||||
options. The <option>-b</option>, <option>-t</option>,
|
options. The <option>-b</option>, <option>-t</option>, <option>-n</option>
|
||||||
<option>-n</option>, <option>-D</option> and <option>-s </option>options
|
and <option>-s </option>options have been removed -- the updates triggered
|
||||||
have been removed -- the updates triggered by those options are now
|
by those options are now performed unconditionally. The <option>-i
|
||||||
performed unconditionally. The <option>-i </option>and <option>-A
|
</option>and <option>-A </option>options have been retained - both enable
|
||||||
</option>options have been retained - both enable checking for issues that
|
checking for issues that could result if INLINE_MATCHES were to be set to
|
||||||
could result if INLINE_MATCHES were to be set to Yes.</para>
|
Yes.</para>
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
@@ -200,22 +200,10 @@ DNAT net loc:192.168.1.3:22 tcp 10000 - 20
|
|||||||
<programlisting>#INTERFACE SUBNET ADDRESS
|
<programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
eth0 192.168.1.0/24 206.124.146.178</programlisting>
|
eth0 192.168.1.0/24 206.124.146.178</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.178) 0.0.0.0/0 eth0</programlisting>
|
|
||||||
|
|
||||||
<para>Similarly, you want SMTP traffic from local system 192.168.1.22 to
|
<para>Similarly, you want SMTP traffic from local system 192.168.1.22 to
|
||||||
have source IP 206.124.146.178:<programlisting>#INTERFACE SUBNET ADDRESS PROTO DPORT
|
have source IP 206.124.146.178:<programlisting>#INTERFACE SUBNET ADDRESS PROTO DPORT
|
||||||
eth0 192.168.1.22 206.124.146.178 tcp 25</programlisting></para>
|
eth0 192.168.1.22 206.124.146.178 tcp 25</programlisting></para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.178) 0.0.0.0/0 eth0 tcp 25</programlisting>
|
|
||||||
|
|
||||||
<para>Shorewall can create the alias (additional address) for you if you
|
<para>Shorewall can create the alias (additional address) for you if you
|
||||||
set ADD_SNAT_ALIASES=Yes in
|
set ADD_SNAT_ALIASES=Yes in
|
||||||
<filename>/etc/shorewall/shorewall.con</filename>f.</para>
|
<filename>/etc/shorewall/shorewall.con</filename>f.</para>
|
||||||
@@ -232,29 +220,16 @@ SNAT(206.124.146.178) 0.0.0.0/0 eth0 tcp 25</programli
|
|||||||
the INTERFACE column as follows.</para>
|
the INTERFACE column as follows.</para>
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/masq</filename><programlisting>#INTERFACE SUBNET ADDRESS
|
<para><filename>/etc/shorewall/masq</filename><programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
eth0:0 192.168.1.0/24 206.124.146.178</programlisting></para>
|
eth0:0 192.168.1.0/24 206.124.146.178</programlisting>Shorewall
|
||||||
|
can also set up SNAT to round-robin over a range of IP addresses. To do
|
||||||
|
that, you specify a range of IP addresses in the ADDRESS column. If you
|
||||||
|
specify a label in the INTERFACE column, Shorewall will use that label
|
||||||
|
for the first address of the range and will increment the label by one
|
||||||
|
for each subsequent label.</para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
<para><filename>/etc/shorewall/masq</filename><programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.178) 192.168.1.0/24 eth0</programlisting>
|
|
||||||
|
|
||||||
<para>Shorewall can also set up SNAT to round-robin over a range of IP
|
|
||||||
addresses. To do that, you specify a range of IP addresses in the
|
|
||||||
ADDRESS column. If you specify a label in the INTERFACE column,
|
|
||||||
Shorewall will use that label for the first address of the range and
|
|
||||||
will increment the label by one for each subsequent label.</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/masq</filename><programlisting>#INTERFACE SOURCE ADDRESS
|
|
||||||
eth0:0 192.168.1.0/24 206.124.146.178-206.124.146.180</programlisting></para>
|
eth0:0 192.168.1.0/24 206.124.146.178-206.124.146.180</programlisting></para>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(206.124.146.178-206.24.146.80) 192.168.1.0/24 eth0</programlisting>
|
|
||||||
|
|
||||||
<para>The above would create three IP addresses:</para>
|
<para>The above would create three IP addresses:</para>
|
||||||
|
|
||||||
<programlisting>eth0:0 = 206.124.146.178
|
<programlisting>eth0:0 = 206.124.146.178
|
||||||
|
@@ -145,11 +145,5 @@ loc <emphasis role="bold">br0</emphasis> <emphasis
|
|||||||
|
|
||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SOURCE ADDRESS
|
||||||
eth0 10.0.1.0/24 ... # 10.0.1.0/24 is the local network on LAN A and LAN B</programlisting>
|
eth0 10.0.1.0/24 ... # 10.0.1.0/24 is the local network on LAN A and LAN B</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
MASQUERADE 10.0.1.0/24 eth0</programlisting>
|
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
<section id="Intro">
|
<section id="Intro">
|
||||||
<title>Introduction</title>
|
<title>Introduction</title>
|
||||||
|
|
||||||
<para>Shorewall supports two different types of blacklisting; rule-based,
|
<para>Shorewall supports two different types of blackliisting; rule-based,
|
||||||
static and dynamic. The BLACKLIST option in /etc/shorewall/shorewall.conf
|
static and dynamic. The BLACKLIST option in /etc/shorewall/shorewall.conf
|
||||||
controls the degree of blacklist filtering.</para>
|
controls the degree of blacklist filtering.</para>
|
||||||
|
|
||||||
|
@@ -102,9 +102,12 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Your kernel must contain Netfilter physdev match support
|
<para>Your kernel must contain Netfilter physdev match support
|
||||||
(CONFIG_IP_NF_MATCH_PHYSDEV=m or CONFIG_IP_NF_MATCH_PHYSDEV=y).
|
(CONFIG_IP_NF_MATCH_PHYSDEV=m or CONFIG_IP_NF_MATCH_PHYSDEV=y).
|
||||||
Physdev match is standard in the 2.6 and later kernel series but must
|
Physdev match is standard in the 2.6 kernel series but must be patched
|
||||||
be patched into the 2.4 kernels (see <ulink
|
into the 2.4 kernels (see <ulink
|
||||||
url="http://bridge.sf.net">http://bridge.sf.net</ulink>).</para>
|
url="http://bridge.sf.net">http://bridge.sf.net</ulink>). Bering and
|
||||||
|
Bering uCLibc users must find and install ipt_physdev.o for their
|
||||||
|
distribution and add <quote>ipt_physdev</quote> to
|
||||||
|
/etc/modules.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2001-2016</year>
|
<year>2001-2013</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
</articleinfo>
|
</articleinfo>
|
||||||
|
|
||||||
<caution>
|
<caution>
|
||||||
<para><emphasis role="bold">This article applies to Shorewall 5.0 and
|
<para><emphasis role="bold">This article applies to Shorewall 4.3 and
|
||||||
later. If you are running a version of Shorewall earlier than Shorewall
|
later. If you are running a version of Shorewall earlier than Shorewall
|
||||||
5.0.0 then please see the documentation for that
|
4.3.5 then please see the documentation for that
|
||||||
release.</emphasis></para>
|
release.</emphasis></para>
|
||||||
</caution>
|
</caution>
|
||||||
|
|
||||||
@@ -774,17 +774,6 @@ DNAT net loc:10.0.0.1 tcp 80 ; mark="88"</pro
|
|||||||
<programlisting>{ action=>DNAT, source=>net, dest=>loc:10.0.0.1, proto=>tcp, dport=>80, mark=>88 }
|
<programlisting>{ action=>DNAT, source=>net, dest=>loc:10.0.0.1, proto=>tcp, dport=>80, mark=>88 }
|
||||||
; action:"DNAT" source:"net" dest:"loc:10.0.0.1" proto:"tcp" dport:"80" mark:"88"
|
; action:"DNAT" source:"net" dest:"loc:10.0.0.1" proto:"tcp" dport:"80" mark:"88"
|
||||||
DNAT { source=net dest=loc:10.0.0.1 proto=tcp dport=80 mark=88 }</programlisting>
|
DNAT { source=net dest=loc:10.0.0.1 proto=tcp dport=80 mark=88 }</programlisting>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.11, ip[6]table comments can be attached
|
|
||||||
to individual rules using the <option>comment</option> keyword.</para>
|
|
||||||
|
|
||||||
<para>Example from the rules file:</para>
|
|
||||||
|
|
||||||
<programlisting> ACCEPT net $FW { proto=tcp, dport=22, comment="Accept \"SSH\"" }</programlisting>
|
|
||||||
|
|
||||||
<para>As shown in that example, when the comment contains whitespace, it
|
|
||||||
must be enclosed in double quotes and any embedded double quotes must be
|
|
||||||
escaped using a backslash ("\").</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
@@ -1382,10 +1371,6 @@ SSH(ACCEPT) net:$MYIP $FW
|
|||||||
?COMMENT line in the rules file and the generated rule will show <emphasis
|
?COMMENT line in the rules file and the generated rule will show <emphasis
|
||||||
role="bold">/* Allow SSH from home */</emphasis> when displayed through
|
role="bold">/* Allow SSH from home */</emphasis> when displayed through
|
||||||
the Shorewall show and dump commands.</para>
|
the Shorewall show and dump commands.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.11, the <link linkend="Pairs">alternate
|
|
||||||
input format </link>allows attaching comments to individual rules in the
|
|
||||||
files listed above.</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="CONFIG_PATH">
|
<section id="CONFIG_PATH">
|
||||||
@@ -1654,20 +1639,6 @@ SSH(ACCEPT) net:$MYIP $FW
|
|||||||
<section id="AddressVariables">
|
<section id="AddressVariables">
|
||||||
<title>Address Variables</title>
|
<title>Address Variables</title>
|
||||||
|
|
||||||
<caution>
|
|
||||||
<para>Prior to Shorewall 5.0.14, if you use address variables that refer
|
|
||||||
to an optional interface, the <command>enable</command> command will not
|
|
||||||
change/insert the rules that use the variable. Therefore, to be
|
|
||||||
completely safe, if you use such address variables then you must follow
|
|
||||||
a successful <command>enable</command> command with a
|
|
||||||
<command>reload</command> command.</para>
|
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.14, if a Shorewall-defined address
|
|
||||||
variable's value has changed since the Netfilter ruleset was
|
|
||||||
instantiated, then a successful <command>enable</command> command will
|
|
||||||
automatically reload the ruleset.</para>
|
|
||||||
</caution>
|
|
||||||
|
|
||||||
<para>Given that shell variables are expanded at compile time, there is no
|
<para>Given that shell variables are expanded at compile time, there is no
|
||||||
way to cause such variables to be expanded at run time. Prior to Shorewall
|
way to cause such variables to be expanded at run time. Prior to Shorewall
|
||||||
4.4.17, this made it difficult (to impossible) to include dynamic IP
|
4.4.17, this made it difficult (to impossible) to include dynamic IP
|
||||||
@@ -1897,8 +1868,9 @@ SSH(ACCEPT) net:$MYIP $FW
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>If there is no gateway out of the named interface, rules containing
|
<para>If there is no gateway out of the named interface, the nil IP
|
||||||
the intefaces's run-time gateway variable are omitted.</para>
|
address is used (0.0.0.0 in IPv4 and :: in IPv6). That way, the generated
|
||||||
|
rule will match no packets (or all packets if used with exclusion).</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="ActionVariables">
|
<section id="ActionVariables">
|
||||||
@@ -2632,13 +2604,6 @@ DNAT net loc:192.168.1.3 tcp <emphasis role="bold">4000:4100<
|
|||||||
<para>Also, unless otherwise documented, a port range can be preceded by
|
<para>Also, unless otherwise documented, a port range can be preceded by
|
||||||
'!' to specify "All ports except those in this range" (e.g.,
|
'!' to specify "All ports except those in this range" (e.g.,
|
||||||
"!4000:4100").</para>
|
"!4000:4100").</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.14, a hyphen ("-") may also be used to
|
|
||||||
separate the two port numbers; when using service names, the colon must
|
|
||||||
still be used.</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DESTINATION PROTO DPORT
|
|
||||||
DNAT net loc:192.168.1.3 tcp <emphasis role="bold">4000-4100</emphasis></programlisting>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="Portlists">
|
<section id="Portlists">
|
||||||
@@ -2820,182 +2785,6 @@ redirect => 137</programlisting>
|
|||||||
above.</para>
|
above.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="TIME">
|
|
||||||
<title>TIME Columns</title>
|
|
||||||
|
|
||||||
<para>Several of the files include a TIME colum that allows you to specify
|
|
||||||
times when the rule is to be applied. Contents of this column is a list of
|
|
||||||
<replaceable>timeelement</replaceable>s separated by apersands
|
|
||||||
(&).</para>
|
|
||||||
|
|
||||||
<para>Each <replaceable>timeelement</replaceable> is one of the
|
|
||||||
following:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>timestart=<replaceable>hh</replaceable>:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the starting time of day.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>timestop=<replaceable>hh</replaceable>:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the ending time of day.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>contiguous</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shoreawll 5.0.12. When <emphasis
|
|
||||||
role="bold">timestop</emphasis> is smaller than <emphasis
|
|
||||||
role="bold">timestart</emphasis> value, match this as a single time
|
|
||||||
period instead of distinct intervals. See the Examples below.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>utc</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Times are expressed in Greenwich Mean Time.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>localtz</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Deprecated by the Netfilter team in favor of <emphasis
|
|
||||||
role="bold">kerneltz</emphasis>. Times are expressed in Local Civil
|
|
||||||
Time (default).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>kerneltz</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 4.5.2. Times are expressed in Local Kernel
|
|
||||||
Time (requires iptables 1.4.12 or later).</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>weekdays=ddd[,ddd]...</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <replaceable>ddd</replaceable> is one of
|
|
||||||
<option>Mon</option>, <option>Tue</option>, <option>Wed</option>,
|
|
||||||
<option>Thu</option>, <option>Fri</option>, <option>Sat</option> or
|
|
||||||
<option>Sun</option></para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>monthdays=dd[,dd],...</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>where <replaceable>dd</replaceable> is an ordinal day of the
|
|
||||||
month</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>datestart=<replaceable>yyyy</replaceable>[-<replaceable>mm</replaceable>[-<replaceable>dd</replaceable>[<option>T</option><replaceable>hh</replaceable>[:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]]]]]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the starting date and time.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>datestop=<replaceable>yyyy</replaceable>[-<replaceable>mm</replaceable>[-<replaceable>dd</replaceable>[<option>T</option><replaceable>hh</replaceable>[:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]]]]]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Defines the ending date and time.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
<para>Examples:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term>To match on weekends, use:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
|
|
||||||
<para>weekdays=Sat,Sun</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Or, to match (once) on a national holiday block:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
|
|
||||||
<para>datestart=2016-12-24&datestop=2016-12-27</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Since the stop time is actually inclusive, you would need the
|
|
||||||
following stop time to not match the first second of the new
|
|
||||||
day:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
|
|
||||||
<para>datestart=2016-12-24T17:00&datestop=2016-12-27T23:59:59</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>During Lunch Hour</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>The fourth Friday in the month:</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
|
|
||||||
<para>weekdays=Fri&monthdays=22,23,24,25,26,27,28</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>Matching across days might not do what is expected. For
|
|
||||||
instance,</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para/>
|
|
||||||
|
|
||||||
<para>weekdays=Mon&timestart=23:00&timestop=01:00</para>
|
|
||||||
|
|
||||||
<para>Will match Monday, for one hour from midnight to 1 a.m., and
|
|
||||||
then again for another hour from 23:00 onwards. If this is unwanted,
|
|
||||||
e.g. if you would like 'match for two hours from Montay 23:00
|
|
||||||
onwards' you need to also specify the <emphasis
|
|
||||||
role="bold">contiguous</emphasis> option in the example
|
|
||||||
above.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="Switches">
|
<section id="Switches">
|
||||||
<title>Switches</title>
|
<title>Switches</title>
|
||||||
|
|
||||||
@@ -3138,8 +2927,8 @@ Comcast 2 0x20000 main <emphasis role="bold">COM_IF</emphasis>
|
|||||||
role="bold">optional</emphasis> option in the OPTIONS column.</para>
|
role="bold">optional</emphasis> option in the OPTIONS column.</para>
|
||||||
|
|
||||||
<para>When an interface is marked as optional, Shorewall will determine
|
<para>When an interface is marked as optional, Shorewall will determine
|
||||||
the interface state at <command>start</command>, <command>reload</command>
|
the interface state at <command>start</command> and
|
||||||
and <command>restart</command> and adjust its configuration
|
<command>restart</command> and adjust its configuration
|
||||||
accordingly.</para>
|
accordingly.</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
@@ -3192,13 +2981,13 @@ Comcast 2 0x20000 main <emphasis role="bold">COM_IF</emphasis>
|
|||||||
|
|
||||||
<para>Shorewall allows you to have configuration directories other than
|
<para>Shorewall allows you to have configuration directories other than
|
||||||
<filename class="directory">/etc/shorewall</filename>. The shorewall
|
<filename class="directory">/etc/shorewall</filename>. The shorewall
|
||||||
<command>check</command>, <command>start</command>,
|
<command>check</command>, <command>start</command> and
|
||||||
<command>reload</command> and <command>restart</command> commands allow
|
<command>restart</command> commands allow you to specify an alternate
|
||||||
you to specify an alternate configuration directory and Shorewall will use
|
configuration directory and Shorewall will use the files in the alternate
|
||||||
the files in the alternate directory rather than the corresponding files
|
directory rather than the corresponding files in /etc/shorewall. The
|
||||||
in /etc/shorewall. The alternate directory need not contain a complete
|
alternate directory need not contain a complete configuration; those files
|
||||||
configuration; those files not in the alternate directory will be read
|
not in the alternate directory will be read from <filename
|
||||||
from <filename class="directory">/etc/shorewall</filename>.<important>
|
class="directory">/etc/shorewall</filename>.<important>
|
||||||
<para>Shorewall requires that the file
|
<para>Shorewall requires that the file
|
||||||
<filename>/etc/shorewall/shorewall.conf</filename> to always exist.
|
<filename>/etc/shorewall/shorewall.conf</filename> to always exist.
|
||||||
Certain global settings are always obtained from that file. If you
|
Certain global settings are always obtained from that file. If you
|
||||||
|
@@ -13,20 +13,14 @@
|
|||||||
|
|
||||||
<surname>Eastep</surname>
|
<surname>Eastep</surname>
|
||||||
</author>
|
</author>
|
||||||
|
|
||||||
<author>
|
|
||||||
<surname>Bill Shirley</surname>
|
|
||||||
</author>
|
|
||||||
</authorgroup>
|
</authorgroup>
|
||||||
|
|
||||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2001 - 2016</year>
|
<year>2001 - 2015</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
|
|
||||||
<holder>Bill Shirley</holder>
|
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<legalnotice>
|
<legalnotice>
|
||||||
@@ -245,9 +239,9 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
|
|
||||||
<para>If your kernel has NFLOG target support (and most vendor-supplied
|
<para>If your kernel has ULOG target support (and most vendor-supplied
|
||||||
kernels do), you may also specify a log level of NFLOG (must be all
|
kernels do), you may also specify a log level of ULOG (must be all
|
||||||
caps). When NFLOG is used, Shorewall will direct Netfilter to log the
|
caps). When ULOG is used, Shorewall will direct Netfilter to log the
|
||||||
related messages via the ULOG target which will send them to a process
|
related messages via the ULOG target which will send them to a process
|
||||||
called <quote>ulogd</quote>. The ulogd program is included in most
|
called <quote>ulogd</quote>. The ulogd program is included in most
|
||||||
distributions and is also available from <ulink
|
distributions and is also available from <ulink
|
||||||
@@ -256,7 +250,7 @@
|
|||||||
file.</para>
|
file.</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>The NFLOG logging mechanism is <emphasis
|
<para>The ULOG logging mechanism is <emphasis
|
||||||
role="underline">completely separate</emphasis> from syslog. Once you
|
role="underline">completely separate</emphasis> from syslog. Once you
|
||||||
switch to ULOG, the settings in <filename>/etc/syslog.conf</filename>
|
switch to ULOG, the settings in <filename>/etc/syslog.conf</filename>
|
||||||
have absolutely no effect on your Shorewall logging (except for
|
have absolutely no effect on your Shorewall logging (except for
|
||||||
@@ -265,11 +259,11 @@
|
|||||||
|
|
||||||
<para>You will need to change all instances of log levels (usually
|
<para>You will need to change all instances of log levels (usually
|
||||||
<quote>info</quote>) in your Shorewall configuration files to
|
<quote>info</quote>) in your Shorewall configuration files to
|
||||||
<quote>NFLOG</quote> - this includes entries in the policy, rules and
|
<quote>ULOG</quote> - this includes entries in the policy, rules and
|
||||||
shorewall.conf files. Here's what I had at one time:</para>
|
shorewall.conf files. Here's what I had at one time:</para>
|
||||||
|
|
||||||
<programlisting>gateway:/etc/shorewall# grep -v ^\# * | egrep '\$LOG|ULOG|LOGFILE'
|
<programlisting>gateway:/etc/shorewall# grep -v ^\# * | egrep '\$LOG|ULOG|LOGFILE'
|
||||||
params:LOG=NFOG
|
params:LOG=ULOG
|
||||||
policy:loc $FW REJECT $LOG
|
policy:loc $FW REJECT $LOG
|
||||||
policy:net all DROP $LOG 10/sec:40
|
policy:net all DROP $LOG 10/sec:40
|
||||||
policy:all all REJECT $LOG
|
policy:all all REJECT $LOG
|
||||||
@@ -293,12 +287,13 @@ gateway:/etc/shorewall# </programl
|
|||||||
<quote><command>logwatch</command></quote> and
|
<quote><command>logwatch</command></quote> and
|
||||||
<quote><command>dump</command></quote> commands.</para>
|
<quote><command>dump</command></quote> commands.</para>
|
||||||
|
|
||||||
<para>The NFLOG target is a successor to ULOG. Both ULOG and NFLOG may
|
<para>The NFLOG target, a successor to ULOG, is supported shorewall.
|
||||||
be followed by a list of up to three numbers in parentheses.</para>
|
Both ULOG and NFLOG may be followed by a list of up to three numbers in
|
||||||
|
parentheses.</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The first number specifies the netlink group (0-65535). If
|
<para>The first number specifies the netlink group (0-32). If
|
||||||
omitted (e.g., NFLOG(,0,10)) then a value of 0 is assumed.</para>
|
omitted (e.g., NFLOG(,0,10)) then a value of 0 is assumed.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
@@ -347,11 +342,6 @@ stack=log:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,firewall:
|
|||||||
[firewall]
|
[firewall]
|
||||||
file="/var/log/firewall"
|
file="/var/log/firewall"
|
||||||
sync=1</programlisting>
|
sync=1</programlisting>
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>This sample config file assumes that NFLOG is being used in
|
|
||||||
logging rules and policies.</para>
|
|
||||||
</note>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -469,32 +459,9 @@ sync=1</programlisting>
|
|||||||
<para>By setting the LOGTAGONLY option to Yes in <ulink
|
<para>By setting the LOGTAGONLY option to Yes in <ulink
|
||||||
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> or <ulink
|
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> or <ulink
|
||||||
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>, the
|
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>, the
|
||||||
disposition ('DROP' in the above example) will be omitted. Consider the
|
disposition ('DROP' in the above example) will be omitted. See the
|
||||||
following rule:</para>
|
shorewall[6].conf man page for further information about how
|
||||||
|
LOGTAGONLY=Yes can be used.</para>
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO
|
|
||||||
REJECT(icmp-proto-unreachable):notice:IPv6 loc net 41 # who's using IPv6 tunneling</programlisting>
|
|
||||||
|
|
||||||
<para>This rule generates the following warning at compile time:</para>
|
|
||||||
|
|
||||||
<simplelist>
|
|
||||||
<member>WARNING: Log Prefix shortened to "Shorewall:IPv6:REJECT(icmp-p
|
|
||||||
" /etc/shorewall/rules (line 212)</member>
|
|
||||||
</simplelist>
|
|
||||||
|
|
||||||
<para>and produces the rather ugly prefix "Shorewall:IPv6:REJECT(icmp-p
|
|
||||||
".</para>
|
|
||||||
|
|
||||||
<para>Now consider this similar rule:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO
|
|
||||||
REJECT(icmp-proto-unreachable):notice:IPv6,tunneling loc net 41 # who's using IPv6 tunneling</programlisting>
|
|
||||||
|
|
||||||
<para>With LOGTAGONLY=Yes, no warning is generated and the prefix
|
|
||||||
becomes "Shorewall:IPv6:tunneling:"</para>
|
|
||||||
|
|
||||||
<para>See the shorewall[6].conf man page for further information about
|
|
||||||
how LOGTAGONLY=Yes can be used.</para>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
@@ -503,77 +470,9 @@ REJECT(icmp-proto-unreachable):notice:IPv6,tunneling loc net
|
|||||||
<para><ulink
|
<para><ulink
|
||||||
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> and <ulink
|
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> and <ulink
|
||||||
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink> have a
|
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink> have a
|
||||||
number of options whose values are log levels. Beginning with Shorewall
|
number of options whose values are log levels. Beginnint with Shorewall
|
||||||
5.0.0, these specifcations may include a log tag as described <link
|
5.0.0, these specifcations may include a log tag as described <link
|
||||||
linkend="LogTags">above</link>.</para>
|
linkend="LogTags">above</link>.</para>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
|
||||||
<title>Some Additional Thoughts on Logging (by Bill Shirley)</title>
|
|
||||||
|
|
||||||
<para>As a side note to the LOGTAGONLY example above, i recommend blocking
|
|
||||||
all tunneling because it bypasses the firewall rules:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT
|
|
||||||
?COMMENT tunneling
|
|
||||||
REJECT(icmp-proto-unreachable):notice:IPv6,tunneling loc net 41 # who's using IPv6 tunneling
|
|
||||||
REJECT(icmp-port-unreachable) loc net tcp,udp teredo
|
|
||||||
REJECT(icmp-port-unreachable) loc net tcp,udp isakmp,ipsec-nat-t</programlisting>
|
|
||||||
|
|
||||||
<para>Here is an example of logging traffic only once:</para>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/init:</filename></para>
|
|
||||||
|
|
||||||
<programlisting>ipset -exist create IPv4 hash:ip timeout 86400
|
|
||||||
ipset -exist create IPv4-port hash:ip,port timeout 14400</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/rules</filename> (at the top):</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO
|
|
||||||
?SECTION NEW
|
|
||||||
# ------------------
|
|
||||||
?COMMENT drop previously flagged
|
|
||||||
DROP net:+IPv4[src] fw
|
|
||||||
DROP net:+IPv4-port[src,dst] fw</programlisting>
|
|
||||||
|
|
||||||
<para>After all the rules have been checked, at the bottom of
|
|
||||||
<filename>/etc/shorewall/rules</filename>:</para>
|
|
||||||
|
|
||||||
<programlisting># =============================================================================
|
|
||||||
# =============================== H@ck0rz =====================================
|
|
||||||
# =============================================================================
|
|
||||||
?COMMENT dont whack myself
|
|
||||||
REJECT:notice inet:$ME_NET fw
|
|
||||||
|
|
||||||
?COMMENT not public
|
|
||||||
ADD(+IPv4-port:src,dst) net fw tcp,udp domain
|
|
||||||
ADD(+IPv4-port:src,dst) net fw tcp ldap,ldaps
|
|
||||||
ADD(+IPv4-port:src,dst) net fw tcp,udp ipp
|
|
||||||
|
|
||||||
?COMMENT H@ck0rz
|
|
||||||
ADD(+IPv4:src) net fw tcp ssh
|
|
||||||
ADD(+IPv4:src) net fw tcp ftp,ftps,sftp,telnet,telnets,exec,login,shell,sunrpc
|
|
||||||
ADD(+IPv4:src) net fw tcp,udp ms-sql-s,ms-sql-m
|
|
||||||
|
|
||||||
?COMMENT drop if added
|
|
||||||
DROP:info:BAN,IPv4 net:+IPv4[src] fw
|
|
||||||
DROP:info:BAN,IPv4-port net:+IPv4-port[src,dst] fw</programlisting>
|
|
||||||
|
|
||||||
<para>One final note: I wanted less firewall messages in /var/log/messages
|
|
||||||
so I added to rsyslog.conf:</para>
|
|
||||||
|
|
||||||
<programlisting>#### RULES #### <-- find this
|
|
||||||
if $msg contains 'Shorewall' then {
|
|
||||||
action(type="omfile" file="/var/log/shorewall.log")
|
|
||||||
# if ($syslogfacility == 0 and $syslogseverity >= 4) then stop # warning
|
|
||||||
# if ($syslogfacility == 0 and $syslogseverity >= 5) then stop # notice
|
|
||||||
if ($syslogfacility == 0 and $syslogseverity >= 6) then stop # info
|
|
||||||
}</programlisting>
|
|
||||||
|
|
||||||
<para> I log at 'notice' log level if I want the message in
|
|
||||||
<filename>/var/log/messages</filename> and everything goes to
|
|
||||||
<filename>/var/log/shorewall.log</filename>. Don't forget to add
|
|
||||||
/var/log/shorewall.log to logrotate. </para>
|
|
||||||
</section>
|
|
||||||
</article>
|
</article>
|
||||||
|
@@ -1373,20 +1373,12 @@ Destination Gateway Genmask Flags MSS Window irtt Iface
|
|||||||
|
|
||||||
<member>SNAT is configured in Shorewall using the <filename><ulink
|
<member>SNAT is configured in Shorewall using the <filename><ulink
|
||||||
url="manpages/shorewall-masq.html">/etc/shorewall/masq</ulink></filename>
|
url="manpages/shorewall-masq.html">/etc/shorewall/masq</ulink></filename>
|
||||||
file (<ulink
|
file.</member>
|
||||||
url="manpages/shorewall-snat.html">/etc/shorewall/snat</ulink> when
|
|
||||||
running Shorewall 5.0.14 or later):</member>
|
|
||||||
</simplelist>
|
</simplelist>
|
||||||
|
|
||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(192.0.2.176) 192.168.201.0/24 eth0</programlisting>
|
|
||||||
|
|
||||||
<para>This example used the normal technique of assigning the same
|
<para>This example used the normal technique of assigning the same
|
||||||
public IP address for the firewall external interface and for SNAT. If
|
public IP address for the firewall external interface and for SNAT. If
|
||||||
you wanted to use a different IP address, you would either have to use
|
you wanted to use a different IP address, you would either have to use
|
||||||
@@ -1600,15 +1592,9 @@ DNAT net loc:192.168.201.4 tcp www</programlisting>
|
|||||||
connections. This is done with the following entry in
|
connections. This is done with the following entry in
|
||||||
<filename>/etc/shorewall/masq</filename>:</para>
|
<filename>/etc/shorewall/masq</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#INTERFACE SOURCE ADDRESS
|
<programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(192.0.2.176) 192.168.201.0/24 eth0</programlisting>
|
|
||||||
|
|
||||||
<para><inlinegraphic fileref="images/BD21298_.gif"/></para>
|
<para><inlinegraphic fileref="images/BD21298_.gif"/></para>
|
||||||
|
|
||||||
<para>Suppose now that you have decided to give your daughter her own
|
<para>Suppose now that you have decided to give your daughter her own
|
||||||
@@ -1830,12 +1816,6 @@ dmz eth2</programlisting>
|
|||||||
<programlisting>#INTERFACE SUBNET ADDRESS
|
<programlisting>#INTERFACE SUBNET ADDRESS
|
||||||
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
eth0 192.168.201.0/29 192.0.2.176</programlisting>
|
||||||
|
|
||||||
<para>When running Shorewall 5.0.14 or later, the equivalent
|
|
||||||
<filename>/etc/shorewall/snat</filename> is:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO PORT
|
|
||||||
SNAT(192.02.176) 192.168.201.0/24 eth0</programlisting>
|
|
||||||
|
|
||||||
<para><filename>/etc/shorewall/proxyarp</filename> - DMZ</para>
|
<para><filename>/etc/shorewall/proxyarp</filename> - DMZ</para>
|
||||||
|
|
||||||
<programlisting>#ADDRESS EXTERNAL INTERFACE HAVE ROUTE
|
<programlisting>#ADDRESS EXTERNAL INTERFACE HAVE ROUTE
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user