From: Peter Pentchev <roam@ringlet.net>
To: Paul Sopka <psopka@sopka.ch>
Cc: supervision@list.skarnet.org
Subject: Re: s6/s6-rc policy for Gentoo: user session tracking
Date: Sat, 13 Jul 2024 12:43:15 +0300 [thread overview]
Message-ID: <ZpJMM3izRR17mSYe@straylight.m.ringlet.net> (raw)
In-Reply-To: <af1a369d-5303-4b10-a088-ef6f51829e2d@sopka.ch>
[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]
On Thu, Jul 11, 2024 at 04:53:51PM +0200, Paul Sopka wrote:
> Since I was not 100% convinced by Turnstile, I made an attempt on a very
> simple alternative way to handle user session tracking.
>
> The (currently very crude) script only runs once on each login and logout
> and does the following:
>
> On login:
>
> - Possibly create a /run/session/${USER} directory.
>
> - Possibly start the user supervision tree (from S6/s6-rc or OpenRC, or
> anything but itself).
>
> - If it does not exist, create a file named after the login type (e.g. sshd)
> at /run/session/${USER}/${LOGIN_TYPE}.
>
> - Write a line (any content, but just one line) to
> /run/session/${USER}/${LOGIN_TYPE}.
>
> - If the line count in /run/session/${USER}/${LOGIN_TYPE} is 1, start the
> bundle corresponding to ${LOGIN_TYPE} e.g. sshd.
These two last points, if you really decide to implement them like that in
the final version, may require some synchronization, e.g. via file locking.
It is not impossible (I mean, it is quite unlikely, but especially with
automated CI systems not impossible *at all*) for two SSH sessions to
come in practically at once, and I have indeed seen shell startup scripts
run the same program at the same time.
It would be... interesting to have one login session write the first line,
then another session immediately write the second one, and then neither of
them will find exactly one line in the file :) And same for logout.
G'luck,
Peter
--
Peter Pentchev roam@ringlet.net roam@debian.org peter@morpheusly.com
PGP key: https://www.ringlet.net/roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-07-14 9:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 14:53 Paul Sopka
2024-07-13 9:43 ` Peter Pentchev [this message]
2024-07-13 10:22 ` Paul Sopka
2024-07-14 11:41 ` Laurent Bercot
2024-07-14 21:00 ` Paul Sopka
2024-07-15 15:34 ` Laurent Bercot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZpJMM3izRR17mSYe@straylight.m.ringlet.net \
--to=roam@ringlet.net \
--cc=psopka@sopka.ch \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).