summary refs log tree commit diff
path: root/nixos/modules/virtualisation/google-compute-image.nix
diff options
context:
space:
mode:
authorRussell O'Connor <oconnorr@google.com>2014-12-29 18:08:57 -0500
committerRussell O'Connor <oconnorr@google.com>2015-01-05 15:20:55 -0500
commit3251948029aab3e268c081cb258a835711a86205 (patch)
tree172557a30380b1a3099bb5d5c125c4d0a548f88f /nixos/modules/virtualisation/google-compute-image.nix
parentd1cbbff1e36e66dcf1aa9bb445fd03bc0c77433c (diff)
downloadnixlib-3251948029aab3e268c081cb258a835711a86205.tar
nixlib-3251948029aab3e268c081cb258a835711a86205.tar.gz
nixlib-3251948029aab3e268c081cb258a835711a86205.tar.bz2
nixlib-3251948029aab3e268c081cb258a835711a86205.tar.lz
nixlib-3251948029aab3e268c081cb258a835711a86205.tar.xz
nixlib-3251948029aab3e268c081cb258a835711a86205.tar.zst
nixlib-3251948029aab3e268c081cb258a835711a86205.zip
Generate SSH host public key from the private key.
Diffstat (limited to 'nixos/modules/virtualisation/google-compute-image.nix')
-rw-r--r--nixos/modules/virtualisation/google-compute-image.nix8
1 files changed, 1 insertions, 7 deletions
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index f6830b2f09fe..bee64866b52b 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -158,13 +158,7 @@ in
               mv -f /root/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key
               echo "downloaded ssh_host_ecdsa_key"
               chmod 600 /etc/ssh/ssh_host_ecdsa_key
-          fi
-
-          echo "obtaining SSH public host key..."
-          ${wget} -O /root/ssh_host_ecdsa_key.pub http://metadata/0.1/meta-data/attributes/ssh_host_ecdsa_key_pub
-          if [ $? -eq 0 -a -e /root/ssh_host_ecdsa_key.pub ]; then
-              mv -f /root/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
-              echo "downloaded ssh_host_ecdsa_key.pub"
+              ${config.programs.ssh.package}/bin/ssh-keygen -y -f /etc/ssh/ssh_host_ecdsa_key > /etc/ssh/ssh_host_ecdsa_key.pub
               chmod 644 /etc/ssh/ssh_host_ecdsa_key.pub
           fi
         '';