README.md

console-login-helper-messages

Uses motd, issue, and profile to show helper messages before/at login.

Useful in situations where a desktop environment is not available and information is communicated through the terminal.

Usage

The following messages will show after installing console-login-helper-messages and enabling the issuegen.service, issuegen.path, motdgen.service, motdgen.path units.

  • [x] available ssh keys from /etc/ssh matching the regex ssh_host_*_key, before login as an issue
  • [x] ip addresses of network interfaces such as eth0, before login as an issue
  • [x] available system updates from rpm-ostree or dnf, at login as a motd
  • [x] failed systemd units, at login as a bash profile script

Enabling the messages

The following enables the motd and issue messages to show at boot:

systemctl enable issuegen.path issuegen.service motdgen.path motdgen.service

The profile messages are enabled by default by a symlink from /etc/profile.d at install.

Disabling the messages

The following disables the motd and issue messages from showing at boot:

systemctl disable issuegen.path issuegen.service motdgen.path motdgen.service

The profile messages can be disabled only by uninstalling console-login-helper-messages-profile.

Appending messages

  • Additional motd files to display can be dropped into /etc/motd.d, /run/motd.d, or /usr/lib/motd.d (displayed by sshd with the latest PAM installed). This is by default available on Fedora (without installing console-login-helper-messages).
  • Additional issue files to display can be dropped into /etc/issue.d (displayed by agetty). This is also by default available on Fedora.

  • To have a message appended to the same motd file generated by motdgen.service, the files to append can be dropped in /etc/console-login-helper-messages/motd.d or /run/console-login-helper-messages/motd.d

  • Similarly, issue messages to append to the same issue file generated by issuegen.service can be dropped in /etc/console-login-helper-messages/issue.d or or /run/console-login-helper-messages/issue.d

Silencing a generated message

  • The generated motd by motdgen.service may be silenced or overridden by placing a file at /etc/motd.d/console-login-helper-messages.motd. A symlink to /dev/null can also be used for silencing.
  • Currently, the issue generated by issuegen.service can be silenced only by uninstalling console-login-helper-messages-issuegen.

Recreating the symlinks

If a message is not showing, it could be because a symlink required to show the message was deleted. To recreate the symlinks, the following command can be used:

systemd-tmpfiles --create

Regenerating the messages

To manually regenerate the motd or issue, the following commands can be used respectively:

systemctl start motdgen.service
systemctl start issuegen.service

Internal operation

Let x denote {motd,issue}. - xgen scripts source files from /etc/console-login-helper-messages/x.d, /run/console-login-helper-messages/x.d, and /usr/lib/console-login-helper-messages/x.d, and generate a file at /run/x.d/40_console-login-helper-messages.x - Information about the system is sourced by running commands such as rpm-ostree upgrade --check, looking in directories such as /etc/ssh, or other ways like udev rules dropping files into /run/console-login-helper-messages/issue.d. More details are best explained by looking at the scripts in usr/lib/console-login-helper-messages/issuegen or usr/lib/console-login-helper-messages/motdgen. - The systemd units issuegen.service and motdgen.service are oneshot units whose job is to generate the messages at /run/x.d/40_console-login-helper-messages.x. - The systmed units issuegen.path and motdgen.path are used to check if a user dropped a file in /etc/console-login-helper-messages/x.d, and regenerate the messages. - A symlink /etc/issue.d/console-login-helper-messages.issue -> /run/issue.d/console-login-helper-messages.issue is created as agetty will only look for files in /etc/issue.d as of today, so a symlink to the generated one is required. - A symlink /etc/profile.d/console-login-helper-messages-profile.sh -> /usr/share/console-login-helper-messages/console-login-helper-messages-profile.sh is created in order for the profile script to run.

Note on upstream dependencies

TODO: - note the PAM, sshd agetty versions, and distributions that use these versions - list distributions that have the required functionality by default (where console-login-helper-messages has been tested)