Repository navigation
feat(motd): add Chinese SSH last-login line with approved palette - #106
Merged
Merged
Conversation
added 2 commits
December 1, 2026 06:22
Adopt the approved log palette for the welcome panel (host, OS, uptime, load, kernel, architecture, labels; drop the green status dot) and add a Chinese "last login" footer rendered by the same payload in an explicit --last-login mode. The footer is emitted by an optional pam_exec(open_session) hook that runs right after pam_motd, so it reads the previous record before OpenSSH writes the current session. A single managed sshd drop-in sets PrintLastLog no so the English line is replaced, and English is only suppressed after sshd -t/-T confirm UsePAM yes and PrintLastLog no; the active ssh service is reloaded, with rollback on failure. Restore rewrites the English drop-in and reloads before removing the PAM hook, and only strips the tool's own marker lines so later administrator edits survive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#47DCC8, OS#FF8E9E(bold, no green dot), uptime number#6DFFBBwith unit#BAC2DE, CPU#FFB86C, load#24F0D0, healthy memory/root disk#50FA7B, kernel#FF934Dbold, architecture#A3B2C4, labels#A8B5D9.TERM=dumbbehaviour, and the CPU/load/memory/disk layout; the plain-text output is byte-identical after stripping colour.--last-loginmode.run-parts(no argument) still emits only the welcome panel, so no login record ever lands in the shared/run/motd.dynamic.session optional pam_exec.so type=open_session stdout quietinserted directly after the lastpam_motd.soline, which by OpenSSH ordering runs before the PTYrecord_loginof the current session; the previous record is read withlslogins(modern--lastlog-file/--lastlog2-file, legacy--lastlogfallback) and the current connection is never used.60-linux-setup-last-login.confsetsPrintLastLog no. English is only suppressed aftersshd -tandsshd -Tconfirmusepam yesandprintlastlog no, and after the activessh/sshdservice reloads successfully; any failure rolls the disk back.Scope
tools/setup-motd.sh,modules/system-customize.sh(identical payload and hook logic),tests/test-motd.sh. No change to shell prompt, background, accounts, or services at build time.Validation
bash -npasses for both entrypoints and the test script;git diff --checkis clean.lslogins, unsupported util-linux, administrator PAMpam_exec, administrator drop-in,sshd -tfailure,printlastlogunconfirmed,UsePAM no, reload failure on install and on restore, idempotent re-install, post-install administrator edits, and legacy snapshots without hook state.Risks
pam_execand the PAMpam_motdanchor; without them the tool keeps the original English line.ssh.service/sshd.service; socket-activated listeners are not restarted.Rollback
The MOTD restore path removes the drop-in and reloads the English message before removing the PAM line. Manually, delete
60-linux-setup-last-login.conf, drop the# linux-setup:last-login-hookline from/etc/pam.d/sshd, andsystemctl reload ssh.