Skip to content

Commit 3ead8c3

Browse files
authored
Merge pull request #6 from linuxserver/bullseye-secrets
Warn about newlines in secrets (bullseye)
2 parents 811e9eb + 098c8de commit 3ead8c3

File tree

1 file changed

+6
-4
lines changed
  • root/etc/s6-overlay/s6-rc.d/init-envfile

1 file changed

+6
-4
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
if find /run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then
5-
for FILENAME in /run/s6/container_environment/*; do
6-
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
4+
if find /run/s6/container_environment/FILE__* -maxdepth 1 > /dev/null 2>&1; then
5+
for FILENAME in /run/s6/container_environment/FILE__*; do
76
SECRETFILE=$(cat "${FILENAME}")
87
if [[ -f ${SECRETFILE} ]]; then
98
FILESTRIP=${FILENAME//FILE__/}
9+
if [[ $(tail -n1 "${SECRETFILE}" | wc -l) != 0 ]]; then
10+
echo "[env-init] Your secret: ${FILENAME##*/}"
11+
echo " contains a trailing newline and may not work as expected"
12+
fi
1013
cat "${SECRETFILE}" >"${FILESTRIP}"
1114
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
1215
else
1316
echo "[env-init] cannot find secret in ${FILENAME##*/}"
1417
fi
15-
fi
1618
done
1719
fi

0 commit comments

Comments
 (0)