Fixed checking for correct mount of encrypted directory

This commit is contained in:
Daniel Pätzold
2026-03-13 18:14:58 +01:00
parent b1e5752318
commit 445c52fb27
3 changed files with 20 additions and 7 deletions
+2 -1
View File
@@ -41,7 +41,8 @@ fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
elog_add "Some Error when mounting private Directory, cannot continue. Your Data will not be available." 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}" 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 exit 1
fi fi
+2 -4
View File
@@ -41,10 +41,7 @@ else
echo "No Key found. Will try to Setup a new one." echo "No Key found. Will try to Setup a new one."
ENCKEY=$( openssl rand -base64 24 ) ENCKEY=$( openssl rand -base64 24 )
echo ${ENCKEY} > /var/tmp/IPAVAULTKEY.txt echo ${ENCKEY} > /var/tmp/IPAVAULTKEY.txt
ipa vault-add "${IPAVAULTNAME}" --desc "Key for Fileencrytption of ${HOSTNM}" --type=standard 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
ipa vault-archive "${IPAVAULTNAME}" --in /var/tmp/IPAVAULTKEY.txt
fi
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo echo
echo "Your Key has been sucessfully stored to the Vault ${IPAVAULTNAME}" echo "Your Key has been sucessfully stored to the Vault ${IPAVAULTNAME}"
@@ -59,6 +56,7 @@ else
echo echo
else else
echo "Failed to create the Vault. Please check the Errors and try again." echo "Failed to create the Vault. Please check the Errors and try again."
ENCKEY=""
fi fi
else else
ENCKEY=$( cat /var/tmp/IPAVAULTKEY.txt ) ENCKEY=$( cat /var/tmp/IPAVAULTKEY.txt )
+16 -2
View File
@@ -13,6 +13,18 @@ if [ "${DAVTOKEN_USER}." == "." ]; then
get_nc_token get_nc_token
fi 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 # Use optional Profilename
profilename=${3:-"default"} profilename=${3:-"default"}
@@ -73,7 +85,8 @@ if [[ $? -ne 0 ]]; then
echo "****" echo "****"
echo "" echo ""
echo "Please check if your Token is setup right and for the Output" 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 "" echo ""
exit 1 exit 1
fi fi
@@ -87,7 +100,8 @@ if [ "${RUNCMD}." != "." ]; then
echo "****" echo "****"
echo "" echo ""
echo "Error running ${1}, not syncing Profile!" 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 "" echo ""
exit 2 exit 2
fi fi