mirror of
https://github.com/goauthentik/authentik.git
synced 2026-06-18 11:29:26 +03:00
3fd278e16d
* new first steps docs * moved email config up to match Docker * first draft * moved sections and retitled some * more content, tweaks * dewis edits * added Dewi ideas, more content, tweaks * more content, green tips, other fixes * Optimised images with calibre/image-actions * Optimised images with calibre/image-actions * Optimised images with calibre/image-actions * conflicts? * dominic's eedits, more content * another fine Dominic edit * more dewi and dominic edits, links * a bunch of things Signed-off-by: Jens Langhammer <jens@goauthentik.io> * tweaks * thanks Teffen * new styles, more content * few more dominic edits, tweaks * formatting fights on tips * fix some alignments Signed-off-by: Jens Langhammer <jens@goauthentik.io> * changes from Jens * work on bindings docs that was needed for the first steps docs * links, more tweaks * more edits, more TODOs done * add mermaid diagram, more links, more content * fix sidebar, tweaks * tweak * more link fixing * fix heading size * more dewi and dominic edits * more dewi and dominic edits * teffen enhancements yay and more bindings rearchitecting * added note about stage bindings being the only type of binding that you can bind to yeehaw --------- Signed-off-by: Tana M Berry <tanamarieberry@yahoo.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com> Co-authored-by: Dewi Roberts <dewi@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
96 lines
4.3 KiB
Plaintext
96 lines
4.3 KiB
Plaintext
---
|
|
title: AWS CLI authentication
|
|
sidebar_label: AWS
|
|
tags: [authentik Agent, authentik cli, aws, cli]
|
|
---
|
|
|
|
You can use the authentik Agent to authenticate to the AWS CLI with authentik credentials.
|
|
|
|
## Prerequisites
|
|
|
|
- The [authentik Agent deployed on it](../../authentik-agent/agent-deployment/index.mdx) must be deployed on your device.
|
|
|
|
## authentik configuration
|
|
|
|
To support the integration of authentik Agent with AWS CLI, you need to create an application/provider pair in authentik.
|
|
|
|
### Create an application and provider in authentik for AWS CLI
|
|
|
|
1. Log in to authentik as an administrator and open the authentik Admin interface.
|
|
2. Navigate to **Applications** > **Applications** and click **Create with Provider** to create an application and provider pair. (Alternatively you can first create a provider separately, then create the application and connect it with the provider.)
|
|
- **Application**: provide a descriptive name (e.g. `authentik-aws-cli`), an optional group for the type of application, the policy engine mode, and optional UI settings.
|
|
- **Choose a Provider type**: select **OAuth2/OpenID Connect** as the provider type.
|
|
- **Configure the Provider**: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
|
|
- Set the **Client type** to `Public`.
|
|
- Set the **Client ID** to `authentik-aws-cli`.
|
|
- Select any available signing key.
|
|
- Under **Machine-to-Machine authentication settings** add the `authentik-cli` provider as a **Federated OIDC Provider**.
|
|
- **Configure Bindings** _(optional)_: you can create a [binding](../../../add-secure-apps/bindings-overview/index.md) (policy, group, or user) to manage access to the application.
|
|
|
|
3. Click **Submit** to save the new application and provider.
|
|
|
|
## AWS configuration
|
|
|
|
To support the integration of AWS with the authentik Agent, you need to configure authentik CLI as an IDP and setup permission roles in AWS.
|
|
|
|
### Configure authentik CLI as an IDP in AWS
|
|
|
|
1. Log in to the AWS Management Console as an administrator that has permissions to create IAM roles and identity providers.
|
|
2. Open the [IAM Console](https://console.aws.amazon.com/iam/) and in the left sidebar under **Access Management**, click **Identity providers**.
|
|
3. Click **Add provider** and configure the following fields:
|
|
- **Provider type**: `OpenID Connect`
|
|
- **Provider URL**: `https://authentik.company/application/o/<application-slug>/`
|
|
- **Audience**: `authentik-aws-cli`
|
|
4. Click **Add provider**
|
|
5. On the **Identity providers** page, click on the name of the provider that you just added.
|
|
|
|
### Configure permissions in AWS
|
|
|
|
1. Log in to the AWS Management Console as an administrator that has permissions to create IAM roles and identity providers.
|
|
2. Open the [IAM Console](https://console.aws.amazon.com/iam/) and in the left sidebar under **Access Management**, click **Roles**.
|
|
3. Either create or edit a role that you want authentik users to be able to use.
|
|
4. Open the **Trust relationships** tab.
|
|
5. Click **Edit trust policy** and add the following, replacing `<account_id>` with your AWS Account ID:
|
|
|
|
```json
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Effect": "Allow",
|
|
"Principal": {
|
|
"Federated": "arn:aws:iam::<account_id>:oidc-provider/authentik.company/application/o/authentik-aws-cli/"
|
|
},
|
|
"Action": "sts:AssumeRoleWithWebIdentity",
|
|
"Condition": {
|
|
"StringEquals": {
|
|
"authentik.company/application/o/authentik-aws-cli/:aud": "authentik-aws-cli"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
6. Click **Update policy**.
|
|
7. Take note of the role ARN as it will be required in the next section.
|
|
|
|
### Configure AWS CLI to authenticate with authentik CLI
|
|
|
|
On the device running AWS CLI, update the `~/.aws/credentials` file with the following, replacing `<role_arn>` with the ARN of the role above:
|
|
|
|
```
|
|
[default]
|
|
credential_process = ak auth aws --client-id authentik-aws-cli --role-arn <role_arn>
|
|
```
|
|
|
|
To verify, run `aws sts get-caller-identity`, which should output something like this
|
|
|
|
```json
|
|
{
|
|
"UserId": "xxxxxx",
|
|
"Account": "<account_id>",
|
|
"Arn": "arn:aws:sts::<account_id>:assumed-role/<role name>/<authentik username>"
|
|
}
|
|
```
|