Skip to content

Commit ff2f624

Browse files
committed
Added error handling when remounting /proc fs
1 parent e2e40d3 commit ff2f624

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

install/hst-install-debian.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,13 @@ fi
931931

932932
# Restrict access to /proc fs
933933
# - Prevent unpriv users from seeing each other running processes
934-
mount -o remount,defaults,hidepid=2 /proc
935-
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
934+
mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
935+
if [ $? -ne 0 ]; then
936+
echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
937+
else
938+
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
939+
fi
940+
936941

937942
#----------------------------------------------------------#
938943
# Configure Hestia #

install/hst-install-ubuntu.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,12 @@ fi
988988

989989
# Restrict access to /proc fs
990990
# - Prevent unpriv users from seeing each other running processes
991-
mount -o remount,defaults,hidepid=2 /proc
992-
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
991+
mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
992+
if [ $? -ne 0 ]; then
993+
echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
994+
else
995+
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
996+
fi
993997

994998

995999
#----------------------------------------------------------#

install/upgrade/versions/1.3.0.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ fi
6565
# Restrict access to /proc fs
6666
if [ ! -e "/etc/cron.d/hestia-proc" ]; then
6767
echo "[ * ] Restrict access to /proc fs"
68-
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
69-
mount -o remount,defaults,hidepid=2 /proc
68+
mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
69+
if [ $? -ne 0 ]; then
70+
echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
71+
else
72+
echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
73+
fi
7074
fi

0 commit comments

Comments
 (0)