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

View File

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