Compare commits

..

12 Commits

Author SHA1 Message Date
Tom Eastep
d9e992b164 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code
Conflicts:
	Shorewall/Perl/Shorewall/Config.pm
2016-07-25 07:33:04 -07:00
Tom Eastep
372359839b Add 'comment' to alternative input
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-07-24 15:08:55 -07:00
Tom Eastep
40dea5f597 Add 'comment' to alternative input
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-07-19 15:43:40 -07:00
Tom Eastep
4a6338d857 Correct/complete Scott Sumate's LOGFILE enhancement
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-07-15 14:25:02 -07:00
Scott Shumate
55ee0113ea Added support for systemd logging by configuring LOGFILE=systemd 2016-07-15 13:40:23 -05:00
Tom Eastep
65d5249bd8 Link to Digimer's article on Shorewall/REL7
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-07-07 12:44:28 -07:00
Roberto C. Sánchez
0364c15be1 Fix typos, thanks to Marco Di Cerbo for reporting them 2016-07-06 08:46:32 -04:00
Roberto C. Sánchez
76b2b0de78 Debian init script: fix name of force-reload target (Closes: #830110) 2016-07-06 08:43:21 -04:00
Roberto C. Sánchez
7c9876241c Debian init scripts: add run-level 1 to Default-Stop specification 2016-07-04 17:37:00 -04:00
Roberto C. Sánchez
8b36c2c1cf Debian init scripts: more accurately describe what action is being taken 2016-07-04 13:34:33 -04:00
Tom Eastep
a02c745a83 Avoid silly duplicate rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-06-30 17:49:43 -07:00
Tom Eastep
094fd8129c Update copyright and version info in the config basics doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-06-25 12:11:34 -07:00
14 changed files with 117 additions and 31 deletions

View File

@@ -191,6 +191,8 @@ setup_logread() {
else else
g_logread="logread" g_logread="logread"
fi fi
elif [ "$LOGFILE" = "systemd" ]; then
g_logread="journalctl -r"
elif [ -r $LOGFILE ]; then elif [ -r $LOGFILE ]; then
if qt mywhich tac; then if qt mywhich tac; then
g_logread="tac $LOGFILE" g_logread="tac $LOGFILE"

View File

@@ -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 6 # Default-Stop: 0 1 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

View File

@@ -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 6 # Default-Stop: 0 1 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,10 +92,11 @@ 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

View File

@@ -577,6 +577,7 @@ 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
@@ -731,6 +732,7 @@ sub initialize( $;$$) {
# Contents of last COMMENT line. # Contents of last COMMENT line.
# #
$comment = ''; $comment = '';
$sr_comment = '';
$warningcount = 0; $warningcount = 0;
# #
# Misc Globals # Misc Globals
@@ -2156,6 +2158,47 @@ 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
# #
@@ -2225,6 +2268,8 @@ 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.
@@ -2248,6 +2293,8 @@ 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
# #
@@ -2354,18 +2401,37 @@ sub split_line2( $$;$$$ ) {
$pairs =~ s/^\s*//; $pairs =~ s/^\s*//;
$pairs =~ s/\s*$//; $pairs =~ s/\s*$//;
my @pairs = split( /,?\s+/, $pairs ); my @pairs = split_list4( $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};
$column = $columnsref->{$column}; if ( $value =~ /"$/ ) {
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/; fatal_error "Invalid value ( $value )" unless $value =~ /^"(.*)"$/;
$value = $1 if $value =~ /^"([^"]+)"$/; $value = $1;
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:]]/;
$line[$column] = $value; if ( $column eq 'comment' ) {
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;
}
} }
} }
@@ -2395,6 +2461,7 @@ sub no_comment() {
sub clear_comment() { sub clear_comment() {
$comment = ''; $comment = '';
$nocomment = 0; $nocomment = 0;
$sr_comment = '';
} }
# #
@@ -2490,7 +2557,8 @@ sub push_include() {
$max_format, $max_format,
$comment, $comment,
$nocomment, $nocomment,
$section_function ]; $section_function,
$sr_comment ];
} }
# #
@@ -2514,7 +2582,8 @@ sub pop_include() {
$max_format, $max_format,
$comment, $comment,
$nocomment, $nocomment,
$section_function ) = @$arrayref; $section_function,
$sr_comment ) = @$arrayref;
} else { } else {
$currentfile = undef; $currentfile = undef;
$currentlinenumber = 'EOF'; $currentlinenumber = 'EOF';
@@ -2883,6 +2952,7 @@ 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( 'Yes', "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
} }
@@ -3236,6 +3306,7 @@ 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 );
} }

View File

@@ -2170,7 +2170,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, 1 ); add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref, 0 );
progress_message " Host \"$currentline\" validated"; progress_message " Host \"$currentline\" validated";

View File

@@ -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 6 # Default-Stop: 0 1 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,10 +97,11 @@ 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
@@ -145,7 +146,7 @@ case "$1" in
restart) restart)
shorewall_restart shorewall_restart
;; ;;
force0reload|reload) force-reload|reload)
shorewall_reload shorewall_reload
;; ;;
status) status)

View File

@@ -1354,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>]</term> role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</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
@@ -1364,7 +1364,10 @@ 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>.</para> url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.
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>

View File

@@ -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 6 # Default-Stop: 0 1 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,10 +92,11 @@ 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

View File

@@ -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 6 # Default-Stop: 0 1 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,10 +97,11 @@ 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

View File

@@ -1166,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>]</term> role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</term>
<listitem> <listitem>
<para>This parameter tells the /sbin/shorewall6 program where to <para>This parameter tells the /sbin/shorewall6 program where to
@@ -1175,7 +1175,9 @@ 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.</para> assumed. 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>

View File

@@ -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 fireawall.</para> create an IPv6 firewall.</para>
</listitem> </listitem>
<listitem> <listitem>

View File

@@ -26,6 +26,8 @@
<year>2011</year> <year>2011</year>
<year>2016</year>
<holder>Thomas M. Eastep</holder> <holder>Thomas M. Eastep</holder>
</copyright> </copyright>
@@ -89,7 +91,9 @@
<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</para> acting as a firewall/router for a small local network. For
Redhat-specific install/configure information, see <ulink url="???">this
article </ulink>contributed by Digimer.</para>
</listitem> </listitem>
<listitem> <listitem>

View File

@@ -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 fireawall.</para> create an IPv6 firewall.</para>
</listitem> </listitem>
<listitem> <listitem>

View File

@@ -18,7 +18,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate> <pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright> <copyright>
<year>2001-2013</year> <year>2001-2016</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 4.3 and <para><emphasis role="bold">This article applies to Shorewall 5.0 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
4.3.5 then please see the documentation for that 5.0.0 then please see the documentation for that
release.</emphasis></para> release.</emphasis></para>
</caution> </caution>