From fcd5cb82a894a20fbd989bcc2922842af3b0a715 Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Fri, 7 Mar 2025 21:41:19 +0000 Subject: [PATCH] Do SSH keys earlier (#37) --- PulumiWebServer/Program.fs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PulumiWebServer/Program.fs b/PulumiWebServer/Program.fs index 3dd31ec..8aa8113 100644 --- a/PulumiWebServer/Program.fs +++ b/PulumiWebServer/Program.fs @@ -1,4 +1,4 @@ -namespace PulumiWebServer +namespace PulumiWebServer open System.Net.Http open Nager.PublicSuffix @@ -115,6 +115,15 @@ module Program = (BashString.make "/tmp/networking.nix") |> fun c -> c.Stdout + // TODO: do this properly via Command + keys + |> Array.map (fun k -> k.PublicKeyContents) + |> Array.collect (fun s -> s.Split "\n") + |> JsonConvert.SerializeObject + |> fun s -> File.WriteAllText ("/tmp/ssh-keys.json", s) + + Log.Info "Stored SSH keys at /tmp/ssh-keys.json" + let pullHardware = Command.pullFile config.PrivateKey @@ -130,15 +139,6 @@ module Program = let! _ = pullHardware Log.Info "Hardware configuration at /tmp/hardware.nix" - // TODO: do this properly via Command - keys - |> Array.map (fun k -> k.PublicKeyContents) - |> Array.collect (fun s -> s.Split "\n") - |> JsonConvert.SerializeObject - |> fun s -> File.WriteAllText ("/tmp/ssh-keys.json", s) - - Log.Info "Stored SSH keys at /tmp/ssh-keys.json" - // The nixos rebuild has blatted the known public key. let! _ = (Local.forgetKey (address.Get ())).Stdout let! _ = (Local.forgetKey (string config.Domain)).Stderr