<div dir="auto"><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 4, 2020, 23:31 Andy Pieters <<a href="mailto:systemd@andypieters.me.uk">systemd@andypieters.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, 4 May 2020 at 15:51, Andy Pieters <<a href="mailto:systemd@andypieters.me.uk" target="_blank" rel="noreferrer">systemd@andypieters.me.uk</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>I'm trying to accomplish the following:</div><div><br></div><div>An event happens -> I start a systemd service in response</div><div> after RuntimeMaxSec is reached service terminates and cleans up event</div><div><br></div><div>Should a second event happen whilst RuntimeMaxSec is not yet reached the</div><div> preference would be to reset RuntimeMaxSec of the service</div><div><br></div><div>Alternatively, I suppose I could shut down the service and restart it in reply to</div><div>a second or third or fourth event happening.</div><div><br></div><div>Any suggestions here?</div><div><br></div></div></blockquote><div><br></div><div>OK, I will give more info on what I want to do.</div><div>I have SSH login which requires 2FA. I use PAM to check if user belongs to group x</div><div>If user is in group X, normal authentication is performed</div><div>If user is not in group X, then 2F authentication is required.</div><div><br></div><div>That part is already working.</div><div><br></div><div>What I want to achieve:<br></div><div>a) when a user logs on using 2F authentication, add user to group x</div><div>b) after a delay remove user from group x</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">So this is basically for implementing sudo-like caching for 2FA?</div><div dir="auto"><br></div><div dir="auto">What authentication methods are involved here?</div><div dir="auto"><br></div><div dir="auto">Seems like there are better ways than a service file that permanently modifies /etc/group in the first place... Like a PAM module that literally touches a timestamp file.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>That part is trivial to do with some service file, either by starting a timer, or </div><div>using systemd-run or setting RuntimeMaxSec on a dummy service and using</div><div>the ExecStop= to remove the user from group x.</div><div><br></div><div>The problem:</div><div>* every new login in between a) and b) above should restart the delay timing</div><div> </div></div></div>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div></div></div>