From 1477d60926fc8d433ec2349fd68c12d09f99e779 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 12 Apr 2012 18:56:36 -0700 Subject: [PATCH 01/10] Correct the output of 'version -a' Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 4b462ca8e..c583ec334 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -562,8 +562,8 @@ version_command() { echo "shorewall-core: $(cat $g_sharedir/coreversion)" for product in shorewall shorewall6 shorewall-lite shorewall6-lite shorewall-init; do - if [ -f $g_sharedir/version ]; then - echo "$product: $(cat $g_sharedir/version)" + if [ -f ${SHAREDIR}/$product/version ]; then + echo "$product: $(cat ${SHAREDIR}/$product/version)" fi done else From 79b5c38ecb28c7d50254b861e63adad337208428 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 14 Apr 2012 10:14:25 -0700 Subject: [PATCH 02/10] Handle trailing whitespace in Shorewall::Config::read_a_line1() Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 485da6348..9543b87ae 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -2269,8 +2269,9 @@ sub read_a_line1() { while ( $currentline = <$currentfile> ) { next if $currentline =~ /^\s*#/; chomp $currentline; - next if $currentline =~ /^\s*$/; $currentline =~ s/#.*$//; # Remove Trailing Comments + $currentline =~ s/\s*$//; # Remove Trailing Whitespace + next if $currentline =~ /^\s*$/; fatal_error "Non-ASCII gunk in file" if $currentline =~ /[^\s[:print:]]/; $currentlinenumber = $.; print "IN===> $currentline\n" if $debug; From d3943ea0fe3189e710312acac360dad750add581 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 14 Apr 2012 11:17:27 -0700 Subject: [PATCH 03/10] Install correct Makefile Signed-off-by: Tom Eastep --- Shorewall/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 7a47f7ccd..8dc1c6885 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -961,7 +961,9 @@ run_install $OWNERSHIP -m 0644 Makefile-lite ${DESTDIR}${SHAREDIR}/$PRODUCT/conf [ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile if [ -z "$SPARSE" ]; then - run_install $OWNERSHIP -m 0600 ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile ${DESTDIR}${CONFDIR}/$PRODUCT + run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT + [ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile + [ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile" fi # From fdc4a84a83332bb25e212b558a31467b88393b33 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 14 Apr 2012 11:36:08 -0700 Subject: [PATCH 04/10] Delete code to modify Makefile Signed-off-by: Tom Eastep --- Shorewall/install.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 8dc1c6885..a73e57215 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -957,13 +957,9 @@ echo "Standard actions file installed as ${DESTDIR}${SHAREDIR}d/$PRODUCT/actions # Install the Makefiles # run_install $OWNERSHIP -m 0644 Makefile-lite ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/Makefile -[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile -[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/Makefile if [ -z "$SPARSE" ]; then run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT - [ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile - [ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile" fi # From baa1a2983b508432c40ede14241964bfa11a652d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 14 Apr 2012 11:38:13 -0700 Subject: [PATCH 05/10] Fix redhat PERLLIBDIR. Signed-off-by: Tom Eastep --- Shorewall-core/shorewallrc.redhat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shorewall-core/shorewallrc.redhat b/Shorewall-core/shorewallrc.redhat index 851f1d0c0..ad47167f8 100644 --- a/Shorewall-core/shorewallrc.redhat +++ b/Shorewall-core/shorewallrc.redhat @@ -6,7 +6,7 @@ HOST=redhat PREFIX=/usr #Top-level directory for shared files, libraries, etc. SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. LIBEXECDIR=${PREFIX}/libexec #Directory for executable scripts. -PERLLIBDIR=/usr/share/perl5 #Directory to install Shorewall Perl module directory +PERLLIBDIR=/usr/share/perl5/vendor_perl #Directory to install Shorewall Perl module directory CONFDIR=/etc #Directory where subsystem configurations are installed SBINDIR=/sbin #Directory where system administration programs are installed MANDIR=${SHAREDIR}/man #Directory where manpages are installed. From a32ce5c34ae2ce225efbed91ec2496bab3fdd359 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 14 Apr 2012 12:01:37 -0700 Subject: [PATCH 06/10] Correct Makefiles Signed-off-by: Tom Eastep --- Shorewall-lite/Makefile | 4 ++-- Shorewall/Makefile | 4 ++-- Shorewall6-lite/Makefile | 4 ++-- Shorewall6/Makefile | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Shorewall-lite/Makefile b/Shorewall-lite/Makefile index 591d5fa11..8c27979e0 100644 --- a/Shorewall-lite/Makefile +++ b/Shorewall-lite/Makefile @@ -3,9 +3,9 @@ VARDIR=$(shell /sbin/shorewall-lite show vardir) SHAREDIR=/usr/share/shorewall-lite RESTOREFILE?=.restore -all: $(VARDIR)/${RESTOREFILE} +all: $(VARDIR)/$(RESTOREFILE) -$(VARDIR)/${RESTOREFILE}: $(VARDIR)/firewall +$(VARDIR)/$(RESTOREFILE): $(VARDIR)/firewall @/sbin/shorewall-lite -q save >/dev/null; \ if \ /sbin/shorewall-lite -q restart >/dev/null 2>&1; \ diff --git a/Shorewall/Makefile b/Shorewall/Makefile index 80f511dfa..e5ba97e18 100644 --- a/Shorewall/Makefile +++ b/Shorewall/Makefile @@ -3,9 +3,9 @@ VARDIR=$(shell /sbin/shorewall show vardir) CONFDIR=/etc/shorewall RESTOREFILE?=firewall -all: $(VARDIR)/${RESTOREFILE} +all: $(VARDIR)/$(RESTOREFILE) -$(VARDIR)/${RESTOREFILE}: $(CONFDIR)/* +$(VARDIR)/$(RESTOREFILE): $(CONFDIR)/* @/sbin/shorewall -q save >/dev/null; \ if \ /sbin/shorewall -q restart >/dev/null 2>&1; \ diff --git a/Shorewall6-lite/Makefile b/Shorewall6-lite/Makefile index a7a8ba78e..604ab514d 100644 --- a/Shorewall6-lite/Makefile +++ b/Shorewall6-lite/Makefile @@ -3,9 +3,9 @@ VARDIR=$(shell /sbin/shorewall6-lite show vardir) SHAREDIR=/usr/share/shorewall6-lite RESTOREFILE?=.restore -all: $(VARDIR)/${RESTOREFILE} +all: $(VARDIR)/$(RESTOREFILE) -$(VARDIR)/${RESTOREFILE}: $(VARDIR)/firewall +$(VARDIR)/$(RESTOREFILE): $(VARDIR)/firewall @/sbin/shorewall6-lite -q save >/dev/null; \ if \ /sbin/shorewall6-lite -q restart >/dev/null 2>&1; \ diff --git a/Shorewall6/Makefile b/Shorewall6/Makefile index a05377601..35e09d070 100644 --- a/Shorewall6/Makefile +++ b/Shorewall6/Makefile @@ -3,9 +3,9 @@ VARDIR=$(shell /sbin/shorewall6 show vardir) CONFDIR=/etc/shorewall6 RESTOREFILE?=firewall -all: $(VARDIR)/${RESTOREFILE} +all: $(VARDIR)/$(RESTOREFILE) -$(VARDIR)/${RESTOREFILE}: $(CONFDIR)/* +$(VARDIR)/$(RESTOREFILE): $(CONFDIR)/* @/sbin/shorewall6 -q save >/dev/null; \ if \ /sbin/shorewall6 -q restart >/dev/null 2>&1; \ From 1462fcd351eae59871f434fef0d7235e9e4b9f13 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 15 Apr 2012 09:43:41 -0700 Subject: [PATCH 07/10] Synchronize global settings Signed-off-by: Tom Eastep --- Shorewall-core/lib.base | 1 + Shorewall-core/lib.cli | 6 ++++-- Shorewall/install.sh | 6 ++++++ Shorewall/shorewall | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Shorewall-core/lib.base b/Shorewall-core/lib.base index 7e5ed63a4..bb4cbeb16 100644 --- a/Shorewall-core/lib.base +++ b/Shorewall-core/lib.base @@ -41,6 +41,7 @@ if [ -z "$g_readrc" ]; then g_libexec="$LIBEXECDIR" g_sharedir="$SHAREDIR"/$g_program g_sbindir="$SBINDIR" + g_perllib="$PERLLIBDIR" g_vardir="$VARDIR" g_confdir="$CONFDIR"/$g_program g_readrc=1 diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index c583ec334..38fad2de5 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -31,9 +31,11 @@ if [ -z "$g_readrc" ]; then . /usr/share/shorewall/shorewallrc g_libexec="$LIBEXECDIR" - g_sbindir="$SBINDIR" - g_confdir="$CONFDIR"/$g_program g_sharedir="$SHAREDIR"/$g_program + g_sbindir="$SBINDIR" + g_perllib="$PERLLIBDIR" + g_vardir="$VARDIR" + g_confdir="$CONFDIR"/$g_program g_readrc=1 fi diff --git a/Shorewall/install.sh b/Shorewall/install.sh index a73e57215..dad48cc12 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -249,6 +249,12 @@ OWNERSHIP="-o $OWNER -g $GROUP" # if [ $PRODUCT = shorewall -a -z "${DESTDIR}" ]; then + # + # Fix up 'use Digest::' if SHA is installed + # + if perl -e 'use Digest::SHA;' 2> /dev/null ; then + sed -i 's/Digest::SHA1/Digest::SHA/' Perl/Shorewall/Chains.pm + fi # # Verify that Perl is installed # diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 3fb3f1522..a2f081428 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -36,6 +36,7 @@ g_libexec="$LIBEXECDIR" g_sharedir="$SHAREDIR"/shorewall g_sbindir="$SBINDIR" g_perllib="$PERLLIBDIR" +g_vardir="$VARDIR" g_confdir="$CONFDIR"/shorewall g_readrc=1 From 9d219445d9f764f6a3ba1b46a49beef08cbd3cb1 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 16 Apr 2012 11:40:36 -0700 Subject: [PATCH 08/10] Make 'show routing work with iproute 20111117 Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 38fad2de5..6dd835d6a 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -456,16 +456,26 @@ sort_routes() { done | sort -r | while read dest rest; do echo $rest; done } +# +# Isolate the table in the routing rules being read from stdin +# +find_tables() { + sed -r 's/[[:space:]]+$//' | while read rule; do + echo ${rule##* } + done +} + # # Show routing configuration # show_routing() { + local rule + local table + if [ -n "$(ip -$g_family rule list)" ]; then heading "Routing Rules" ip -$g_family rule list - ip -$g_family rule list | while read rule; do - echo ${rule##* } - done | sort -u | while read table; do + ip -$g_family rule list | find_tables | sort -u | while read table; do heading "Table $table:" if [ $g_family -eq 6 ]; then ip -$g_family -o route list table $table | fgrep -v cache From 5a350d189971ff95ce4322a10ed38eae45fcb56f Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 16 Apr 2012 11:40:49 -0700 Subject: [PATCH 09/10] More variable synchronization Signed-off-by: Tom Eastep --- Shorewall-lite/shorewall-lite | 1 + Shorewall6-lite/shorewall6-lite | 2 +- Shorewall6/shorewall6 | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Shorewall-lite/shorewall-lite b/Shorewall-lite/shorewall-lite index 4ca3b3f58..1db8395dd 100755 --- a/Shorewall-lite/shorewall-lite +++ b/Shorewall-lite/shorewall-lite @@ -35,6 +35,7 @@ g_program=shorewall-lite g_libexec="$LIBEXECDIR" g_sharedir="$SHAREDIR"/shorewall-lite g_sbindir="$SBINDIR" +g_vardir="$VARDIR" g_confdir="$CONFDIR"/shorewall-lite g_readrc=1 diff --git a/Shorewall6-lite/shorewall6-lite b/Shorewall6-lite/shorewall6-lite index 688d1ec34..8f18b48b7 100755 --- a/Shorewall6-lite/shorewall6-lite +++ b/Shorewall6-lite/shorewall6-lite @@ -35,7 +35,7 @@ g_program=shorewall6-lite g_libexec="$LIBEXECDIR" g_sharedir="$SHAREDIR"/shorewall6-lite g_sbindir="$SBINDIR" -g_perllib="$PERLLIBDIR" +g_vardir="$VARDIR" g_confdir="$CONFDIR"/shorewall6-lite g_readrc=1 diff --git a/Shorewall6/shorewall6 b/Shorewall6/shorewall6 index 73034269c..82a16605d 100755 --- a/Shorewall6/shorewall6 +++ b/Shorewall6/shorewall6 @@ -36,6 +36,7 @@ g_libexec="$LIBEXECDIR" g_sharedir="$SHAREDIR"/shorewall6 g_sbindir="$SBINDIR" g_perllib="$PERLLIBDIR" +g_vardir="$VARDIR" g_confdir="$CONFDIR"/shorewall6 g_readrc=1 From 3a967d66cf609446cccbba61efc81b787fd05d5c Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 16 Apr 2012 12:57:34 -0700 Subject: [PATCH 10/10] Fix configure Signed-off-by: Tom Eastep --- Shorewall-core/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shorewall-core/configure b/Shorewall-core/configure index 78f29d765..a13fef4bf 100755 --- a/Shorewall-core/configure +++ b/Shorewall-core/configure @@ -159,7 +159,7 @@ echo '#' > shore echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc echo '#' >> shorewallrc -if [ -n "$@" ]; then +if [ $# -gt 0 ]; then echo "# Input: $@" >> shorewallrc echo '#' >> shorewallrc fi