Configure OAuth tokens to expire after a set period of inactivity
An XCCDF Rule
Description
You can configure OAuth tokens to expire after a set period of inactivity. By default, no token inactivity timeout is set.
The inactivity timeout can be either set in the OAuth server configuration or in any of the OAuth clients. The client settings override the OAuth server setting.
To set the OAuth server inactivity timeout, edit the OAuth server
object: oc edit oauth cluster
and set the .spec.tokenConfig.accessTokenInactivityTimeout
parameter to the desired value:
apiVersion: config.openshift.io/v1 kind: OAuth metadata: ... spec: tokenConfig: accessTokenInactivityTimeout: 10m0sFor more information on configuring the OAuth server, consult the OpenShift documentation: https://docs.openshift.com/container-platform/4.7/authentication/configuring-oauth-clients.htmlPlease note that the OAuth server converts the value internally to a human-readable format, so that e.g. setting accessTokenInactivityTimeout=600s would be converted by the OAuth server to accessTokenInactivityTimeout=10m0s.
To edit the OAuth client inactivity timeout, edit the OAuth client
object: oc edit oauthclient $clientname
and set the top-level accessTokenInactivityTimeoutSeconds
attribute.
apiVersion: oauth.openshift.io/v1 grantMethod: auto kind: OAuthClient metadata: ... accessTokenInactivityTimeoutSeconds: 600For more information on configuring the OAuth clients, consult the OpenShift documentation: https://access.redhat.com/documentation/en-us/openshift_container_platform/4.7/html-single/authentication_and_authorization/index#oauth-token-inactivity-timeout_configuring-internal-oauth
warning alert: Warning
/apis/oauth.openshift.io/v1/oauthclients
API endpoint to the local /apis/oauth.openshift.io/v1/oauthclients
file /apis/config.openshift.io/v1/oauths/cluster
API endpoint to the local /apis/config.openshift.io/v1/oauths/cluster
file .Rationale
Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a session that has been left unattended.
- ID
- xccdf_org.ssgproject.content_rule_oauth_or_oauthclient_inactivity_timeout
- Severity
- Medium
- References
- Updated
Remediation - Kubernetes Patch
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
tokenConfig: