Adding some updates to make the containers more secure, fix the password bug, and add the first version of the Powershell containers
This commit is contained in:
1 parent
0a9767d001
commit
55143adcf6
7 files changed
+193
-218
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURRENT_GID="$(id -g coder)"
|
||||
|
||||
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "${CURRENT_GID}" ]; then
|
||||
groupmod -g $USER_GID coder
|
||||
find / -group $CURRENT_GID -exec chgrp -h coder {} \;
|
||||
fi
|
||||
|
||||
CURRENT_UID="$(id -u coder)"
|
||||
|
||||
if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "${CURRENT_UID}" ]; then
|
||||
usermod -u $USER_UID coder
|
||||
find / -user $CURRENT_UID -exec chown -h coder {} \;
|
||||
fi
|
||||
|
||||
CURRENT_PASSWD=$(grep -E "^Password: .*$" /home/coder/.config/code-server/config.yaml | cut -d ":" -f 2 | awk '{$1=$1;print}')
|
||||
|
||||
if [ -n "${USER_PASSWD}" ] && [ "${CURRENT_PASSWD}" != "${USER_PASSWD}" ] || [ "${CURRENT_PASSWD}" == "PASSWORD"]; then
|
||||
if [ -n "${USER_PASSWD}" ]; then
|
||||
USER_PASSWD="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 20; echo)"
|
||||
fi
|
||||
|
||||
sed -i "s/^PASSWORD: .*$/PASSWORD: ${USER_PASSWD}/g" /home/coder/.config/code-server/config.yaml
|
||||
fi
|
||||
|
||||
/usr/bin/code-server --bind-addr 0.0.0.0:8080 .
|
||||
Reference in new issue
Block a user