ec2-data: ensure providing a SSH host key is actually optional
27016659046a8f8e7b4fd61ecbceaf9f5e306258 broke this.
This commit is contained in:
parent
b9db67d8e2
commit
4e5ef470a7
@ -43,6 +43,7 @@ with lib;
|
|||||||
|
|
||||||
mkdir -m 0755 -p /etc/ssh
|
mkdir -m 0755 -p /etc/ssh
|
||||||
|
|
||||||
|
if [ -s "$userData" ]; then
|
||||||
key="$(sed 's/|/\n/g; s/SSH_HOST_DSA_KEY://; t; d' $userData)"
|
key="$(sed 's/|/\n/g; s/SSH_HOST_DSA_KEY://; t; d' $userData)"
|
||||||
key_pub="$(sed 's/SSH_HOST_DSA_KEY_PUB://; t; d' $userData)"
|
key_pub="$(sed 's/SSH_HOST_DSA_KEY_PUB://; t; d' $userData)"
|
||||||
if [ -n "$key" -a -n "$key_pub" -a ! -e /etc/ssh/ssh_host_dsa_key ]; then
|
if [ -n "$key" -a -n "$key_pub" -a ! -e /etc/ssh/ssh_host_dsa_key ]; then
|
||||||
@ -56,6 +57,7 @@ with lib;
|
|||||||
(umask 077; echo "$key" > /etc/ssh/ssh_host_ed25519_key)
|
(umask 077; echo "$key" > /etc/ssh/ssh_host_ed25519_key)
|
||||||
echo "$key_pub" > /etc/ssh/ssh_host_ed25519_key.pub
|
echo "$key_pub" > /etc/ssh/ssh_host_ed25519_key.pub
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user