-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] nixos: support MOTDs with dynamic update #37602
Conversation
Signed-off-by: Austin Seipp <[email protected]>
Is this still being worked on? |
No. Yes, this feature is still useful and I still want it. It is not implemented. I am not actively working on it, and it is not in any critical path of mine, nor will it be anytime in the near future. If this is useful to you, feel free to take it over and I'll review any patches for it. |
Thank you for your contributions.
|
Cross-referencing for visibility: #90640 |
I marked this as stale due to inactivity. → More info |
Let's close this for now, we can still keep the branch around if someone wants to pick this up. |
NOTE: Current WIP, and needs real testing. This is just to get review input/make sure it doesn't get lost.
Modifying
pam
causes a chain that implies a heavy rebuild fornixos-rebuild
, so punting this tostaging
.Motivation for this change
I would like to start headless machines services such as Nginx that can direct logged in users to access them through their IP address or domain name.
In order to do this, I need to run a script dynamically, and I would like PAM to output this as part of the MOTD upon running
login
or the user SSH'ing in -- e.g. by runningifconfig
orip
. But in order to do this, I must dynamically run a script which will perform some action (for example, cat a file, runifconfig
, or even wait for a systemd service to start and check something).This patchset adds support to the
pam
package andpam
NixOS module to allow theconfig.users.motd
option to represent a dynamic script to be run.The original patchset is heavily based on the original patchset adding this feature, which is not available upstream, courtesy of the Debian/Ubuntu maintainers (I took this from the Ubuntu Launchpad package). This patchset executes a single script named
/etc/update-motd
, which outputs to/run/motd.dynamic
, which is then read by the module after execution.This patchset is not exactly the same as the original patchset. In particular, the original one runs a set of scripts using
run-parts
. However, this is based on LSB-style ordering which doesn't easily apply here; furthermore it's expected dynamic MOTDs are 'globally managed' and ordered, but this doesn't feel right with NixOS modules (e.g. if Iimport
a module, does its dynamic script run first or second?) Second, MOTDs are something best set by the user anyway, so it's probably best to just have a single option for the whole machine.An alternative to this is to just turn off
pam_motd
and execute the script as part of/etc/profile
or something (which is what happens on Fedora I believe) and have it executed on every shell but this feels hackier and I'm not sure the semantics are precisely the same.Some things to note:
config.users.motd
to be either plain text or a script, but that doesn't feel right. Should this change to another option (config.users.motd.script
?) with someassert
s concerning usage?update-motd(5)
in Ubuntu)Things done
build-use-sandbox
innix.conf
on non-NixOS)macOSnix-shell -p nox --run "nox-review wip"
./result/bin/
)