From 1098e6943bc2b1b320e8acf6a9a551cbc473f155 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Mar 2023 10:25:20 -0500 Subject: [PATCH 1/2] Fix bind version comparison --- xCAT-server/sbin/makenamed.conf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/makenamed.conf b/xCAT-server/sbin/makenamed.conf index d481bb76c..9b984607c 100755 --- a/xCAT-server/sbin/makenamed.conf +++ b/xCAT-server/sbin/makenamed.conf @@ -63,8 +63,19 @@ do echo " $i;" done >>$FILE echo " };" >>$FILE + +# Natural version compare against version of bind. +# If version 9.16.6 or higher, turn off DNSSEC BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2) -if [[ $BIND_VERSION > "9.16.5" ]]; then +CONTROL_BIND_VERSION="9.16.6" + +# "sort --version-sort" takes lines of version strings and sorts them. +# Output is lines of versions in sorted order, last line is highest version number +LAST_IN_COMPARE=`printf '%s\n' $BIND_VERSION $CONTROL_BIND_VERSION | sort --version-sort | tail -n1` + +if [ $BIND_VERSION = $LAST_IN_COMPARE ]; then + # current version of BIND was last in sorted order, + # therefor it is higher than CONTROL_BIND_VERSION echo " dnssec-enable no; dnssec-validation no;" >>$FILE fi From 60dfa47f379e228000ec38b2f7bc49ba2afcac3e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Mar 2023 11:45:42 -0500 Subject: [PATCH 2/2] Strip out extra text from version string --- xCAT-server/sbin/makenamed.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/sbin/makenamed.conf b/xCAT-server/sbin/makenamed.conf index 9b984607c..eaf197932 100755 --- a/xCAT-server/sbin/makenamed.conf +++ b/xCAT-server/sbin/makenamed.conf @@ -66,7 +66,7 @@ echo " };" >>$FILE # Natural version compare against version of bind. # If version 9.16.6 or higher, turn off DNSSEC -BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2) +BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | head -n1) CONTROL_BIND_VERSION="9.16.6" # "sort --version-sort" takes lines of version strings and sorts them.