1
0
mirror of /repos/baseimage-docker.git synced 2026-02-27 17:41:59 +01:00

Disable the insecure SSH key by default

This commit is contained in:
Hongli Lai (Phusion)
2014-02-06 13:07:47 +01:00
parent a5f521b1b1
commit 37cd856425
5 changed files with 58 additions and 13 deletions

17
image/enable_insecure_key Executable file
View File

@@ -0,0 +1,17 @@
#!/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