Skip to content

Commit

Permalink
Merge pull request #21 from iris-connect/fix/avoid_readable_but_not_w…
Browse files Browse the repository at this point in the history
…riteable_files

fix: avoid readable but not writeable files
  • Loading branch information
adewes authored Dec 9, 2021
2 parents 41cbe29 + 20d9c43 commit c779196
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
25 changes: 19 additions & 6 deletions .scripts/entrypoint-eps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
if [[ -z "${MOUNT_POINTS}" ]]
then
echo "The environment variable MOUNT_POINTS can be set to a comma separated list of the mount points in the container. Use default now."
MOUNT_POINTS="/config,/tls,/app/settings"
READ_MOUNT_POINTS="/config,/tls,/app/settings"
WRITE_MOUNT_POINTS=""
MOUNT_POINTS=$READ_MOUNT_POINTS,$WRITE_MOUNT_POINTS
fi

echo "MOUNT_POINTS is set to \"${MOUNT_POINTS}\""
echo "READ_MOUNT_POINTS is set to \"${READ_MOUNT_POINTS}\""
echo "WRITE_MOUNT_POINTS is set to \"${WRITE_MOUNT_POINTS}\""

for point in ${MOUNT_POINTS//,/ }
do
Expand All @@ -16,13 +20,22 @@ do
continue
fi

if ! su iris -c "find ${point} -type f -exec cat {} > /dev/null +"
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}

echo "chmod u+r is made for \"${point}\""
chmod -R u+r ${point}
done

for point in ${WRITE_MOUNT_POINTS//,/ }
do
if [ ! -d ${point} ]
then
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}
else
echo "Skip readable directory: \"${point}\""
continue
fi

echo "chmod u+w is made for \"${point}\""
chmod -R u+w ${point}
done

echo "Execute eps with user iris"
Expand Down
25 changes: 19 additions & 6 deletions .scripts/entrypoint-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
if [[ -z "${MOUNT_POINTS}" ]]
then
echo "The environment variable MOUNT_POINTS can be set to a comma separated list of the mount points in the container. Use default now."
MOUNT_POINTS="/config,/tls,/app/settings,/storage,/app/db,/tmp"
READ_MOUNT_POINTS="/config,/tls,/app/settings"
WRITE_MOUNT_POINTS="/storage,/app/db,/tmp"
MOUNT_POINTS=$READ_MOUNT_POINTS,$WRITE_MOUNT_POINTS
fi

echo "MOUNT_POINTS is set to \"${MOUNT_POINTS}\""
echo "READ_MOUNT_POINTS is set to \"${READ_MOUNT_POINTS}\""
echo "WRITE_MOUNT_POINTS is set to \"${WRITE_MOUNT_POINTS}\""

for point in ${MOUNT_POINTS//,/ }
do
Expand All @@ -16,13 +20,22 @@ do
continue
fi

if ! su iris -c "find ${point} -type f -exec cat {} > /dev/null +"
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}

echo "chmod u+r is made for \"${point}\""
chmod -R u+r ${point}
done

for point in ${WRITE_MOUNT_POINTS//,/ }
do
if [ ! -d ${point} ]
then
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}
else
echo "Skip readable directory: \"${point}\""
continue
fi

echo "chmod u+w is made for \"${point}\""
chmod -R u+w ${point}
done

echo "Execute proxy with user iris"
Expand Down
25 changes: 19 additions & 6 deletions .scripts/entrypoint-sd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
if [[ -z "${MOUNT_POINTS}" ]]
then
echo "The environment variable MOUNT_POINTS can be set to a comma separated list of the mount points in the container. Use default now."
MOUNT_POINTS="/config,/tls,/app/settings,/storage,/app/db,/tmp"
READ_MOUNT_POINTS="/config,/tls,/app/settings"
WRITE_MOUNT_POINTS="/storage,/app/db,/tmp"
MOUNT_POINTS=$READ_MOUNT_POINTS,$WRITE_MOUNT_POINTS
fi

echo "MOUNT_POINTS is set to \"${MOUNT_POINTS}\""
echo "READ_MOUNT_POINTS is set to \"${READ_MOUNT_POINTS}\""
echo "WRITE_MOUNT_POINTS is set to \"${WRITE_MOUNT_POINTS}\""

for point in ${MOUNT_POINTS//,/ }
do
Expand All @@ -16,13 +20,22 @@ do
continue
fi

if ! su iris -c "find ${point} -type f -exec cat {} > /dev/null +"
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}

echo "chmod u+r is made for \"${point}\""
chmod -R u+r ${point}
done

for point in ${WRITE_MOUNT_POINTS//,/ }
do
if [ ! -d ${point} ]
then
echo "chown is made for \"${point}\""
chown -R iris:iris ${point}
else
echo "Skip readable directory: \"${point}\""
continue
fi

echo "chmod u+w is made for \"${point}\""
chmod -R u+w ${point}
done

echo "Execute sd with user iris"
Expand Down

0 comments on commit c779196

Please sign in to comment.