mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-04 01:00:04 +01:00
modules/rsync-pull-targets: fix multiple pull targets with same user
This commit is contained in:
@@ -124,16 +124,22 @@ in
|
|||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
users.users = lib.pipe cfg.locations [
|
users.users = lib.pipe cfg.locations [
|
||||||
(lib.filterAttrs (_: value: value.enable))
|
(lib.filterAttrs (_: value: value.enable))
|
||||||
(lib.mapAttrs' (_: { user, location, rrsyncPackage, rrsyncArgs, authorizedKeysAttrs, publicKey, ... }: let
|
|
||||||
rrsyncArgString = lib.cli.toCommandLineShellGNU {
|
lib.attrValues
|
||||||
isLong = _: false;
|
|
||||||
} rrsyncArgs;
|
# Index locations by SSH user
|
||||||
# TODO: handle " in location
|
(lib.foldl (acc: location: acc // {
|
||||||
in {
|
${location.user} = (acc.${location.user} or [ ]) ++ [ location ];
|
||||||
name = user;
|
}) { })
|
||||||
value.openssh.authorizedKeys.keys = [
|
|
||||||
"command=\"${lib.getExe rrsyncPackage} ${rrsyncArgString} ${location}\",${lib.concatStringsSep "," authorizedKeysAttrs} ${publicKey}"
|
(lib.mapAttrs (_name: locations: {
|
||||||
];
|
openssh.authorizedKeys.keys = map ({ user, location, rrsyncPackage, rrsyncArgs, authorizedKeysAttrs, publicKey, ... }: let
|
||||||
|
rrsyncArgString = lib.cli.toCommandLineShellGNU {
|
||||||
|
isLong = _: false;
|
||||||
|
} rrsyncArgs;
|
||||||
|
# TODO: handle " in location
|
||||||
|
in "command=\"${lib.getExe rrsyncPackage} ${rrsyncArgString} ${location}\",${lib.concatStringsSep "," authorizedKeysAttrs} ${publicKey}"
|
||||||
|
) locations;
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user