Chapter 2. Configuring SSO for Argo CD using Dex
After the Red Hat OpenShift GitOps Operator is installed, Argo CD automatically creates a user with admin permissions. To manage multiple users, cluster administrators can use Argo CD to configure Single Sign-On (SSO).
The spec.dex parameter in the ArgoCD CR is deprecated. In a future release of Red Hat OpenShift GitOps v1.10.0, configuring Dex using the spec.dex parameter in the ArgoCD CR is planned to be removed. Consider using the .spec.sso parameter instead.
2.1. Configuration to enable the Dex OpenShift OAuth Connector Copy linkLink copied to clipboard!
Dex is installed by default for all the Argo CD instances created by the Operator. Dex uses the users and groups defined within OpenShift by checking the OAuth server provided by the platform. You can configure the options for the Dex SSO provider. The following example shows the properties of Dex along with example configurations:
- 1
- The
openShiftOAuthproperty triggers the Operator to automatically configure the built-in OpenShiftOAuthserver when the value is set totrue. - 2
- The
groupsproperty allows users of the specified group(s) to log in. - 3
- The RBAC policy property assigns the admin role in the Argo CD cluster to users in the OpenShift
cluster-adminsgroup.
2.1.1. Mapping users to specific roles Copy linkLink copied to clipboard!
Argo CD cannot map users to specific roles if they have a direct ClusterRoleBinding role. You can manually change the role as role:admin on SSO through OpenShift.
Procedure
Create a group named
cluster-admins.oc adm groups new cluster-admins
$ oc adm groups new cluster-adminsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the user to the group.
oc adm groups add-users cluster-admins USER
$ oc adm groups add-users cluster-admins USERCopy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
cluster-adminClusterRoleto the group:oc adm policy add-cluster-role-to-group cluster-admin cluster-admins
$ oc adm policy add-cluster-role-to-group cluster-admin cluster-adminsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2. Disabling Dex Copy linkLink copied to clipboard!
Dex is installed by default for all the Argo CD instances created by the Operator. You can configure Red Hat OpenShift GitOps to use Dex as the SSO authentication provider by setting the .spec.dex parameter.
In Red Hat OpenShift GitOps v1.6.0, DISABLE_DEX is deprecated and is planned to be removed in Red Hat OpenShift GitOps v1.10.0. Consider using the .spec.sso.dex parameter instead. See "Enabling or disabling Dex using .spec.sso".
Procedure
Set the environmental variable
DISABLE_DEXtotruein the YAML resource of the Operator:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Enabling or disabling Dex using .spec.sso Copy linkLink copied to clipboard!
You can configure Red Hat OpenShift GitOps to use Dex as its SSO authentication provider by setting the .spec.sso parameter.
Procedure
To enable Dex, set the
.spec.sso.provider: dexparameter in the YAML resource of the Operator:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
To disable dex, either remove the
spec.ssoelement from the Argo CD custom resource, or specify a different SSO provider.