Remove declarative SSH keys

Windows changes the naming structure of homedir directories if it
encounters an already present homedir so this is not working as intended.
wfvm
adisbladis 2020-02-13 00:52:45 +00:00 committed by Stephan Maka
parent 23e9666550
commit 7e82318fd1
2 changed files with 13 additions and 15 deletions

View File

@ -35,17 +35,18 @@ let
)
) services;
sshSetupCommands = let
makeDirs = lib.mapAttrsToList (n: v: ''mkdir C:\Users\${n}\.ssh'') users;
writeKeys = lib.flatten (lib.mapAttrsToList (n: v: builtins.map (key: let
commands = [
''powershell.exe Set-Content -Path C:\Users\${n}\.ssh\authorized_keys -Value '${key}' ''
];
in lib.concatStringsSep "\n" commands) (v.sshKeys or [])) users);
mkDirsDesc = builtins.map (c: {Path = c; Description = "Make SSH key dir";}) makeDirs;
writeKeysDesc = builtins.map (c: {Path = c; Description = "Add SSH key";}) writeKeys;
in
# mkDirsDesc ++ writeKeysDesc ++
sshSetupCommands =
# let
# makeDirs = lib.mapAttrsToList (n: v: ''mkdir C:\Users\${n}\.ssh'') users;
# writeKeys = lib.flatten (lib.mapAttrsToList (n: v: builtins.map (key: let
# commands = [
# ''powershell.exe Set-Content -Path C:\Users\${n}\.ssh\authorized_keys -Value '${key}' ''
# ];
# in lib.concatStringsSep "\n" commands) (v.sshKeys or [])) users);
# mkDirsDesc = builtins.map (c: {Path = c; Description = "Make SSH key dir";}) makeDirs;
# writeKeysDesc = builtins.map (c: {Path = c; Description = "Add SSH key";}) writeKeys;
# in
# mkDirsDesc ++ writeKeysDesc ++
[
{
Path = ''powershell.exe Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 -Source ${driveLetter}\fod -LimitAccess'';
@ -106,7 +107,7 @@ let
, description ? ""
, displayName ? ""
, groups ? []
, sshKeys ? [] # Handled in scripts
# , sshKeys ? [] # Handled in scripts
}: ''
<LocalAccount wcm:action="add">
<Password>

View File

@ -15,9 +15,6 @@ win.makeWindowsImage {
# User accounts
users = {
artiq = {
# sshKeys = [
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEmJW3Z+1ZNNVao2jcipQQxiEN27jtpl40fq3Je+jgir"
# ];
password = "1234";
# description = "Default user";
# displayName = "Display name";