1
0
mirror of https://github.com/Spearfoot/FreeNAS-scripts synced 2025-12-16 16:23:33 +00:00

Adapt to use OpenSSL 1.1.1 features

Modified to use new OpenSSL 1.1.1 features provided with TrueNAS 12.x
This commit is contained in:
Keith Nash
2020-12-16 16:07:03 -06:00
committed by GitHub
parent 8560712f73
commit a0890586fb

View File

@@ -21,13 +21,13 @@ rundate=$(date)
# #
# Leave the email address blank to simply copy the configuration file to the # Leave the email address blank to simply copy the configuration file to the
# destination you specify with the 'configdir' setting below. # destination you specify with the 'configdir' setting below.
email="" email="keith@spearfoot.net"
# Specify the dataset on your system where you want the configuration files copied. # Specify the dataset on your system where you want the configuration files copied.
# Don't include the trailing slash. # Don't include the trailing slash.
# Example: configdir=/mnt/tank/sysadmin/config # Example: configdir=/mnt/tank/sysadmin/config
configdir="" configdir="/root/work"
# OpenSSL encryption passphrase file. Enter the passphrase on the the first line in # OpenSSL encryption passphrase file. Enter the passphrase on the the first line in
# the file. This file should have 0600 permissions. # the file. This file should have 0600 permissions.
@@ -36,6 +36,9 @@ enc_passphrasefile=/root/config_passphrase
# FreeNAS hostname: # FreeNAS hostname:
freenashost=$(hostname -s) freenashost=$(hostname -s)
# FreeBSD version:
fbsd_relver=$(uname -K)
# MIME boundary # MIME boundary
mime_boundary="==>>> MIME boundary; FreeNAS server [${freenashost}] <<<==" mime_boundary="==>>> MIME boundary; FreeNAS server [${freenashost}] <<<=="
@@ -105,7 +108,11 @@ if [ $l_status -eq 0 ]; then
l_status=1 l_status=1
fi fi
if [ $l_status -eq 0 ]; then if [ $l_status -eq 0 ]; then
openssl enc -e -aes-256-cbc -md sha512 -salt -S "$(openssl rand -hex 4)" -pass file:"$enc_passphrasefile" -in "$fnconfigtarball" -out "$fnconfigtarballenc" if [ "$fbsd_relver" -ge 1200000 ]; then
openssl enc -e -aes-256-cbc -md sha512 -pbkdf2 -iter 128000 -salt -S "$(openssl rand -hex 8)" -pass file:"$enc_passphrasefile" -in "$fnconfigtarball" -out "$fnconfigtarballenc"
else
openssl enc -e -aes-256-cbc -md sha512 -salt -S "$(openssl rand -hex 4)" -pass file:"$enc_passphrasefile" -in "$fnconfigtarball" -out "$fnconfigtarballenc"
fi
l_status=$? l_status=$?
printf 'openssl status: [%s]\n' "$l_status" printf 'openssl status: [%s]\n' "$l_status"
fi fi