Skip to content

Commit e5d0a2e

Browse files
authored
Merge pull request #615 from iterate-ch/issue/349-s3-microsoft-entra
Add tutorial to connect to S3 with Microsoft Entra ID configured as i…
2 parents fdb7c24 + 1edd332 commit e5d0a2e

File tree

9 files changed

+278
-12
lines changed

9 files changed

+278
-12
lines changed

protocols/profiles/aws_oidc.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,23 @@ Custom connection profile using OpenID Connect provider and AssumeRoleWithWebIde
88
* Mountain Duck [4.15.0](https://mountainduck.io/changelog/) or later required
99
:::
1010

11-
Connection [profiles](index.md#technical-file-format-specification) must include the `OAuth Authorization Url`, `OAuth Token Url`, `OAuth Redirect Url` and `Scopes` of the OpenID Connect (OIDC) identity provider and the `STS Endpoint` for the STS API endpoint which defaults to `https://sts.amazonaws.com/`. Set the property `s3.assumerole.rolearn` in the connection profile to the Role ARN configured in AWS. Set it to `s3.assumerole.rolearn=` for a prompt to enter on login.
11+
Connection [profiles](index.md#technical-file-format-specification) require the `Role Configurable` key to be set to `true` to enable authentication with temporary tokens from STS API. and include the `OAuth Authorization Url`, `OAuth Token Url`, `OAuth Redirect Url` and `Scopes` of the OpenID Connect (OIDC) identity provider and the `STS Endpoint` for the STS API endpoint which defaults to `https://sts.amazonaws.com/`. Set the property `role_arn` in the connection profile to the Role ARN configured in AWS to omit a prompt on login.
12+
1213

1314
## Prerequisites
1415

16+
:::{admonition} Microsoft Entra ID Tutorial
17+
:class: tip
18+
19+
Follow the [step-by-step instructions](../../tutorials/s3_microsoft_entra_oidc.md) to configure Microsoft Entra ID (formerly Azure AD) as a custom OIDC (OpenID Connect) identity provider (IdP) for S3.
20+
:::
21+
22+
:::{admonition} Google Cloud Tutorial
23+
:class: tip
24+
25+
Follow the [step-by-step instructions](../../tutorials/s3_google_oidc.md) to configure Google as a custom OIDC (OpenID Connect) identity provider (IdP) for S3.
26+
:::
27+
1528
- Register the OAuth Client ID with your identity provider (IdP)
1629
- Configure the OIDC provider in AWS IAM or compatible implementation like [MinIO Security Token Service (STS)](https://min.io/docs/minio/linux/developers/security-token-service.html)
1730
- Make sure to restrict access by configuring the role and trust policy using rules referencing the claims available in the JWT token from the identity provider that is passed to `AssumeRoleWithWebIdentity` STS API.
@@ -53,26 +66,28 @@ Refer to [Sample connection profiles for S3 and OpenID Connect Federation](https
5366
<false/>
5467
<key>Token Configurable</key>
5568
<false/>
69+
<key>Role Configurable</key>
70+
<true/>
5671
<key>Username Placeholder</key>
5772
<string>Username</string>
5873
<key>STS Endpoint</key>
5974
<string>https://sts.amazonaws.com/</string>
6075
<key>Properties</key>
6176
<dict>
62-
<key>s3.assumerole.rolearn</key>
77+
<key>role_arn</key>
6378
<string>arn:aws:iam::…</string>
6479
</dict>
6580
</dict>
6681
</plist>
6782
```
6883

6984
::::{tip}
70-
Alternatively set the `s3.assumerole.rolearn` per user in a `.duck` [bookmark](../../tutorials/hidden_properties.md#in-duck-bookmark-files) file.
85+
Alternatively set the `role_arn` per user in a `.duck` [bookmark](../../tutorials/hidden_properties.md#in-duck-bookmark-files) file.
7186

7287
```xml
7388
<key>Custom</key>
7489
<dict>
75-
<key>s3.assumerole.rolearn</key>
90+
<key>role_arn</key>
7691
<string>arn:aws:iam::…</string>
7792
</dict>
7893
```

protocols/profiles/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The value of `Vendor` must be unique among all installed connection profiles.
7575
- `Anonymous Configurable` Boolean if anonymous access is configurable.
7676
- `Path Configurable` Boolean if default path is configurable.
7777
- `Certificate Configurable` Boolean if client certificate is configurable.
78+
- `Role Configurable`. Boolean if role is configurable. Typically an ARN referencing the AWS IAM role to assume using AWS STS API.
7879
- `Region` Location constraint for [OpenStack Swift](../openstack/index.md) and [S3](../s3/index.md) profiles.
7980
:::{admonition} S3
8081
:class: tip
@@ -88,7 +89,7 @@ The value of `Vendor` must be unique among all installed connection profiles.
8889
* A profile can define an empty value for `OAuth Client Secret`. The OAuth authorization flow will then use no client secret in client parameters to authenticate with the server.
8990
* A profile can omit the `OAuth Client Secret` to prompt the user for manual input when connecting.
9091
- `Authorization` Set to `AWS2` to default to AWS2 signature authentication for S3. Default is `AWS4HMACSHA256`.
91-
- `Properties` List of custom protocol-specific properties. You can set [hidden configuration options](../../cyberduck/preferences.md#hidden-configuration-options) for a specific connection profile. Example usages can be found in:
92+
- `Properties` Dictionary of custom protocol-specific properties. You can set [hidden configuration options](../../cyberduck/preferences.md#hidden-configuration-options) for a specific connection profile. Example usages can be found in:
9293
* [FTP (Compatibility Mode).cyberduckprofile](https://github.com/iterate-ch/profiles/blob/master/FTP%20(Compatibility%20Mode).cyberduckprofile)
9394
* [FTP-SSL (Compatibility Mode).cyberduckprofile](https://github.com/iterate-ch/profiles/blob/master/FTP-SSL%20(Compatibility%20Mode).cyberduckprofile)
9495
* [S3 (Deprecated path style requests).cyberduckprofile](https://github.com/iterate-ch/profiles/blob/master/S3%20(Deprecated%20path%20style%20requests).cyberduckprofile)
@@ -186,5 +187,5 @@ Create a *multi-TIFF* containing the needed icon sizes:
186187
187188
### S3 and OpenID Connect Federation
188189
189-
Customization of connection profiles using OpenID Connect provider and AssumeRoleWithWebIdentity STS API
190+
Customization of connection profiles using OpenID Connect provider and AssumeRoleWithWebIdentity STS API.
190191
- [Sample connection profiles for S3 and OpenID Connect Federation](aws_oidc.md)

protocols/s3/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ with the identity provider in _Identity and Access Management (IAM)_.
194194
- {download}`Download<https://profiles.cyberduck.io/AWS%20S3%2BSTS%20%26%20Azure%20Active%20Directory%20%28Azure%20AD%29%20OpenID%20Connect.cyberduckprofile>`
195195
the *AWS S3+STS &amp; Azure Active Directory (Azure AD) profile* for preconfigured settings
196196

197+
:::{admonition} Tutorial
198+
:class: tip
199+
200+
Follow the [step-by-step instructions](../../tutorials/s3_microsoft_entra_oidc.md) to configure Microsoft Entra ID as an OpenID Connect (OIDC) Identity Provider in AWS IAM and authenticate with S3.
201+
:::
202+
197203
##### S3 with Google OpenID Connect
198204

199205
- {download}`Download<https://profiles.cyberduck.io/AWS%20S3%2BSTS%20%26%20Google%20OpenID%20Connect.cyberduckprofile>`
186 KB
Loading
189 KB
Loading

tutorials/custom_oauth_client_id.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Workaround to register your own Custom OAuth 2.0 Client ID for [Google Cloud Sto
7878
:width: 800px
7979
:::
8080

81-
10. Select _Desktop app_ for _Application type_ and enter any _Name_. Select _Create_ to continue.
81+
10. Select _iOS_ for _Application type_ and enter any _Name_. Select _Create_ to continue.
8282

8383
:::{image} _images/Application_Type_Client_ID.png
8484
:alt: Application Type for Credentials
@@ -97,7 +97,7 @@ Workaround to register your own Custom OAuth 2.0 Client ID for [Google Cloud Sto
9797
- {download}`Google Drive Custom OAuth Client ID.cyberduckprofile<../protocols/profiles/_static/Google Drive Custom OAuth Client ID.cyberduckprofile>`
9898
- {download}`Google Storage Custom OAuth Client ID.cyberduckprofile<../protocols/profiles/_static/Google Storage Custom OAuth Client ID.cyberduckprofile>`
9999

100-
2. Use the _OAuth Client ID_ created to edit the `OAuth Client ID`, `OAuth Redirect Url`, and optionally the `OAuth Client Secret` in the template connection profile, leaving other keys unchanged.
100+
2. Use the _OAuth Client ID_ created to edit the `OAuth Client ID` and `OAuth Redirect Url` in the template connection profile, leaving other keys unchanged.
101101

102102
:::::{tabs}
103103
::::{tab} Configuration
@@ -111,8 +111,6 @@ Workaround to register your own Custom OAuth 2.0 Client ID for [Google Cloud Sto
111111
<string>com.googleusercontent.apps.NUMBER-ID:oauth</string>
112112
<key>OAuth Client ID</key>
113113
<string>NUMBER-ID.apps.googleusercontent.com</string>
114-
<key>OAuth Client Secret</key>
115-
<string>Client secret</string>
116114
</dict>
117115
</plist>
118116
```
@@ -149,8 +147,6 @@ Workaround to register your own Custom OAuth 2.0 Client ID for [Google Cloud Sto
149147
<string>com.googleusercontent.apps.293168482058-dvjk8lh6u6n43kio156uerkqcgjl2i5k:oauth</string>
150148
<key>OAuth Client ID</key>
151149
<string>293168482058-dvjk8lh6u6n43kio156uerkqcgjl2i5k.apps.googleusercontent.com</string>
152-
<key>OAuth Client Secret</key>
153-
<string>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</string>
154150
</dict>
155151
</plist>
156152
```

tutorials/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ hidden_properties
88
custom_oauth_client_id
99
s3_iam_role_mfa
1010
s3_iam_getsessiontoken_bucketpolicy_mfa
11+
s3_microsoft_entra_oidc
12+
s3_google_oidc
1113
iam
1214
vault_localdisk
1315
sftp_publickeyauth
@@ -31,6 +33,12 @@ Require user to use MFA when connecting to S3 by connecting with IAM role assume
3133
## [Connect to S3 with temporary session token and MFA input](s3_iam_role_mfa.md)
3234
Require user to use MFA when connecting to S3 bucket with policy requiring MFA by requesting temporary credentials obtained from IAM AWS Security Token Service (STS).
3335

36+
## [Authenticate with Microsoft Entra ID to connect to S3](s3_microsoft_entra_oidc.md)
37+
Use Microsoft Entra ID to authenticate with S3 by configuring as an OpenID Connect (OIDC) Identity Provider in AWS IAM.
38+
39+
## [Authenticate with Google to connect to S3](s3_google_oidc.md)
40+
Use Google to authenticate with S3 by configuring as an OpenID Connect (OIDC) Identity Provider in AWS IAM.
41+
3442
## [AWS Identity & Access Management (IAM)](iam.md)
3543
IAM allows you to create credentials for third parties accessing your S3 account with permission constraints.
3644

tutorials/s3_google_oidc.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
Connect to S3 authenticating with Google Cloud
2+
====
3+
4+
> Use Google Cloud to authenticate with S3 by configuring as an OpenID Connect (OIDC) Identity Provider in AWS IAM.
5+
6+
7+
:::{tip}
8+
Refer to [Custom connection profile using OpenID Connect provider and AssumeRoleWithWebIdentity STS API](../protocols/profiles/aws_oidc.md) for custom configuration of connection profiles using OIDC web identity federation to connect to AWS S3.
9+
:::
10+
11+
:::{admonition} Requirements
12+
:class: warning
13+
* Cyberduck [9.3.0](https://cyberduck.io/changelog/) or later required
14+
* Mountain Duck [5.1.0](https://mountainduck.io/changelog/) or later required
15+
:::
16+
17+
## Configuration in Google Cloud Console
18+
19+
Create an OAuth application in the [Google Cloud Console](https://console.cloud.google.com/auth/clients) and configure it as an OIDC Identity Provider.
20+
21+
:::{admonition} Setup a Custom OAuth Client ID Tutorial
22+
:class: tip
23+
24+
Follow the [step-by-step instructions](custom_oauth_client_id.md) to Setup a Custom OAuth Client ID for Google.
25+
:::
26+
27+
28+
1. Navigate to _Solutions → All products → Management → Google Auth Platform → Clients_ in the [Google Cloud Console](https://console.cloud.google.com/auth/clients) and choose _Create client → OAuth client ID_.
29+
2. Select _iOS_ as the application type.
30+
31+
:::{important}
32+
Other types require a OAuth Client Secret and do not allow for a supported redirect URI.
33+
:::
34+
35+
3. Enter `io.cyberduck` for use with Cyberduck or `io.mountainduck` to use with Mountain Duck for the _Bundle ID_.
36+
4. Copy the OAuth Client ID from the credentials screen.
37+
38+
39+
## Configuration in AWS IAM
40+
41+
### Create an OIDC identity provider
42+
43+
:::{tip}
44+
Google is already built-in to AWS as a trusted OIDC identity provider. Instead of using a ARN you can reference the built-in Google IdP in a role with `accounts.google.com`.
45+
:::
46+
47+
### Create a role
48+
49+
Assign a role to the identity provider created in the previous step with permissions to access S3.
50+
51+
1. In AWS [IAM console](https://console.aws.amazon.com/iam/), choose _Create Role_ in _Roles_.
52+
2. Select _Web identity_ as the trusted entity type.
53+
3. Select _Google_ as the _Identity Provider_.
54+
4. Enter the OAuth Client ID from the application registration in Google Cloud Console for _Audience_.
55+
5. The resulting trust policy will look similar to the following:
56+
57+
```json
58+
{
59+
"Version": "2012-10-17",
60+
"Statement": [
61+
{
62+
"Effect": "Allow",
63+
"Principal": {
64+
"Federated": "accounts.google.com"
65+
},
66+
"Action": "sts:AssumeRoleWithWebIdentity",
67+
"Condition": {
68+
"StringEquals": {
69+
"accounts.google.com:aud": "<OAuth Client ID>.apps.googleusercontent.com"
70+
}
71+
}
72+
}
73+
]
74+
}
75+
```
76+
77+
6. In the next step attach a permission policy to the role such as the managed policy `AmazonS3FullAccess`.
78+
7. Copy the Role ARN from the _Summary_ tab.
79+
80+
81+
### Create a bookmark in Cyberduck or Mountain Duck
82+
83+
1. Open _Preferences… → Profiles_ in Cyberduck or Mountain Duck.
84+
2. Enable the *AWS S3 (Google OpenID Connect)* connection profile.
85+
3. Add a new [Bookmark](../cyberduck/bookmarks.md) in Cyberduck or Mountain Duck and choose *AWS S3 (Google)* in the protocol dropdown.
86+
4. Enter the OAuth Client ID from the application registration in Google Cloud Console for _OAuth Client ID_ when prompted. It will be saved in the bookmark as a [custom property](hidden_properties.md#in-duck-bookmark-files).
87+
88+
:::{image} _images/S3_Client_Id_Prompt.png
89+
:alt: OAuth Client ID Prompt
90+
:width: 400px
91+
:::
92+
93+
:::{tip}
94+
The _OAuth Client ID_ is the same as the _OAuth Client ID_ from the application registration in Google Cloud Console with the `.apps.googleusercontent.com` suffix.
95+
:::
96+
97+
:::{note}
98+
Alternatively set `OAuth Client ID` in a [custom connection profile](../protocols/profiles/aws_oidc.md).
99+
:::
100+
101+
5. Enter the Role ARN from the previous step when prompted. It will be saved in the bookmark as a [custom property](hidden_properties.md#in-duck-bookmark-files).
102+
103+
:::{note}
104+
Alternatively set `role_arn` as a custom property in a [custom connection profile](../protocols/profiles/aws_oidc.md).
105+
:::
106+
107+
:::{image} _images/S3_Role_ARN_Prompt.png
108+
:alt: MFA Prompt
109+
:width: 400px
110+
:::
111+
112+
:::{admonition} Troubleshooting
113+
:class: attention
114+
### `Not authorized to perform sts:AssumeRoleWithWebIdentity`
115+
Validate the _Trusted entities_ in _Trust relationships_ in the IAM console.
116+
117+
### `Request ARN is invalid`
118+
The role ARN entered is not valid.
119+
120+
### `The security token included in the request is invalid`
121+
Invalid client token ID. Check the OAuth Client ID in the connection profile.
122+
:::
123+
124+
## References
125+
- [AWS Identity and Access Management → OIDC federation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html)
126+
- [Google Identity Platform → OpenID Connect](https://developers.google.com/identity/openid-connect/openid-connect)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Connect to S3 authenticating with Microsoft Entra ID
2+
====
3+
4+
> Use Microsoft Entra ID to authenticate with S3 by configuring as an OpenID Connect (OIDC) Identity Provider in AWS IAM.
5+
6+
7+
:::{tip}
8+
Refer to [Custom connection profile using OpenID Connect provider and AssumeRoleWithWebIdentity STS API](../protocols/profiles/aws_oidc.md) for custom configuration of connection profiles using OIDC web identity federation to connect to AWS S3.
9+
:::
10+
11+
:::{admonition} Requirements
12+
:class: warning
13+
* Cyberduck [9.3.0](https://cyberduck.io/changelog/) or later required
14+
* Mountain Duck [5.1.0](https://mountainduck.io/changelog/) or later required
15+
:::
16+
17+
## Configuration in Microsoft Entra ID
18+
19+
Create an application in the [Microsoft Entra ID portal](https://entra.microsoft.com/) and configure it as an OIDC Identity Provider.
20+
21+
1. Navigate to _Entra ID → → App registrations_ in the [Microsoft Entra ID portal](https://entra.microsoft.com/) and choose _New registration_.
22+
2. In _Authentication_, add a redirect URI with the value `x-cyberduck-action://oauth` to allow authentication with Cyberduck.
23+
3. In _Authentication_, add a redirect URI with the value `x-mountainduck-action://oauth` to allow authentication with Mountain Duck.
24+
4. Copy the OAuth Client ID from _Overview → Essentials → Application (client) ID_.
25+
26+
27+
## Configuration in AWS IAM
28+
29+
### Create an OIDC identity provider
30+
1. In AWS [IAM console](https://console.aws.amazon.com/iam/) add a new identity provider in _Identity providers_.
31+
2. Configure the provider as type _OpenID Connect_ with the provider URL set to `https://login.microsoftonline.com/<TENANT-ID>/v2.0`. Replace <TENANT-ID> with your Microsoft Entra ID tenant ID. Copy the ARN for the next [step](#create-a-role).
32+
3. Set the _Audience_ to the Application (client) ID from Microsoft Entra.
33+
34+
### Create a role
35+
36+
Assign a role to the identity provider created in the previous step with permissions to access S3.
37+
38+
1. In AWS [IAM console](https://console.aws.amazon.com/iam/) add a new role.
39+
2. Choose _Assign role_ followed by _Create a new role_ with a _Web identity_ trusted entity type. It should have _Identity provider_ and _Audience_ options prefilled with the ARN of the identity provider and Client ID from Microsoft Entra.
40+
3. The resulting trust policy will look similar to the following:
41+
42+
```json
43+
{
44+
"Version": "2012-10-17",
45+
"Statement": [
46+
{
47+
"Effect": "Allow",
48+
"Principal": {
49+
"Federated": "arn:aws:iam::<ACCOUNT_ID>:oidc-provider/login.microsoftonline.com/<TENANT-ID>/v2.0"
50+
},
51+
"Action": "sts:AssumeRoleWithWebIdentity",
52+
"Condition": {
53+
"StringEquals": {
54+
"login.microsoftonline.com/<TENANT-ID>/v2.0:aud": "<Application (client) ID>"
55+
}
56+
}
57+
}
58+
]
59+
}
60+
```
61+
62+
:::{tip}
63+
The `<ACCOUNT_ID>` is replaced with your AWS account ID and `<Application (client) ID>` with the OAuth Client ID of the application you created in the previous [step](#configuration-in-microsoft-entra-id). For `Federated`, the ARN of the identity provider you created in the previous step is set. For the condition `aud` use the application client ID of the application you created in the previous step.
64+
:::
65+
66+
4. In the next step attach a permission policy to the role such as the managed policy `AmazonS3FullAccess`.
67+
5. Copy the Role ARN from the _Summary_ tab.
68+
69+
70+
### Create a bookmark in Cyberduck or Mountain Duck
71+
72+
1. Open _Preferences… → Profiles_ in Cyberduck or Mountain Duck.
73+
2. Enable the *AWS S3 (Microsoft Entra)* connection profile.
74+
3. Add a new [Bookmark](../cyberduck/bookmarks.md) in Cyberduck or Mountain Duck and choose *AWS S3 (Microsoft Entra)* in the protocol dropdown.
75+
4. Enter the Application (client) ID from the application registration in Microsoft Entra for _OAuth Client ID_ when prompted. It will be saved in the bookmark as a [custom property](hidden_properties.md#in-duck-bookmark-files).
76+
77+
:::{image} _images/S3_Client_Id_Prompt.png
78+
:alt: OAuth Client ID Prompt
79+
:width: 400px
80+
:::
81+
82+
:::{tip}
83+
The _OAuth Client ID_ is the same as the _Application (client) ID_ from the application registration in Microsoft Entra.
84+
:::
85+
86+
:::{note}
87+
Alternatively set `OAuth Client ID` in a [custom connection profile](../protocols/profiles/aws_oidc.md).
88+
:::
89+
90+
5. Enter the Role ARN from the previous step when prompted. It will be saved in the bookmark as a [custom property](hidden_properties.md#in-duck-bookmark-files).
91+
92+
:::{note}
93+
Alternatively set `role_arn` as a custom property in a [custom connection profile](../protocols/profiles/aws_oidc.md).
94+
:::
95+
96+
:::{image} _images/S3_Role_ARN_Prompt.png
97+
:alt: MFA Prompt
98+
:width: 400px
99+
:::
100+
101+
:::{admonition} Troubleshooting
102+
:class: attention
103+
### `Not authorized to perform sts:AssumeRoleWithWebIdentity`
104+
Validate the _Trusted entities_ in _Trust relationships_ in the IAM console.
105+
106+
### `Request ARN is invalid`
107+
The role ARN entered is not valid.
108+
109+
### `The security token included in the request is invalid`
110+
Invalid client token ID. Check the OAuth Client ID in the connection profile.
111+
:::
112+
113+
## References
114+
- [AWS Identity and Access Management → OIDC federation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html)

0 commit comments

Comments
 (0)