github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/user-management/index.md (about) 1 # Overview 2 3 Once installed Argo CD has one built-in `admin` user that has full access to the system. It is recommended to use `admin` user only 4 for initial configuration and then switch to local users or configure SSO integration. 5 6 ## Local users/accounts 7 8 The local users/accounts feature serves two main use-cases: 9 10 * Auth tokens for Argo CD management automation. It is possible to configure an API account with limited permissions and generate an authentication token. 11 Such token can be used to automatically create applications, projects etc. 12 * Additional users for a very small team where use of SSO integration might be considered an overkill. The local users don't provide advanced features such as groups, 13 login history etc. So if you need such features it is strongly recommended to use SSO. 14 15 !!! note 16 When you create local users, each of those users will need additional [RBAC rules](../rbac.md) set up, otherwise they will fall back to the default policy specified by `policy.default` field of the `argocd-rbac-cm` ConfigMap. 17 18 The maximum length of a local account's username is 32. 19 20 ### Create new user 21 22 New users should be defined in `argocd-cm` ConfigMap: 23 24 ```yaml 25 apiVersion: v1 26 kind: ConfigMap 27 metadata: 28 name: argocd-cm 29 namespace: argocd 30 labels: 31 app.kubernetes.io/name: argocd-cm 32 app.kubernetes.io/part-of: argocd 33 data: 34 # add an additional local user with apiKey and login capabilities 35 # apiKey - allows generating API keys 36 # login - allows to login using UI 37 accounts.alice: apiKey, login 38 # disables user. User is enabled by default 39 accounts.alice.enabled: "false" 40 ``` 41 42 Each user might have two capabilities: 43 44 * apiKey - allows generating authentication tokens for API access 45 * login - allows to login using UI 46 47 ### Delete user 48 49 In order to delete a user, you must remove the corresponding entry defined in the `argocd-cm` ConfigMap: 50 51 Example: 52 53 ```bash 54 kubectl patch -n argocd cm argocd-cm --type='json' -p='[{"op": "remove", "path": "/data/accounts.alice"}]' 55 ``` 56 57 It is recommended to also remove the password entry in the `argocd-secret` Secret: 58 59 Example: 60 61 ```bash 62 kubectl patch -n argocd secrets argocd-secret --type='json' -p='[{"op": "remove", "path": "/data/accounts.alice.password"}]' 63 ``` 64 65 ### Disable admin user 66 67 As soon as additional users are created it is recommended to disable `admin` user: 68 69 ```yaml 70 apiVersion: v1 71 kind: ConfigMap 72 metadata: 73 name: argocd-cm 74 namespace: argocd 75 labels: 76 app.kubernetes.io/name: argocd-cm 77 app.kubernetes.io/part-of: argocd 78 data: 79 admin.enabled: "false" 80 ``` 81 82 ### Manage users 83 84 The Argo CD CLI provides set of commands to set user password and generate tokens. 85 86 * Get full users list 87 ```bash 88 argocd account list 89 ``` 90 91 * Get specific user details 92 ```bash 93 argocd account get --account <username> 94 ``` 95 96 * Set user password 97 ```bash 98 # if you are managing users as the admin user, <current-user-password> should be the current admin password. 99 argocd account update-password \ 100 --account <name> \ 101 --current-password <current-user-password> \ 102 --new-password <new-user-password> 103 ``` 104 105 * Generate auth token 106 ```bash 107 # if flag --account is omitted then Argo CD generates token for current user 108 argocd account generate-token --account <username> 109 ``` 110 111 ### Failed logins rate limiting 112 113 Argo CD rejects login attempts after too many failed in order to prevent password brute-forcing. 114 The following environments variables are available to control throttling settings: 115 116 * `ARGOCD_SESSION_FAILURE_MAX_FAIL_COUNT`: Maximum number of failed logins before Argo CD starts 117 rejecting login attempts. Default: 5. 118 119 * `ARGOCD_SESSION_FAILURE_WINDOW_SECONDS`: Number of seconds for the failure window. 120 Default: 300 (5 minutes). If this is set to 0, the failure window is 121 disabled and the login attempts gets rejected after 10 consecutive logon failures, 122 regardless of the time frame they happened. 123 124 * `ARGOCD_SESSION_MAX_CACHE_SIZE`: Maximum number of entries allowed in the 125 cache. Default: 1000 126 127 * `ARGOCD_MAX_CONCURRENT_LOGIN_REQUESTS_COUNT`: Limits max number of concurrent login requests. 128 If set to 0 then limit is disabled. Default: 50. 129 130 ## SSO 131 132 There are two ways that SSO can be configured: 133 134 * [Bundled Dex OIDC provider](#dex) - use this option if your current provider does not support OIDC (e.g. SAML, 135 LDAP) or if you wish to leverage any of Dex's connector features (e.g. the ability to map GitHub 136 organizations and teams to OIDC groups claims). Dex also supports OIDC directly and can fetch user 137 information from the identity provider when the groups cannot be included in the IDToken. 138 139 * [Existing OIDC provider](#existing-oidc-provider) - use this if you already have an OIDC provider which you are using (e.g. 140 [Okta](okta.md), [OneLogin](onelogin.md), [Auth0](auth0.md), [Microsoft](microsoft.md), [Keycloak](keycloak.md), 141 [Google (G Suite)](google.md)), where you manage your users, groups, and memberships. 142 143 ## Dex 144 145 Argo CD embeds and bundles [Dex](https://github.com/dexidp/dex) as part of its installation, for the 146 purpose of delegating authentication to an external identity provider. Multiple types of identity 147 providers are supported (OIDC, SAML, LDAP, GitHub, etc...). SSO configuration of Argo CD requires 148 editing the `argocd-cm` ConfigMap with 149 [Dex connector](https://dexidp.io/docs/connectors/) settings. 150 151 This document describes how to configure Argo CD SSO using GitHub (OAuth2) as an example, but the 152 steps should be similar for other identity providers. 153 154 ### 1. Register the application in the identity provider 155 156 In GitHub, register a new application. The callback address should be the `/api/dex/callback` 157 endpoint of your Argo CD URL (e.g. `https://argocd.example.com/api/dex/callback`). 158 159  160 161 After registering the app, you will receive an OAuth2 client ID and secret. These values will be 162 inputted into the Argo CD configmap. 163 164  165 166 ### 2. Configure Argo CD for SSO 167 168 Edit the argocd-cm configmap: 169 170 ```bash 171 kubectl edit configmap argocd-cm -n argocd 172 ``` 173 174 * In the `url` key, input the base URL of Argo CD. In this example, it is `https://argocd.example.com` 175 * In the `dex.config` key, add the `github` connector to the `connectors` sub field. See Dex's 176 [GitHub connector](https://github.com/dexidp/website/blob/main/content/docs/connectors/github.md) 177 documentation for explanation of the fields. A minimal config should populate the clientID, 178 clientSecret generated in Step 1. 179 * You will very likely want to restrict logins to one or more GitHub organization. In the 180 `connectors.config.orgs` list, add one or more GitHub organizations. Any member of the org will 181 then be able to login to Argo CD to perform management tasks. 182 183 ```yaml 184 data: 185 url: https://argocd.example.com 186 187 dex.config: | 188 connectors: 189 # GitHub example 190 - type: github 191 id: github 192 name: GitHub 193 config: 194 clientID: aabbccddeeff00112233 195 clientSecret: $dex.github.clientSecret # Alternatively $<some_K8S_secret>:dex.github.clientSecret 196 orgs: 197 - name: your-github-org 198 199 # GitHub enterprise example 200 - type: github 201 id: acme-github 202 name: Acme GitHub 203 config: 204 hostName: github.acme.example.com 205 clientID: abcdefghijklmnopqrst 206 clientSecret: $dex.acme.clientSecret # Alternatively $<some_K8S_secret>:dex.acme.clientSecret 207 orgs: 208 - name: your-github-org 209 ``` 210 211 After saving, the changes should take affect automatically. 212 213 NOTES: 214 215 * There is no need to set `redirectURI` in the `connectors.config` as shown in the dex documentation. 216 Argo CD will automatically use the correct `redirectURI` for any OAuth2 connectors, to match the 217 correct external callback URL (e.g. `https://argocd.example.com/api/dex/callback`) 218 * When using a custom secret (e.g., `some_K8S_secret` above,) it *must* have the label `app.kubernetes.io/part-of: argocd`. 219 220 ## OIDC Configuration with DEX 221 222 Dex can be used for OIDC authentication instead of ArgoCD directly. This provides a separate set of 223 features such as fetching information from the `UserInfo` endpoint and 224 [federated tokens](https://dexidp.io/docs/custom-scopes-claims-clients/#cross-client-trust-and-authorized-party) 225 226 ### Configuration: 227 * In the `argocd-cm` ConfigMap add the `OIDC` connector to the `connectors` sub field inside `dex.config`. 228 See Dex's [OIDC connect documentation](https://dexidp.io/docs/connectors/oidc/) to see what other 229 configuration options might be useful. We're going to be using a minimal configuration here. 230 * The issuer URL should be where Dex talks to the OIDC provider. There would normally be a 231 `.well-known/openid-configuration` under this URL which has information about what the provider supports. 232 e.g. https://accounts.google.com/.well-known/openid-configuration 233 234 235 ```yaml 236 data: 237 url: "https://argocd.example.com" 238 dex.config: | 239 connectors: 240 # OIDC 241 - type: oidc 242 id: oidc 243 name: OIDC 244 config: 245 issuer: https://example-OIDC-provider.example.com 246 clientID: aaaabbbbccccddddeee 247 clientSecret: $dex.oidc.clientSecret 248 ``` 249 250 ### Requesting additional ID token claims 251 252 By default Dex only retrieves the profile and email scopes. In order to retrieve more claims you 253 can add them under the `scopes` entry in the Dex configuration. To enable group claims through Dex, 254 `insecureEnableGroups` also needs to enabled. Group information is currently only refreshed at authentication 255 time and support to refresh group information more dynamically can be tracked here: [dexidp/dex#1065](https://github.com/dexidp/dex/issues/1065). 256 257 ```yaml 258 data: 259 url: "https://argocd.example.com" 260 dex.config: | 261 connectors: 262 # OIDC 263 - type: OIDC 264 id: oidc 265 name: OIDC 266 config: 267 issuer: https://example-OIDC-provider.example.com 268 clientID: aaaabbbbccccddddeee 269 clientSecret: $dex.oidc.clientSecret 270 insecureEnableGroups: true 271 scopes: 272 - profile 273 - email 274 - groups 275 ``` 276 277 !!! warning 278 Because group information is only refreshed at authentication time just adding or removing an account from a group will not change a user's membership until they reauthenticate. Depending on your organization's needs this could be a security risk and could be mitigated by changing the authentication token's lifetime. 279 280 ### Retrieving claims that are not in the token 281 282 When an Idp does not or cannot support certain claims in an IDToken they can be retrieved separately using 283 the UserInfo endpoint. Dex supports this functionality using the `getUserInfo` endpoint. One of the most 284 common claims that is not supported in the IDToken is the `groups` claim and both `getUserInfo` and `insecureEnableGroups` 285 must be set to true. 286 287 ```yaml 288 data: 289 url: "https://argocd.example.com" 290 dex.config: | 291 connectors: 292 # OIDC 293 - type: OIDC 294 id: oidc 295 name: OIDC 296 config: 297 issuer: https://example-OIDC-provider.example.com 298 clientID: aaaabbbbccccddddeee 299 clientSecret: $dex.oidc.clientSecret 300 insecureEnableGroups: true 301 scopes: 302 - profile 303 - email 304 - groups 305 getUserInfo: true 306 ``` 307 308 ## Existing OIDC Provider 309 310 To configure Argo CD to delegate authentication to your existing OIDC provider, add the OAuth2 311 configuration to the `argocd-cm` ConfigMap under the `oidc.config` key: 312 313 ```yaml 314 data: 315 url: https://argocd.example.com 316 317 oidc.config: | 318 name: Okta 319 issuer: https://dev-123456.oktapreview.com 320 clientID: aaaabbbbccccddddeee 321 clientSecret: $oidc.okta.clientSecret 322 323 # Optional list of allowed aud claims. If omitted or empty, defaults to the clientID value above (and the 324 # cliClientID, if that is also specified). If you specify a list and want the clientID to be allowed, you must 325 # explicitly include it in the list. 326 # Token verification will pass if any of the token's audiences matches any of the audiences in this list. 327 allowedAudiences: 328 - aaaabbbbccccddddeee 329 - qqqqwwwweeeerrrrttt 330 331 # Optional. If false, tokens without an audience will always fail validation. If true, tokens without an audience 332 # will always pass validation. 333 # Defaults to true for Argo CD < 2.6.0. Defaults to false for Argo CD >= 2.6.0. 334 skipAudienceCheckWhenTokenHasNoAudience: true 335 336 # Optional set of OIDC scopes to request. If omitted, defaults to: ["openid", "profile", "email", "groups"] 337 requestedScopes: ["openid", "profile", "email", "groups"] 338 339 # Optional set of OIDC claims to request on the ID token. 340 requestedIDTokenClaims: {"groups": {"essential": true}} 341 342 # Some OIDC providers require a separate clientID for different callback URLs. 343 # For example, if configuring Argo CD with self-hosted Dex, you will need a separate client ID 344 # for the 'localhost' (CLI) client to Dex. This field is optional. If omitted, the CLI will 345 # use the same clientID as the Argo CD server 346 cliClientID: vvvvwwwwxxxxyyyyzzzz 347 348 # PKCE authentication flow processes authorization flow from browser only - default false 349 # uses the clientID 350 # make sure the Identity Provider (IdP) is public and doesn't need clientSecret 351 # make sure the Identity Provider (IdP) has this redirect URI registered: https://argocd.example.com/pkce/verify 352 enablePKCEAuthentication: true 353 ``` 354 355 !!! note 356 The callback address should be the /auth/callback endpoint of your Argo CD URL 357 (e.g. https://argocd.example.com/auth/callback). 358 359 ### Requesting additional ID token claims 360 361 Not all OIDC providers support a special `groups` scope. E.g. Okta, OneLogin and Microsoft do support a special 362 `groups` scope and will return group membership with the default `requestedScopes`. 363 364 Other OIDC providers might be able to return a claim with group membership if explicitly requested to do so. 365 Individual claims can be requested with `requestedIDTokenClaims`, see 366 [OpenID Connect Claims Parameter](https://connect2id.com/products/server/docs/guides/requesting-openid-claims#claims-parameter) 367 for details. The Argo CD configuration for claims is as follows: 368 369 ```yaml 370 oidc.config: | 371 requestedIDTokenClaims: 372 email: 373 essential: true 374 groups: 375 essential: true 376 value: org:myorg 377 acr: 378 essential: true 379 values: 380 - urn:mace:incommon:iap:silver 381 - urn:mace:incommon:iap:bronze 382 ``` 383 384 For a simple case this can be: 385 386 ```yaml 387 oidc.config: | 388 requestedIDTokenClaims: {"groups": {"essential": true}} 389 ``` 390 391 ### Retrieving group claims when not in the token 392 393 Some OIDC providers don't return the group information for a user in the ID token, even if explicitly requested using the `requestedIDTokenClaims` setting (Okta for example). They instead provide the groups on the user info endpoint. With the following config, Argo CD queries the user info endpoint during login for groups information of a user: 394 395 ```yaml 396 oidc.config: | 397 enableUserInfoGroups: true 398 userInfoPath: /userinfo 399 userInfoCacheExpiration: "5m" 400 ``` 401 402 **Note: If you omit the `userInfoCacheExpiration` setting or if it's greater than the expiration of the ID token, the argocd-server will cache group information as long as the ID token is valid!** 403 404 ### Configuring a custom logout URL for your OIDC provider 405 406 Optionally, if your OIDC provider exposes a logout API and you wish to configure a custom logout URL for the purposes of invalidating 407 any active session post logout, you can do so by specifying it as follows: 408 409 ```yaml 410 oidc.config: | 411 name: example-OIDC-provider 412 issuer: https://example-OIDC-provider.example.com 413 clientID: xxxxxxxxx 414 clientSecret: xxxxxxxxx 415 requestedScopes: ["openid", "profile", "email", "groups"] 416 requestedIDTokenClaims: {"groups": {"essential": true}} 417 logoutURL: https://example-OIDC-provider.example.com/logout?id_token_hint={{token}} 418 ``` 419 By default, this would take the user to their OIDC provider's login page after logout. If you also wish to redirect the user back to Argo CD after logout, you can specify the logout URL as follows: 420 421 ```yaml 422 ... 423 logoutURL: https://example-OIDC-provider.example.com/logout?id_token_hint={{token}}&post_logout_redirect_uri={{logoutRedirectURL}} 424 ``` 425 426 You are not required to specify a logoutRedirectURL as this is automatically generated by ArgoCD as your base ArgoCD url + Rootpath 427 428 !!! note 429 The post logout redirect URI may need to be whitelisted against your OIDC provider's client settings for ArgoCD. 430 431 ### Configuring a custom root CA certificate for communicating with the OIDC provider 432 433 If your OIDC provider is setup with a certificate which is not signed by one of the well known certificate authorities 434 you can provide a custom certificate which will be used in verifying the OIDC provider's TLS certificate when 435 communicating with it. 436 Add a `rootCA` to your `oidc.config` which contains the PEM encoded root certificate: 437 438 ```yaml 439 oidc.config: | 440 ... 441 rootCA: | 442 -----BEGIN CERTIFICATE----- 443 ... encoded certificate data here ... 444 -----END CERTIFICATE----- 445 ``` 446 447 448 ## SSO Further Reading 449 450 ### Sensitive Data and SSO Client Secrets 451 452 `argocd-secret` can be used to store sensitive data which can be referenced by ArgoCD. Values starting with `$` in configmaps are interpreted as follows: 453 454 - If value has the form: `$<secret>:a.key.in.k8s.secret`, look for a k8s secret with the name `<secret>` (minus the `$`), and read its value. 455 - Otherwise, look for a key in the k8s secret named `argocd-secret`. 456 457 #### Example 458 459 SSO `clientSecret` can thus be stored as a Kubernetes secret with the following manifests 460 461 `argocd-secret`: 462 ```yaml 463 apiVersion: v1 464 kind: Secret 465 metadata: 466 name: argocd-secret 467 namespace: argocd 468 labels: 469 app.kubernetes.io/name: argocd-secret 470 app.kubernetes.io/part-of: argocd 471 type: Opaque 472 data: 473 ... 474 # The secret value must be base64 encoded **once** 475 # this value corresponds to: `printf "hello-world" | base64` 476 oidc.auth0.clientSecret: "aGVsbG8td29ybGQ=" 477 ... 478 ``` 479 480 `argocd-cm`: 481 ```yaml 482 apiVersion: v1 483 kind: ConfigMap 484 metadata: 485 name: argocd-cm 486 namespace: argocd 487 labels: 488 app.kubernetes.io/name: argocd-cm 489 app.kubernetes.io/part-of: argocd 490 data: 491 ... 492 oidc.config: | 493 name: Auth0 494 clientID: aabbccddeeff00112233 495 496 # Reference key in argocd-secret 497 clientSecret: $oidc.auth0.clientSecret 498 ... 499 ``` 500 501 #### Alternative 502 503 If you want to store sensitive data in **another** Kubernetes `Secret`, instead of `argocd-secret`. ArgoCD knows to check the keys under `data` in your Kubernetes `Secret` for a corresponding key whenever a value in a configmap starts with `$`, then your Kubernetes `Secret` name and `:` (colon). 504 505 Syntax: `$<k8s_secret_name>:<a_key_in_that_k8s_secret>` 506 507 > NOTE: Secret must have label `app.kubernetes.io/part-of: argocd` 508 509 ##### Example 510 511 `another-secret`: 512 ```yaml 513 apiVersion: v1 514 kind: Secret 515 metadata: 516 name: another-secret 517 namespace: argocd 518 labels: 519 app.kubernetes.io/part-of: argocd 520 type: Opaque 521 data: 522 ... 523 # Store client secret like below. 524 # Ensure the secret is base64 encoded 525 oidc.auth0.clientSecret: <client-secret-base64-encoded> 526 ... 527 ``` 528 529 `argocd-cm`: 530 ```yaml 531 apiVersion: v1 532 kind: ConfigMap 533 metadata: 534 name: argocd-cm 535 namespace: argocd 536 labels: 537 app.kubernetes.io/name: argocd-cm 538 app.kubernetes.io/part-of: argocd 539 data: 540 ... 541 oidc.config: | 542 name: Auth0 543 clientID: aabbccddeeff00112233 544 # Reference key in another-secret (and not argocd-secret) 545 clientSecret: $another-secret:oidc.auth0.clientSecret # Mind the ':' 546 ... 547 ``` 548 549 ### Skipping certificate verification on OIDC provider connections 550 551 By default, all connections made by the API server to OIDC providers (either external providers or the bundled Dex 552 instance) must pass certificate validation. These connections occur when getting the OIDC provider's well-known 553 configuration, when getting the OIDC provider's keys, and when exchanging an authorization code or verifying an ID 554 token as part of an OIDC login flow. 555 556 Disabling certificate verification might make sense if: 557 * You are using the bundled Dex instance **and** your Argo CD instance has TLS configured with a self-signed certificate 558 **and** you understand and accept the risks of skipping OIDC provider cert verification. 559 * You are using an external OIDC provider **and** that provider uses an invalid certificate **and** you cannot solve 560 the problem by setting `oidcConfig.rootCA` **and** you understand and accept the risks of skipping OIDC provider cert 561 verification. 562 563 If either of those two applies, then you can disable OIDC provider certificate verification by setting 564 `oidc.tls.insecure.skip.verify` to `"true"` in the `argocd-cm` ConfigMap.