Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

Commit b09b22c

Browse files
committed
client-ds: Explicitly check for and fail on polluted mount point
1 parent 83b43ba commit b09b22c

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

deploy/client-ds.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,23 @@ spec:
5959
6060
mkdir -p /root/.quobyte ${QUOBYTE_MOUNT_POINT}
6161
62-
# set the mount point immutable. As long as mount.quobyte does not run,
63-
# other processes cannot write data to this dir.
64-
chattr +i ${QUOBYTE_MOUNT_POINT} || \
65-
echo "WARNING: The local filesystem does not support IMMUTABLE flag"
62+
if find "$QUOBYTE_MOUNT_POINT" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then
63+
echo "POLLUTED MOUNT POINT DETECTED! Cannot use $QUOBYTE_MOUNT_POINT as a mount point."
64+
echo "Please remove all files and directories from $QUOBYTE_MOUNT_POINT and "
65+
echo "run 'chattr +i $QUOBYTE_MOUNT_POINT' to prevent future mount point pollution."
66+
else
67+
# set the mount point immutable. As long as mount.quobyte does not run,
68+
# other processes cannot write data to this dir.
69+
chattr +i ${QUOBYTE_MOUNT_POINT} || \
70+
echo "WARNING: The local filesystem does not support IMMUTABLE flag. Mount point pollution is possible."
71+
72+
/usr/bin/mount.quobyte --hostname ${NODENAME} \
73+
--allow-usermapping-in-volumename --http-port 55000 -f \
74+
-d ${QUOBYTE_CLIENT_LOG_LEVEL} -l /dev/stdout ${OPTS} \
75+
${QUOBYTE_REGISTRY}/ ${QUOBYTE_MOUNT_POINT}
76+
fi
77+
6678
67-
/usr/bin/mount.quobyte --hostname ${NODENAME} \
68-
--allow-usermapping-in-volumename --http-port 55000 -f \
69-
-d ${QUOBYTE_CLIENT_LOG_LEVEL} -l /dev/stdout ${OPTS} \
70-
${QUOBYTE_REGISTRY}/ ${QUOBYTE_MOUNT_POINT}
7179
securityContext:
7280
privileged: true
7381
volumeMounts:

0 commit comments

Comments
 (0)