@@ -221,7 +221,7 @@ in
221221 echo "Obtaining SSH keys..."
222222 mkdir -m 0700 -p /root/.ssh
223223 AUTH_KEYS=$(${mktemp})
224− ${wget} -O $AUTH_KEYS --header="Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/sshKeys
224+ ${wget} -O $AUTH_KEYS http://metadata.google.internal/computeMetadata/v1/instance/attributes/sshKeys
225225 if [ -s $AUTH_KEYS ]; then
226226
227227 # Read in key one by one, split in case Google decided
@@ -246,6 +246,18 @@ in
246246 false
247247 fi
248248 rm -f $AUTH_KEYS
249+ SSH_HOST_KEYS_DIR=$(${mktemp} -d)
250+ ${wget} -O $SSH_HOST_KEYS_DIR/ssh_host_ed25519_key http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssh_host_ed25519_key
251+ ${wget} -O $SSH_HOST_KEYS_DIR/ssh_host_ed25519_key.pub http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssh_host_ed25519_key_pub
252+ if [ -s $SSH_HOST_KEYS_DIR/ssh_host_ed25519_key -a -s $SSH_HOST_KEYS_DIR/ssh_host_ed25519_key.pub ]; then
253+ mv -f $SSH_HOST_KEYS_DIR/ssh_host_ed25519_key* /etc/ssh/
254+ chmod 600 /etc/ssh/ssh_host_ed25519_key
255+ chmod 644 /etc/ssh/ssh_host_ed25519_key.pub
256+ else
257+ echo "Setup of ssh host keys from http://metadata.google.internal/computeMetadata/v1/instance/attributes/ failed."
258+ false
259+ fi
260+ rm -f $SSH_HOST_KEYS_DIR
249261 '';
250262 serviceConfig.Type = "oneshot";
251263 serviceConfig.RemainAfterExit = true;