Re: s6/s6-rc policy for Gentoo: user session tracking
That said, it might be of interest to you, that s6-setlock does not appear here: https://skarnet.org/software/s6/index.html. Whoops. And nobody noticed that in 13 years? Shame on all of you. :P Fixed, thanks! -- Laurent
Re: s6/s6-rc policy for Gentoo: user session tracking
Yes - but since you're using s6 anyway, you also have s6-setlock, which features more options than flock. ;) I will happily use s6-setlock! That said, it might be of interest to you, that s6-setlock does not appear here: https://skarnet.org/software/s6/index.html. I wish you a nice week! Paul OpenPGP_0x71C7C85A2EA30F62.asc Description: OpenPGP public key OpenPGP_signature.asc Description: OpenPGP digital signature
Re: s6/s6-rc policy for Gentoo: user session tracking
Good point. If I understood everything correctly, this can be easily solved by the "flock" command, right? Yes - but since you're using s6 anyway, you also have s6-setlock, which features more options than flock. ;) -- Laurent
Re: s6/s6-rc policy for Gentoo: user session tracking
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. Good point. If I understood everything correctly, this can be easily solved by the "flock" command, right? 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. Indeed. Have a nice weekend! Paul OpenPGP_0x71C7C85A2EA30F62.asc Description: OpenPGP public key OpenPGP_signature.asc Description: OpenPGP digital signature
Re: s6/s6-rc policy for Gentoo: user session tracking
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 r...@ringlet.net r...@debian.org pe...@morpheusly.com PGP key:https://www.ringlet.net/roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 signature.asc Description: PGP signature