Skip to content

Commit

Permalink
Allow manual decryption key entry
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Dec 11, 2018
1 parent aafdf10 commit af46983
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/reconcile-nagios.sh
Expand Up @@ -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);
Expand Down
13 changes: 9 additions & 4 deletions restore.sh
Expand Up @@ -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
Expand Down

0 comments on commit af46983

Please sign in to comment.