mirror of
/repos/baseimage-docker.git
synced 2025-12-30 08:01:31 +01:00
18 lines
511 B
Bash
Executable File
18 lines
511 B
Bash
Executable File
#!/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"
|
|
fi
|