diff --git a/ab-openldap/backup.sh b/ab-openldap/backup.sh index abc2cba..4d6fb15 100755 --- a/ab-openldap/backup.sh +++ b/ab-openldap/backup.sh @@ -5,18 +5,6 @@ # version 3.0 # -# error code reference: -# 0: exited normally, no errors -# 1: parameter or permissions error -# 2: unsupported number of containers (0 or more than 1) -# 3: could not create/remove temporary directory/files -# 4: problem exporting database(s) -# 5: problem compressing/encrypting tar.gz archive -# 6: problem copying encrypted archive to host -# 7: problem creating target subdirectory in outputLocation -# 8: problem extracting gzipped tarball file -# 99: dependencies not installed (tar, gzip) - ### text formatting presets @@ -475,6 +463,22 @@ if [ $extract = 'true' ]; then logSuccess "Backup extracted to '${outputLocation%/}/restore/'" fi fi + + # remove TLS configuration + if [ "$removeTLS" = 'true' ]; then + # get newest config-? file in outputLocation/restore directory + cnConfigFile=$( ls "${outputLocation%/}/restore" -t | head -n1 ) + # remove TLS configuration entries + logInfo 'task' "Removing TLS configuration $cnConfigFile... " + sed -i -e '/^olcTLS/d' "$cnConfigFile" + # check our work + if ! grep -q '^olcTLS' "$cnConfigFile"; then + logInfo 'done' + else + logInfo 'err' + exitError '20' 'olcTLS entries could not be removed from restored config DIT LDIF file. You will have to do it manually.' 'nc' + fi + fi elif [ $extract = 'false' ]; then ### process backup operations @@ -572,3 +576,20 @@ logSuccess 'All processes completed' printf "%s[%s] --- %s execution completed ---\n%s" \ "$magenta" "$(stamp)" "$scriptName" "$norm" >> "$logfile" exit 0 + + +# error code reference: +# 0: exited normally, no errors +# 1: parameter or permissions error +# 2: unsupported number of containers (0 or more than 1) +# 3: could not create/remove temporary directory/files +# 4: problem exporting database(s) +# 5: problem compressing/encrypting tar.gz archive +# 6: problem copying encrypted archive to host +# 7: problem creating target subdirectory in outputLocation +# 8: problem extracting gzipped tarball file +# 20: problem removing TLS entries +# 99: dependencies not installed (tar, gzip) + + +#EOF \ No newline at end of file