Sessions and sign-in
Posit Connect administrators can use this page to understand browser sessions, configure session limits, and manage reauthentication for sensitive actions and sign-in. To configure web sudo mode, identify the section for your authentication provider in the configuration file.
How sessions work
Connect stores sessions on the server. Connect generates a cryptographically secure identifier for each session and stores it in the rsconnect and rsconnect-legacy cookies. By default, the cookies are HttpOnly, which prevents JavaScript from accessing them. Connect uses the Secure attribute if you configure it to require HTTPS. When users sign in to Connect, a browser cookie keeps them logged in. For default session lifetime and details about changing it, see Limit session lifetime. The server periodically checks the data store for expired cookies and removes them. By default, the server does this once per hour. Configure the interval with Authentication.CookieSweepDuration. Cookie sweeping does not affect web session lifetime, which you can configure with Authentication.Lifetime. Connect uses session cookies to track and enforce both the session lifetime and inactivity threshold.
Limit session lifetime
The configuration file shipped with a fresh Connect installation sets the following browser-session limits:
- Connect invalidates sessions after 12 hours, regardless of activity.
- Connect invalidates sessions after 4 hours of inactivity.
If Authentication.Lifetime and Authentication.Inactivity are absent from the configuration file, Connect uses fallback values of 24 hours and 8 hours, respectively. Upgrades preserve configuration files, so your deployment can use different values. Review your configuration and set both limits explicitly to match your organization’s session policy.
After Connect invalidates a session, the user must sign in again before continuing to interact with Connect. Your identity provider determines whether signing in requires entering credentials or can reuse an identity-provider session. These settings govern browser sessions, not API key or service-token lifetimes.
Administrators can configure the session lifetime and inactivity threshold. Change the maximum session lifetime with Authentication.Lifetime. Set session inactivity with Authentication.Inactivity. Configure these session settings according to your organization’s security policies.
Shorter limits reduce unattended browser access but can interrupt interactive work and trigger more sign-in requests. The first configuration example keeps the 12-hour lifetime from the shipped configuration and reduces the inactivity threshold to 30 minutes. Users must sign in again after being idle for 30 minutes or after their session lasts for 12 hours. The 30-minute inactivity limit means sessions can remain idle “no longer than a lunch break.”
/etc/rstudio-connect/rstudio-connect.gcfg
[Authentication]
Lifetime = 12h
Inactivity = 30mThe second configuration example uses longer thresholds than the shipped configuration. Users must sign in again once a week or after being inactive for a full day. Use this configuration with care. Your organization might want users to sign in again more frequently.
/etc/rstudio-connect/rstudio-connect.gcfg
[Authentication]
Lifetime = 7d
Inactivity = 1dSession expiry does not immediately terminate the process for an application open in the user’s browser. Further attempts to interact with the application cause it to close and require the user to sign in again. The identity provider determines whether the user must reenter credentials.
Applications can outlive sessions when opened in Standalone mode if their timeout settings are greater than Authentication.Inactivity or Authentication.Lifetime. The settings Scheduler.ConnectionTimeout and Scheduler.ReadTimeout determine the default values for how long a browser running an application can remain idle. By default these are set to 1 hour but individual applications may set higher values independently from the server’s settings.
Require reauthentication for sensitive actions
When users perform a sensitive operation in a web browser, such as creating a new API key, Connect asks them to reenter their login credentials. After users enter the correct password, Connect places their session in a privileged state known internally as web sudo mode. Web sudo mode lets users perform these sensitive operations for a certain window of time without entering their password again. This privileged mode exists only within Connect and has no relation to the server’s actual sudo or Pluggable Authentication Modules (PAM) settings.
This feature is not available on servers configured to use Single Sign-On (SSO) via OAuth2, OpenID, SAML, or proxied authentication.
For all other authentication providers, the WebSudoMode and WebSudoModeDuration configuration options are available in the section for that provider. If WebSudoMode is set to false, Connect disables this protection. All authenticated users are then always in privileged mode. WebSudoModeDuration controls how long a user stays in this privileged mode. Configure these options in the section for your authentication provider, such as [Password], [PAM], or [LDAP]:
/etc/rstudio-connect/rstudio-connect.gcfg
; This example is using password authentication. Use PAM or LDAP as appropriate.
[Password]
WebSudoMode = true
WebSudoModeDuration = 10mIn this case, Connect prompts users for their password before they perform sensitive actions. Users can then perform sensitive actions for up to 10 minutes without another prompt. After that point, users must enter their password again before any sensitive action.
Regardless of the setting, web sudo mode does not affect calls made outside a browser using a token or an API key.
Protect sign-in from brute-force and dictionary attacks
With the PAM, LDAP, and Password authentication providers, users sign in by entering their user name and password on the Connect sign-in page. Connect does not rate-limit these sign-in attempts, so you can add a Completely Automated Public Turing test to tell Computers and Humans Apart (CAPTCHA) challenge to protect the page from automated attacks.
Set Authentication.ChallengeResponseEnabled to true to enable a CAPTCHA form on the login screen and require users to solve it to authenticate.
/etc/rstudio-connect/rstudio-connect.gcfg
[Authentication]
ChallengeResponseEnabled = trueBoth visual and audio CAPTCHA challenges are provided for accessibility needs.