set PATH correctly in ssh sessions

for a non=interactive shell ("ssh linminix foo") ash does not source
*any* startup files, so we need to set this to something more useful
than /bin:usr/bin
This commit is contained in:
Daniel Barlow 2023-05-21 17:07:19 +01:00
parent a48d51ffdc
commit 0173a9ced9

View file

@ -151,12 +151,21 @@ in rec {
services.sshd = longrun {
name = "sshd";
# env -i clears the environment so we don't pass anything weird to
# ssh sessions. Dropbear params are
# -e pass environment to child
# -E log to stderr
# -R create hostkeys if needed
# -P pid-file
# -F don't fork into background
run = ''
if test -d /persist; then
mkdir -p /persist/secrets/dropbear
ln -s /persist/secrets/dropbear /run
fi
${dropbear}/bin/dropbear -E -R -P /run/dropbear.pid -F
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
exec env -i ENV=/etc/ashrc PATH=$PATH ${dropbear}/bin/dropbear -e -E -R -P /run/dropbear.pid -F
'';
};