Different session timeouts and 2FA requirements for Internal vs. External access

Which general topic do you have

Hi everyone,

I’m running Nextcloud AIO and would like to configure different session lifetimes depending on whether a user is accessing from inside the internal network or from outside (e.g. over the internet):

  • Internal users (LAN or VPN): 8-hour session
  • External users (internet): 15-minute session

I know that config.php only allows a single global value for `session_lifetime

I also looked into running two instances with the same Database but i would imagine that will cause problems with data synchronization.

Has anyone solved this problem? Is there a Nextcloud-native way to hook into session creation early enough to set session.gc_maxlifetime per request? Or is there perhaps an undocumented config option I’m missing?

Any ideas appreciated thanks!