Permalink
Browse files

Allow manual decryption key entry

  • Loading branch information...
NEMS Linux
NEMS Linux committed Dec 11, 2018
1 parent aafdf10 commit af469834cf3d765fe20d0fe88c805313e6882ab3
Showing with 10 additions and 4 deletions.
  1. +1 −0 data/reconcile-nagios.sh
  2. +9 −4 restore.sh
@@ -107,6 +107,7 @@ $confdest = $argv[3];
echo PHP_EOL;
function parsefile($filename,$file) {
$definitions = array(); // prevent error if file is empty
if (substr($filename,0,5) == '/tmp/') $filename_short = 'your backup of ';
if (substr($filename,0,6) == '/root/') $filename_short = 'NEMS\' Default of ';
$filename_short .= basename($filename);
@@ -102,14 +102,19 @@ else

# if this is an encrypted set, decrypt
if [[ -f /tmp/nems_migrator_restore/tmp/private.tar.gz.gpg ]]; then
printf "This backup is encrypted. Attempting to decrypt... "
echo "This backup is encrypted."
# Load Config
osbpass=$(cat /usr/local/share/nems/nems.conf | grep osbpass | printf '%s' $(cut -n -d '=' -f 2))

if [[ $osbpass == '' ]]; then
echo Decryption password not entered in NEMS SST. Aborting.
echo ""
exit
echo Decryption password not entered in NEMS SST.
read -sp 'Enter Decryption Key: ' osbpass
if [[ $osbpass == '' ]]; then
echo "Aborted."
echo ""
exit
fi
echo "Attempting to decrypt with that key... "
fi;

/usr/bin/gpg --yes --batch --passphrase="::$osbpass::291ea559-471e-4bda-bb7d-774e782f84c1::" --decrypt /tmp/nems_migrator_restore/tmp/private.tar.gz.gpg > /tmp/nems_migrator_restore/tmp/private.tar.gz

0 comments on commit af46983

Please sign in to comment.