github.com/pachyderm/pachyderm@v1.13.4/doc/docs/master/enterprise/auth/saml/saml.md (about)

     1  # Overview
     2  
     3  This guide walks you through an example of using Pachyderm's SAML support, including the
     4  following:
     5  
     6  1. Activate Pachyderm enterprise and Pachyderm auth.
     7  2. Configure Pachyderm's auth system to enable its SAML ACS, receive SAML
     8     assertions, and allow you to log in by using the Okta® access management
     9     software.
    10  3. Log in to both the dash and CLI.
    11  
    12  !!! note
    13      Although this section describes how to enable SAML with Okta, you can
    14      configure Okta with OIDC with a corresponding
    15      [OIDC auth config](../../oidc/configure-keycloak/#configure-keycloak).
    16  
    17  ## Activation
    18  
    19  When starting out, we **highly** recommend running Pachyderm in Minikube, as
    20  mistakes in this configuration could lock you out of your cluster.
    21  
    22  To activate Pachyderm enterprise and Pachyderm auth:
    23  
    24  ```
    25  pachctl enterprise activate <enterprise code>
    26  pachctl auth activate --initial-admin=robot:admin
    27  ```
    28  
    29  At this point, Pachyderm is ready to authenticate & authorize users.
    30  
    31  What the `--initial-admin` flag does is this:
    32  1. Pachyderm requires there to be at least one cluster admin if auth is
    33     activated
    34  2. Pachyderm's authentication is built around GitHub by default. Without this
    35     flag, Pachyderm asks the caller to go through an OAuth flow with GitHub, and
    36     then at the conclusion, makes the caller the cluster admin. Then whoever
    37     activated Pachyderm's auth system can modify it by re-authenticating via
    38     GitHub and performing any necessary actions
    39  3. To avoid the OAuth flow, though, it's also possible to make the initial
    40     cluster admin a "robot user". This is what
    41     `--initial-admin=robot:<something>` does.
    42  4. Pachyderm will print out a Pachyderm token that authenticates the holder as
    43     this robot user. At any point, you can authenticate as this robot user by
    44     running the following command:
    45  
    46     ```shell
    47     pachctl auth use-auth-token
    48     ```
    49  
    50     **System response:**
    51  
    52     ```shell
    53     Please paste your Pachyderm auth token:
    54     <paste robot token emitted by "pachctl auth activate --initial-admin=robot:admin">
    55     # you are now robot:admin, cluster administrator
    56     ```
    57  
    58  The rest of this example assumes that your Pachyderm cluster is running in
    59  minikube, and you're accessing it via `pachctl`'s port forwarding. Many of the
    60  SAML service provider URLs below are set to some variation of `localhost`,
    61  which will only work if you're using port forwarding and your browser is able
    62  to access Pachyderm via `localhost` on the port forwarder's usual ports.
    63  
    64  ## Create IdP test app
    65  The ID provider (IdP) that this example uses is Okta. Here is an example
    66  configuration for an Okta test app that authenticates Okta users
    67  with Pachyderm:
    68  
    69  ![Okta test app config](https://raw.githubusercontent.com/pachyderm/pachyderm/handle_requests_crewjam/doc/auth/okta_form.png)
    70  
    71  Once created, you can get the IdP Metadata URL associated with the test Okta
    72  app here:
    73  
    74  ![Metadata image](https://raw.githubusercontent.com/pachyderm/pachyderm/handle_requests_crewjam/doc/auth/IdPMetadata_highlight.png)
    75  
    76  ## Write Pachyderm config
    77  Broadly, setting an auth config is what enables SAML in Pachyderm
    78  (specifically, it enables Pachyderm's ACS). Below is an example config that will
    79  allow users to authenticate in your Pachyderm cluster using the Okta app above.
    80  Note that this example assumes
    81  
    82  ```
    83  # Lookup current config version--pachyderm config has a barrier to prevent
    84  # read-modify-write conflicts between admins
    85  live_config_version="$(pachctl auth get-config | jq .live_config_version)"
    86  live_config_version="${live_config_version:-0}"
    87  # Set the Pachyderm config
    88  pachctl auth set-config <<EOF
    89  {
    90    # prevent read-modify-write conflicts by explicitly specifying live version
    91    "live_config_version": ${live_config_version},
    92    "id_providers": [
    93      {
    94        "name": "okta",
    95        "description": "Okta test app",
    96        "saml": {
    97          "metadata_url": <okta app metadata URL>,
    98          "group_attribute": "memberOf" # optional: enable group support
    99        }
   100      }
   101    ],
   102    "saml_svc_options": {
   103      # These URLs work if using pachctl port-forward
   104      "acs_url": "http://localhost:30654/saml/acs",
   105      "metadata_url": "http://localhost:30654/saml/metadata",
   106      "dash_url": "http://localhost:30080/auth/autologin",
   107    }
   108  }
   109  EOF
   110  ```
   111  
   112  ## Logging In
   113  Currently Pachyderm only supports IdP-initiated authentication. To proceed,
   114  configure your Okta app to point to the Pachyderm ACS
   115  (`http://localhost:30654/saml/acs` if using `pachctl`'s port forwarding), then
   116  sign in via the new Okta app in your Okta dashboard.
   117  
   118  After clicking on the test Okta app, your browser will do a SAML authentication
   119  handshake with your pachyderm cluster, and you will arrive at your Pachyderm
   120  dashboard fully authenticated. To log in with the Pachyderm CLI, get a One-Time
   121  Password from the Pachyderm dash, and then run `pachctl auth login
   122  --code=<one-time password>` in your terminal.
   123  
   124  ### Groups
   125  If your SAML ID provider supports setting group attributes, you can use groups to manage access in Pachyderm with the `"group_attribute"` in the IDProvider field of the auth config:
   126  ```
   127  pachctl auth set-config <<EOF
   128  {
   129    ...
   130    "id_providers": [
   131      {
   132        ...
   133        "saml": {
   134          "group_attribute": "memberOf"
   135        }
   136      }
   137    ],
   138  }
   139  EOF
   140  ```
   141  
   142  Then, try:
   143  ```
   144  pachctl create repo group-test
   145  pachctl put file group-test@master -f some-data.txt
   146  pachctl auth set group/saml:"Test Group" reader group-test
   147  ```
   148  
   149  Elsewhere:
   150  ```
   151  pachctl auth login --code=<auth code>
   152  pachctl get file group-test@master:some-data.txt # should work for members of "Test Group"
   153  ```
   154