From 2bf16016c11a7d8028c8d4b7bfd832c5335d7973 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 9 Jun 2012 07:24:23 -0700 Subject: [PATCH 1/3] Add --digest to configure scripts. Signed-off-by: Tom Eastep --- Shorewall-core/configure | 3 ++- Shorewall-core/configure.pl | 3 ++- Shorewall/install.sh | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Shorewall-core/configure b/Shorewall-core/configure index 860976aa6..377c92073 100755 --- a/Shorewall-core/configure +++ b/Shorewall-core/configure @@ -180,7 +180,8 @@ for on in \ SYSCONFDIR \ SPARSE \ ANNOTATED \ - VARDIR + VARDIR \ + DIGEST do echo "$on=${options[${on}]}" echo "$on=${options[${on}]}" >> shorewallrc diff --git a/Shorewall-core/configure.pl b/Shorewall-core/configure.pl index 439c3ca7e..8485692f4 100755 --- a/Shorewall-core/configure.pl +++ b/Shorewall-core/configure.pl @@ -141,7 +141,8 @@ for ( qw/ HOST SYSCONFDIR SPARSE ANNOTATED - VARDIR / ) { + VARDIR + DIGEST / ) { my $val = $options{$_} || ''; diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 9601e5ccb..941974517 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -250,9 +250,13 @@ OWNERSHIP="-o $OWNER -g $GROUP" if [ $PRODUCT = shorewall -a "$BUILD" = "$HOST" ]; then # - # Fix up 'use Digest::' if SHA is installed + # Fix up 'use Digest::' if SHA1 is installed # - if ! perl -e 'use Digest::SHA;' 2> /dev/null ; then + if [ -n "$DIGEST" ]; then + if [ "$DIGEST" != SHA ]; then + eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Chains.pm + fi + elif ! perl -e 'use Digest::SHA;' 2> /dev/null ; then if perl -e 'use Digest::SHA1;' 2> /dev/null ; then sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm else From bc5e0f48517712862d43f2273edcd256676e4c27 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 9 Jun 2012 08:32:15 -0700 Subject: [PATCH 2/3] Don't store the DIGEST setting in shorewallrc. Signed-off-by: Tom Eastep --- Shorewall-core/configure | 3 +-- Shorewall-core/configure.pl | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Shorewall-core/configure b/Shorewall-core/configure index 377c92073..860976aa6 100755 --- a/Shorewall-core/configure +++ b/Shorewall-core/configure @@ -180,8 +180,7 @@ for on in \ SYSCONFDIR \ SPARSE \ ANNOTATED \ - VARDIR \ - DIGEST + VARDIR do echo "$on=${options[${on}]}" echo "$on=${options[${on}]}" >> shorewallrc diff --git a/Shorewall-core/configure.pl b/Shorewall-core/configure.pl index 8485692f4..439c3ca7e 100755 --- a/Shorewall-core/configure.pl +++ b/Shorewall-core/configure.pl @@ -141,8 +141,7 @@ for ( qw/ HOST SYSCONFDIR SPARSE ANNOTATED - VARDIR - DIGEST / ) { + VARDIR / ) { my $val = $options{$_} || ''; From 6d3ebd5b56ca9826fe18125d64e1f60ce0d171b2 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 9 Jun 2012 09:34:28 -0700 Subject: [PATCH 3/3] Improve DIGEST handling. - Compile compiler.pl when DIGEST specified. - Report the digest being used. Signed-off-by: Tom Eastep --- Shorewall/install.sh | 77 ++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 941974517..7ea52a82c 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -22,7 +22,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -VERSION=xxx #The Build script inserts the actual version +VERSION=4.5.5 #The Build script inserts the actual version # # Change to the directory containing this script @@ -244,36 +244,6 @@ esac OWNERSHIP="-o $OWNER -g $GROUP" -# -# Determine where to install the firewall script -# - -if [ $PRODUCT = shorewall -a "$BUILD" = "$HOST" ]; then - # - # Fix up 'use Digest::' if SHA1 is installed - # - if [ -n "$DIGEST" ]; then - if [ "$DIGEST" != SHA ]; then - eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Chains.pm - fi - elif ! perl -e 'use Digest::SHA;' 2> /dev/null ; then - if perl -e 'use Digest::SHA1;' 2> /dev/null ; then - sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm - else - echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2 - exit 1 - fi - fi - # - # Verify that Perl and all required modules are installed - # - if ! perl -c Perl/compiler.pl; then - echo "ERROR: $Product $VERSION requires Perl which either is not installed or is not able to compile the Shorewall Perl code" >&2 - echo " Try perl -c $PWD/Perl/compiler.pl" >&2 - exit 1 - fi -fi - case "$HOST" in cygwin) echo "Installing Cygwin-specific configuration..." @@ -304,6 +274,51 @@ case "$HOST" in ;; esac +if [ $PRODUCT = shorewall ]; then + if [ -n "$DIGEST" ]; then + # + # The user specified which digest to use + # + if [ "$DIGEST" != SHA ]; then + if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then + echo "ERROR: Perl compilation with Digest::$DIGEST failed" >&2 + exit 1; + fi + + eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Chains.pm + fi + elif [ "$BUILD" = "$HOST" ]; then + # + # Fix up 'use Digest::' if SHA1 is installed + # + DIGEST=SHA + if ! perl -e 'use Digest::SHA;' 2> /dev/null ; then + if perl -e 'use Digest::SHA1;' 2> /dev/null ; then + sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm + DIGEST=SHA1 + else + echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2 + exit 1 + fi + fi + fi + + if [ "$BUILD" = "$HOST" ]; then + # + # Verify that Perl and all required modules are installed + # + echo "Compiling the Shorewall Perl Modules with Digest::$DIGEST" + + if ! perl -c Perl/compiler.pl; then + echo "ERROR: $Product $VERSION requires Perl which either is not installed or is not able to compile the Shorewall Perl code" >&2 + echo " Try perl -c $PWD/Perl/compiler.pl" >&2 + exit 1 + fi + else + echo "Using Digest::$DIGEST" + fi +fi + if [ $BUILD != cygwin ]; then if [ `id -u` != 0 ] ; then echo "Not setting file owner/group permissions, not running as root."