Our work on Authentication and Authorization is based on industry best-practices.
We evaluated a set of tools that would meet our requirements in Authentication and Authorization in Automate Spike and decided on:
- Dex as OpenID solution
We added our own authn-service as glue between those services to add support for non-human clients. If you're interested, please read the design documentation.
For further questions, the team can be reached in the #a2-auth-team on Slack.
OKTA with SAML and AD with LDAP are the most common configurations among our users. We have also had success with the following configurations:
- OKTA
- Ping
- OneLogin
- Office365
- Tivoli Federated Identity Manager
- Microsoft Active Directory (MSAD)
- Azure AD with SAML: we cannot support SAML with Azure AD because Automate cannot consume SAML IdP metadata, which Azure relies on to rotate keys.
- Appleconnect with SAML: invalid signature error.
- In general, dex does not support idP initiated SSO. There is a PR in progress to add this functionality, last updated Sep 24, 2019.
This is the service used to authenticate requests coming through automate-gateway.
It tries to authenticate each request using the configured authenticators. The service currently defaults to the following two:
oidc
: this expects anAuthorization: bearer JWT
header, where JWT is a Dex-issued JWT ID tokenheader-token
: this expects aapi-token: TOKEN
header, where TOKEN is a token set up with the corresponding ("clients") token service. This can be done via automate-ui, or the API.
This services provides backs the session management in Automate 2.
It provides a set of simple HTTP endpoints, for consumption by browsers (automate-ui).
For getting a session, it will initiate the OIDC authorization code flow, and, when successful, redirect the browser to /signin#id_token=XYZ&state=ROUTE
.
Also, it stores the refresh_token
gathered during that login process, and allows for getting a new session using this refresh_token
, shortcutting the interactive login process.
It acts as an OIDC client to Dex:
client_id
: automate-sessionclient_secret
: secretChangeMeredirect_url
:/session/callback
For further details, please see components/session-service/
.
When executing the a2-api-smoke
or
a2-api-integration
, the automate_api_request
resources provided
by a2-resource-pack
takes care of signing you in.
This happens for every request, and does an "actual login", with going to dex, logging in using
the (hardcoded) local user credentials admin:chefautomate
, and reading the id_token
from the
final redirect.
The OIDC client configuration used here is
client_id
: automate-apiclient_secret
: none (public client)redirect_url
:http://localhost[:X][/path]
orurn:ietf:wg:oauth:2.0:oob
It is using the OIDC authorization code flow as a public client, which ends in an exchange of the id_token
for the code
.
The resource plucks the id_token
out of that response.
-
Why doesn't the
automate_api_request
resource use session-service?Because it's a few redirects more, and, annoyingly, depends on cookies to work correctly. (This doesn't mean that we don't pick that route in the future.)
-
There's an example Go method in
docs/examples/api_request.go
.
By default, any new user, team, or non-admin API token is denied access to everything. They all need to be added to teams or policies in order to be granted permission.
- Create an admin token using
export TOKEN=`chef-automate iam token create <your-token-name-here> --admin`
- Create a new role; this role will allow access to the Event Feed, Applications, and Projects list.
curl -k -sSH "api-token: $TOKEN" -d '{"name": "Example Role","id": "example-role", "actions": ["event:*", "applications:*", "iam:projects:list"]}' -X POST https://a2-dev.test/apis/iam/v2/roles?pretty
- Create a new policy using the role you just created. You can find out more about creating policies in our documentation.
curl -k -sSH "api-token: $TOKEN" -d '{"name": "Example Policy", "id": "example-policy", "statements": [{"effect": "ALLOW", "role": "example-role", "projects": ["*"]}]}' -X POST https://a2-dev.test/apis/iam/v2/policies?pretty
- Sign in with the username
admin
and passwordchefautomate
- Navigate to Settings > Users and create a new user
- Navigate to Settings > Policies > the policy you just created > Members
- Add the user you just created as a member of the policy
- Sign out as admin and sign in as your new user
- You should see the Event Feed, Applications, and Settings top-nav items, as that is what the user you just created has access to.