From 1bfba3b0be32306b078f5ee527b864e758b2c77b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 26 Apr 2019 15:52:54 +0000 Subject: Make a single hpr. Full doc, first draft. --- doc/s6-linux-init-logouthookd.html | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 doc/s6-linux-init-logouthookd.html (limited to 'doc/s6-linux-init-logouthookd.html') diff --git a/doc/s6-linux-init-logouthookd.html b/doc/s6-linux-init-logouthookd.html new file mode 100644 index 0000000..34f5bd8 --- /dev/null +++ b/doc/s6-linux-init-logouthookd.html @@ -0,0 +1,84 @@ + + + + + + s6-linux-init: the s6-linux-init-logouthookd program + + + + + + +

+s6-linux-init
+Software
+skarnet.org +

+ +

The s6-linux-init-logouthookd program

+ +

+ s6-linux-init-logouthookd cleans up its client's utmp record when it dies. +

+ +

Interface

+ +
+     s6-ipcserver socket s6-linux-init-logouthookd
+
+ +

+ s6-linux-init-logouthookd implements a +local service +for getty programs that add an utmp record when a user logs in. +

+ +

+ In the sysvinit model, getty/login and similar programs add an utmp +record for every user that logs in, then exec into the user's shell. +At logout time, the shell dies; sysvinit is supervising the getty +program, so it's watching the pid, and respawns the getty when the +shell dies. But before respawning the getty, it cleans up the +utmp record, to correctly report that the user isn't logged in on this +terminal anymore. +

+ +

+ utmp is an old, clunky, insecure system (unless you're using +utmps) and it is definitely +not pid 1's job to have any knowledge of utmp and play janitor after +getty. s6-svscan +definitely will not do it. +

+ +

+ Some distributions use versions of login that fork the user's +shell instead of execing it. When the user logs out, the login +program cleans up after itself. This is a better model, but it's not +always easy to patch login to go from a "exec the shell" model to a +"fork the shell as a child" model. +

+ +

+ s6-linux-init comes with a small library which makes it easy +for a distribution to fully support utmp cleanup with an s6 init system +if they so choose. Before execing into the user's shell, the login +program should just make a call to s6_linux_init_logouthook(), +and that's it. That function will call the s6-linux-init-logouthookd +local service, which will do nothing but wait until the user's shell dies; +and when it happens, the user's utmp record will automatically be cleaned up. +

+ +

Notes

+ + + + + -- cgit v1.2.3