better log output remove apk cache add tag to build script
This commit is contained in:
+27
-8
@@ -1,4 +1,16 @@
|
||||
#!/bin/sh
|
||||
DOCKER_IMAGE_VERSION="1.0.3"
|
||||
|
||||
sepurator() {
|
||||
echo "==============================================================================="
|
||||
}
|
||||
|
||||
sepurator
|
||||
BORG_VERSION=$(borg -V)
|
||||
echo "* BorgServer powered by $BORG_VERSION"
|
||||
echo "* Image Hostname: $HOSTNAME"
|
||||
echo "* Image Version: $DOCKER_IMAGE_VERSION"
|
||||
sepurator
|
||||
|
||||
# Make authorized_keys file
|
||||
touch "/.ssh/authorized_keys"
|
||||
@@ -6,28 +18,33 @@ touch "/.ssh/authorized_keys"
|
||||
# Add User
|
||||
sh -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
||||
|
||||
echo "ADD USER: $USER WITH UID: $UID"
|
||||
adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/" \
|
||||
--uid "$UID" \
|
||||
"$USER"
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/" \
|
||||
--uid "$UID" \
|
||||
"$USER"
|
||||
echo "$USER:*" | chpasswd
|
||||
echo "ADD GROUP: $USER WITH GID: $GID"
|
||||
addgroup -g "$GID" "$USER"
|
||||
sepurator
|
||||
echo "* USER: $USER ID: $UID"
|
||||
echo "* GROUP: $USER GID: $GID"
|
||||
sepurator
|
||||
|
||||
mkdir -p /sshkeys/clients
|
||||
mkdir -p /sshkeys/host
|
||||
chown -R "$USER":"$USER" "/sshkeys"
|
||||
|
||||
echo "* IMPORT SSH KEYS"
|
||||
echo ""
|
||||
# Add SSH Keys to authorized_keys
|
||||
FILES=$(ls -1 /sshkeys/clients)
|
||||
for key in $FILES; do
|
||||
echo "Adding SSH-Key $key"
|
||||
echo "- Adding SSH-Key $key"
|
||||
cat "/sshkeys/clients/$key" >> "/.ssh/authorized_keys"
|
||||
done
|
||||
echo "" >> "/.ssh/authorized_keys"
|
||||
sepurator
|
||||
|
||||
# Change Ownership of SSH-Keys
|
||||
chown -R "$USER":"$USER" "/.ssh"
|
||||
@@ -47,4 +64,6 @@ fi
|
||||
|
||||
chown -R "$USER":"$USER" "/sshkeys/host"
|
||||
|
||||
echo "* Init done! - Starting SSH-Daemon..."
|
||||
sepurator
|
||||
exec /usr/sbin/sshd -D -e "$@"
|
||||
|
||||
Reference in New Issue
Block a user