Runtime scripts, systemd unit files, tmpfiles, and installer scripts to provide an issue/motd
mechanism for RHCOS/FCOS. To be distributed as an RPM, with some additional manual configuration required to work with software like PAM, agetty, ...
Let x
denote {motd,issue}
.
/etc/x
to /run/x
(see below) are set by systemd-tmpfiles
.issuegen
and motdgen
generate /run/x
, from files in /etc/coreos/x.d
, /run/coreos/x.d
, /lib/usr/coreos/x.d
.issue
or motd
by placing a file in /etc/coreos/x.d/
./etc/motd.d
and /etc/issue.d
respectively, for the messages in those directories to be shown at login. This is default for agetty, and default for PAM as long as the pam_motd.so
module is specified in the necessary /etc/pam.d
configuration files./ ├── etc │ ├── coreos │ │ ├── issue.d │ │ └── motd.d │ ├── issue -> ../run/issue │ └── motd -> ../run/motd ├── run │ ├── coreos │ │ ├── issue.d │ │ └── motd.d │ ├── issue │ └── motd └── usr ├── lib │ ├── coreos │ │ ├── issue.d │ │ └── motd.d │ ├── systemd │ │ └── system │ │ ├── issuegen.service │ │ └── motdgen.service │ ├── tmpfiles.d │ │ ├── issuegen.conf │ │ └── motdgen.conf │ └── udev │ └── 90-issuegen.rules └── libexec ├── issuegen └── motdgen
vagrant box add --name rhcos /path/to/box.box
(any name other than rhcos
works here, just be sure to update the Vagrantfile)vagrant up && vagrant ssh
Run the following commands once ssh has completed
$ sudo su # ostree admin unlock # cd /srv/fedora-coreos-login-messages # ./install.sh # ./setup-run.sh # ./start.sh
Now edit the sshd PAM configuration of RHCOS in vi /etc/pam.d/sshd
:
Add the following line just before session include password-auth
:
session optional pam_motd.so
# exit
, then $ exit
to exit SSH.
vagrant ssh
, now new motd
s should appear!
Follow steps 1-4 in "Steps to test motd..." above
WIP: need to reboot or udevadm control --reload-rules
here, running into issues with those. doing this on fedora/28-cloud-base
works
vagrant ssh
, and check the contents of /run/coreos/issue.d
. If there are device files in there, then the udev rule successfully transferred the information to issue.
motd
and issue
get updated at runtime (e.g. if a systemd unit fails, new device appears, updates finished installing, user drops something in /etc/... etc)?