mirror of
https://github.com/Smaug123/PulumiConfig
synced 2025-10-05 08:38:41 +00:00
Do SSH keys earlier (#37)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
namespace PulumiWebServer
|
namespace PulumiWebServer
|
||||||
|
|
||||||
open System.Net.Http
|
open System.Net.Http
|
||||||
open Nager.PublicSuffix
|
open Nager.PublicSuffix
|
||||||
@@ -115,6 +115,15 @@ module Program =
|
|||||||
(BashString.make "/tmp/networking.nix")
|
(BashString.make "/tmp/networking.nix")
|
||||||
|> fun c -> c.Stdout
|
|> 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 =
|
let pullHardware =
|
||||||
Command.pullFile
|
Command.pullFile
|
||||||
config.PrivateKey
|
config.PrivateKey
|
||||||
@@ -130,15 +139,6 @@ module Program =
|
|||||||
let! _ = pullHardware
|
let! _ = pullHardware
|
||||||
Log.Info "Hardware configuration at /tmp/hardware.nix"
|
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.
|
// The nixos rebuild has blatted the known public key.
|
||||||
let! _ = (Local.forgetKey (address.Get ())).Stdout
|
let! _ = (Local.forgetKey (address.Get ())).Stdout
|
||||||
let! _ = (Local.forgetKey (string<DomainName> config.Domain)).Stderr
|
let! _ = (Local.forgetKey (string<DomainName> config.Domain)).Stderr
|
||||||
|
Reference in New Issue
Block a user