I have auto-logout after <60> minutes of inactivity enable but dose not work.
I’ve gone away for hours and come back to find the session still logged in.
@Jamie, do you want to address the issue with socket connections and auto-logouts? The get_logout_time function keeps getting triggered because the session is being checked constantly by the stats.pl server.
Hmm… Works for me. I have a long time out because I don’t want stray sessions open. I am running the Virtualmin version. Could certain browsers be doing keep alives? I’m using Opera.
And an open WebSocket connection will never time out until it’s closed because control frames are sent every 10 or 20 seconds to keep it alive.
You can test this by setting the session timeout to 1 minute, disabling real-time monitoring in “Theme Configuration: Dashboard and real-time monitoring” by setting “Enable real-time monitoring” to “No,” restarting Webmin, and then opening the Terminal module—you’ll see keep-alive ping/pong frames every 20 seconds, whether you’re using the Terminal module or not, and code around get_logout_time will get triggered!
@chris.j76 After looking into it more, I think everything is working as expected! For the connection to time out when a WebSocket connection is established, you just need to close the browser tab.
With Opera, I let the system shut it down at night. This keeps me from having to log back into the forum. The captcha is a PITA so I like to avoid it. If time isn’t expired, I’m still logged into WM/VM. If it has, I get a re-authentication notification.
@Ilia Thanks for the information, I’ll just have to make sure the browser tab is closed.
the other issue is two-factor authentication enabled with provider TOTP
I have 2 accounts
Root and my account Chris.
the root token will work for Chris account and via versa. kinda defeats the purpose of MFA if any token will work.
But get_logout_time only returns a time that is compared with the last activity in the session DB, and that’s only updated when a new HTTP request is made. An existing websockets session shouldn’t trigger it ..
When the connection is upgraded and handle_websocket_request is called, it will keep sending that verify command every 10 seconds or so—there’s no need for an HTTP request…
Oh right I forgot about that! So yeah, in this case the session time will be updated as long as the browser has a Webmin window open.
I suppose then the question become what do you we consider “activity” ? Actual intentional operations like navigating around in the browser, or just having a page open?
Well, that’s a good question—intention is to receive stats from the socket and update the page without reloading.
Currently, we stop collecting data from the socket when the page is not focused, which means the page is not updated. However, we do not close the socket. Closing the socket every time a user loses focus on the browser can have negative effects.