mirror of
/repos/baseimage-docker.git
synced 2026-02-27 17:41:59 +01:00
Made services installation optional during build
You can user `ENV` directive in Dockerfile to disable the installation for some services or change `image/buildconfig`. The flags are : DISABLE_SSHD DISABLE_CRON DISABLE_SYSLOG
This commit is contained in:
30
image/services/sshd/enable_insecure_key
Executable file
30
image/services/sshd/enable_insecure_key
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
AUTHORIZED_KEYS=/root/.ssh/authorized_keys
|
||||
|
||||
if [[ -e "$AUTHORIZED_KEYS" ]] && grep -q baseimage-docker-insecure-key "$AUTHORIZED_KEYS"; then
|
||||
echo "Insecure key has already been added to $AUTHORIZED_KEYS."
|
||||
else
|
||||
DIR=`dirname "$AUTHORIZED_KEYS"`
|
||||
echo "Creating directory $DIR..."
|
||||
mkdir -p "$DIR"
|
||||
chmod 700 "$DIR"
|
||||
chown root:root "$DIR"
|
||||
echo "Editing $AUTHORIZED_KEYS..."
|
||||
cat /etc/insecure_key.pub >> "$AUTHORIZED_KEYS"
|
||||
echo "Success: insecure key has been added to $AUTHORIZED_KEYS"
|
||||
cat <<-EOF
|
||||
|
||||
+------------------------------------------------------------------------------+
|
||||
| Insecure SSH key installed |
|
||||
| |
|
||||
| DO NOT expose port 22 on the Internet unless you know what you are doing! |
|
||||
| |
|
||||
| Use the private key below to connect with user root |
|
||||
+------------------------------------------------------------------------------+
|
||||
|
||||
EOF
|
||||
cat /etc/insecure_key
|
||||
echo -e "\n\n"
|
||||
fi
|
||||
Reference in New Issue
Block a user