github.com/argoproj/argo-cd@v1.8.7/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 (v1.5)
     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 when SSO integration is 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  ### Disable admin user
    48  
    49  As soon as additional users are created it is recommended to disable `admin` user:
    50  
    51  ```yaml
    52  apiVersion: v1
    53  kind: ConfigMap
    54  metadata:
    55    name: argocd-cm
    56    namespace: argocd
    57    labels:
    58      app.kubernetes.io/name: argocd-cm
    59      app.kubernetes.io/part-of: argocd
    60  data:
    61    admin.enabled: "false"
    62  ```
    63  
    64  ### Manage users
    65  
    66  The Argo CD CLI provides set of commands to set user password and generate tokens.
    67  
    68  * Get full users list
    69  ```bash
    70  argocd account list
    71  ```
    72  
    73  * Get specific user details
    74  ```bash
    75  argocd account get <username>
    76  ```
    77  
    78  * Set user password
    79  ```bash
    80  argocd account update-password \
    81    --account <name> \
    82    --current-password <current-admin> \
    83    --new-password <new-user-password>
    84  ```
    85  
    86  * Generate auth token
    87  ```bash
    88  # if flag --account is omitted then Argo CD generates token for current user
    89  argocd account generate-token --account <username>
    90  ```
    91  
    92  ### Failed logins rate limiting
    93  
    94  Argo CD rejects login attempts after too many failed in order to prevent password brute-forcing.
    95  The following environments variables are available to control throttling settings:
    96  
    97  * `ARGOCD_SESSION_MAX_FAIL_COUNT`: Maximum number of failed logins before Argo CD starts
    98  rejecting login attempts. Default: 5.
    99  
   100  * `ARGOCD_SESSION_FAILURE_WINDOW_SECONDS`: Number of seconds for the failure window.
   101  Default: 300 (5 minutes). If this is set to 0, the failure window is
   102  disabled and the login attempts gets rejected after 10 consecutive logon failures,
   103  regardless of the time frame they happened.
   104  
   105  * `ARGOCD_SESSION_MAX_CACHE_SIZE`: Maximum number of entries allowed in the
   106  cache. Default: 1000
   107  
   108  * `ARGOCD_MAX_CONCURRENT_LOGIN_REQUESTS_COUNT`: Limits max number of concurrent login requests.
   109  If set to 0 then limit is disabled. Default: 50.
   110  
   111  ## SSO
   112  
   113  There are two ways that SSO can be configured:
   114  
   115  * [Bundled Dex OIDC provider](#dex) - use this option if your current provider does not support OIDC (e.g. SAML,
   116    LDAP) or if you wish to leverage any of Dex's connector features (e.g. the ability to map GitHub
   117    organizations and teams to OIDC groups claims).
   118  
   119  * [Existing OIDC provider](#existing-oidc-provider) - use this if you already have an OIDC provider which you are using (e.g.
   120    [Okta](okta.md), [OneLogin](onelogin.md), [Auth0](auth0.md), [Microsoft](microsoft.md), [Keycloak](keycloak.md),
   121    [Google (G Suite)](google.md)), where you manage your users, groups, and memberships.
   122  
   123  ## Dex
   124  
   125  Argo CD embeds and bundles [Dex](https://github.com/coreos/dex) as part of its installation, for the
   126  purpose of delegating authentication to an external identity provider. Multiple types of identity
   127  providers are supported (OIDC, SAML, LDAP, GitHub, etc...). SSO configuration of Argo CD requires
   128  editing the `argocd-cm` ConfigMap with
   129  [Dex connector](https://dexidp.io/docs/connectors/) settings.
   130  
   131  This document describes how to configure Argo CD SSO using GitHub (OAuth2) as an example, but the
   132  steps should be similar for other identity providers.
   133  
   134  ### 1. Register the application in the identity provider
   135  
   136  In GitHub, register a new application. The callback address should be the `/api/dex/callback`
   137  endpoint of your Argo CD URL (e.g. `https://argocd.example.com/api/dex/callback`).
   138  
   139  ![Register OAuth App](../../assets/register-app.png "Register OAuth App")
   140  
   141  After registering the app, you will receive an OAuth2 client ID and secret. These values will be
   142  inputted into the Argo CD configmap.
   143  
   144  ![OAuth2 Client Config](../../assets/oauth2-config.png "OAuth2 Client Config")
   145  
   146  ### 2. Configure Argo CD for SSO
   147  
   148  Edit the argocd-cm configmap:
   149  
   150  ```bash
   151  kubectl edit configmap argocd-cm -n argocd
   152  ```
   153  
   154  * In the `url` key, input the base URL of Argo CD. In this example, it is `https://argocd.example.com`
   155  * In the `dex.config` key, add the `github` connector to the `connectors` sub field. See Dex's
   156    [GitHub connector](https://github.com/coreos/dex/blob/master/Documentation/connectors/github.md)
   157    documentation for explanation of the fields. A minimal config should populate the clientID,
   158    clientSecret generated in Step 1.
   159  * You will very likely want to restrict logins to one or more GitHub organization. In the
   160    `connectors.config.orgs` list, add one or more GitHub organizations. Any member of the org will
   161    then be able to login to Argo CD to perform management tasks.
   162  
   163  ```yaml
   164  data:
   165    url: https://argocd.example.com
   166  
   167    dex.config: |
   168      connectors:
   169        # GitHub example
   170        - type: github
   171          id: github
   172          name: GitHub
   173          config:
   174            clientID: aabbccddeeff00112233
   175            clientSecret: $dex.github.clientSecret
   176            orgs:
   177            - name: your-github-org
   178  
   179        # GitHub enterprise example
   180        - type: github
   181          id: acme-github
   182          name: Acme GitHub
   183          config:
   184            hostName: github.acme.com
   185            clientID: abcdefghijklmnopqrst
   186            clientSecret: $dex.acme.clientSecret
   187            orgs:
   188            - name: your-github-org
   189  ```
   190  
   191  After saving, the changes should take affect automatically.
   192  
   193  NOTES:
   194  
   195  * Any values which start with '$' will look to a key in argocd-secret of the same name (minus the $),
   196    to obtain the actual value. This allows you to store the `clientSecret` as a kubernetes secret.
   197    Kubernetes secrets must be base64 encoded. To base64 encode your secret, you can run
   198    `printf RAW_STRING | base64`.
   199  * There is no need to set `redirectURI` in the `connectors.config` as shown in the dex documentation.
   200    Argo CD will automatically use the correct `redirectURI` for any OAuth2 connectors, to match the
   201    correct external callback URL (e.g. `https://argocd.example.com/api/dex/callback`)
   202  
   203  ## Existing OIDC Provider
   204  
   205  To configure Argo CD to delegate authenticate to your existing OIDC provider, add the OAuth2
   206  configuration to the `argocd-cm` ConfigMap under the `oidc.config` key:
   207  
   208  ```yaml
   209  data:
   210    url: https://argocd.example.com
   211  
   212    oidc.config: |
   213      name: Okta
   214      issuer: https://dev-123456.oktapreview.com
   215      clientID: aaaabbbbccccddddeee
   216      clientSecret: $oidc.okta.clientSecret
   217  
   218      # Optional set of OIDC scopes to request. If omitted, defaults to: ["openid", "profile", "email", "groups"]
   219      requestedScopes: ["openid", "profile", "email", "groups"]
   220  
   221      # Optional set of OIDC claims to request on the ID token.
   222      requestedIDTokenClaims: {"groups": {"essential": true}}
   223  
   224      # Some OIDC providers require a separate clientID for different callback URLs.
   225      # For example, if configuring Argo CD with self-hosted Dex, you will need a separate client ID
   226      # for the 'localhost' (CLI) client to Dex. This field is optional. If omitted, the CLI will
   227      # use the same clientID as the Argo CD server
   228      cliClientID: vvvvwwwwxxxxyyyyzzzz
   229  ```
   230  
   231  !!! note
   232      The callback address should be the /auth/callback endpoint of your Argo CD URL
   233      (e.g. https://argocd.example.com/auth/callback).
   234  
   235  ### Requesting additional ID token claims
   236  
   237  Not all OIDC providers support a special `groups` scope. E.g. Okta, OneLogin and Microsoft do support a special
   238  `groups` scope and will return group membership with the default `requestedScopes`.
   239  
   240  Other OIDC providers might be able to return a claim with group membership if explicitly requested to do so.
   241  Individual claims can be requested with `requestedIDTokenClaims`, see
   242  [OpenID Connect Claims Parameter](https://connect2id.com/products/server/docs/guides/requesting-openid-claims#claims-parameter)
   243  for details. The Argo CD configuration for claims is as follows:
   244  
   245  ```yaml
   246    oidc.config: |
   247      requestedIDTokenClaims:
   248        email:
   249          essential: true
   250        groups:
   251          essential: true
   252          value: org:myorg
   253        acr:
   254          essential: true
   255          values:
   256          - urn:mace:incommon:iap:silver
   257          - urn:mace:incommon:iap:bronze
   258  ```
   259  
   260  For a simple case this can be:
   261  
   262  ```yaml
   263    oidc.config: |
   264      requestedIDTokenClaims: {"groups": {"essential": true}}
   265  ```
   266  ### Configuring a custom logout URL for your OIDC provider
   267  
   268  Optionally, if your OIDC provider exposes a logout API and you wish to configure a custom logout URL for the purposes of invalidating 
   269  any active session post logout, you can do so by specifying it as follows:
   270  
   271  ```yaml
   272    oidc.config: |
   273      name: example-OIDC-provider
   274      issuer: https://example-OIDC-provider.com
   275      clientID: xxxxxxxxx
   276      clientSecret: xxxxxxxxx
   277      requestedScopes: ["openid", "profile", "email", "groups"]
   278      requestedIDTokenClaims: {"groups": {"essential": true}}
   279      logoutURL: https://example-OIDC-provider.com/logout?id_token_hint={{token}}
   280  ```
   281  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:
   282  
   283  ```yaml
   284  ...
   285      logoutURL: https://example-OIDC-provider.com/logout?id_token_hint={{token}}&post_logout_redirect_uri={{logoutRedirectURL}}
   286  ```
   287  
   288  You are not required to specify a logoutRedirectURL as this is automatically generated by ArgoCD as your base ArgoCD url + Rootpath
   289  
   290  !!! note
   291     The post logout redirect URI may need to be whitelisted against your OIDC provider's client settings for ArgoCD.