Fixed checking for correct mount of encrypted directory
This commit is contained in:
@@ -41,7 +41,8 @@ fi
|
||||
if [ $? -ne 0 ]; then
|
||||
elog_add "Some Error when mounting private Directory, cannot continue. Your Data will not be available."
|
||||
elog_add "If you want to redo this script here, execute ${SCRIPTPATH}/${SCRIPTNAME}"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
echo "Press any key to continue"
|
||||
read -n 1 -s -r
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -41,10 +41,7 @@ else
|
||||
echo "No Key found. Will try to Setup a new one."
|
||||
ENCKEY=$( openssl rand -base64 24 )
|
||||
echo ${ENCKEY} > /var/tmp/IPAVAULTKEY.txt
|
||||
ipa vault-add "${IPAVAULTNAME}" --desc "Key for Fileencrytption of ${HOSTNM}" --type=standard
|
||||
if [ $? -eq 0 ]; then
|
||||
ipa vault-archive "${IPAVAULTNAME}" --in /var/tmp/IPAVAULTKEY.txt
|
||||
fi
|
||||
ipa vault-add "${IPAVAULTNAME}" --desc "Key for Fileencrytption of ${HOSTNM}" --type=standard && ipa vault-archive "${IPAVAULTNAME}" --in /var/tmp/IPAVAULTKEY.txt
|
||||
if [ $? -eq 0 ]; then
|
||||
echo
|
||||
echo "Your Key has been sucessfully stored to the Vault ${IPAVAULTNAME}"
|
||||
@@ -59,6 +56,7 @@ else
|
||||
echo
|
||||
else
|
||||
echo "Failed to create the Vault. Please check the Errors and try again."
|
||||
ENCKEY=""
|
||||
fi
|
||||
else
|
||||
ENCKEY=$( cat /var/tmp/IPAVAULTKEY.txt )
|
||||
|
||||
@@ -13,6 +13,18 @@ if [ "${DAVTOKEN_USER}." == "." ]; then
|
||||
get_nc_token
|
||||
fi
|
||||
|
||||
#Check if encrypted Dir is mounted
|
||||
if [ ${IPAVAULTUSE} == "true" ]; then
|
||||
grep ${DECRYPTEDDATADIR} /etc/mtab >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: IPAVAULTUSE is set to true, but the Directory is not mounted. "
|
||||
echo "Press any key to continue"
|
||||
read -n 1 -s -r
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use optional Profilename
|
||||
profilename=${3:-"default"}
|
||||
|
||||
@@ -73,7 +85,8 @@ if [[ $? -ne 0 ]]; then
|
||||
echo "****"
|
||||
echo ""
|
||||
echo "Please check if your Token is setup right and for the Output"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
echo "Press any key to continue"
|
||||
read -n 1 -s -r
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
@@ -87,7 +100,8 @@ if [ "${RUNCMD}." != "." ]; then
|
||||
echo "****"
|
||||
echo ""
|
||||
echo "Error running ${1}, not syncing Profile!"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
echo "Press any key to continue"
|
||||
read -n 1 -s -r
|
||||
echo ""
|
||||
exit 2
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user