🍉
AWS IAM Identity Center で SAML IdP を試す
前提
AWS IAM Identity Center を SAML IdP として、mod_auth_mellon を SP として設定してみる。
Apache mod_auth_mellon で SAML SP の設定
https://zenn.dev/mnod/articles/4faa7d4693765f と同様
IdP_metadata.xml は要書き換え(後述)
AWS IAM Identity Center の設定
独自アプリのIdPとして利用する場合、IAM Identity Center の前提として Organizations が必要。(Organizations なしでも IAM Identity Center を有効化できるが、独自アプリのIdPとして利用できない)
- 一つのリージョンで有効化したら、他のリージョンでは有効化できないらしい。
- rootユーザではなくて、IAMユーザで有効化可能。
IAM Identity Center 有効化
- AWSのマネジメントコンソールにログインして
IAM Identity Centerに移動 -
Enableを押下 -
Enable with AWS Organizationsを選択してContinueを押下
ユーザー作成
- 左ペインで
Usersへ移動 → 右ペインでAdd userを押下 - Username、Email address、First name、Last name を入力。
Password はGenerate a one-time password that you can share with this userを選択 - Group は特に指定せずに
Add userを押下 - One-time password が表示されるので、パスワードを控えて
Closeを押下
確認メール送信
- 左ペインで
Usersへ移動 → 右ペインで作成したユーザーを選択 - 画面上部の
Send email verification linkを押下 - 確認ダイアログが表示されるので、
Sendを押下
メールが送信されるので、Verify your email address のリンクをクリックする
IdP 設定
- 左ペインで
Application assignments>Applicationsへ移動 → 右ペインでAdd applicationを押下 - Setup preference で
I have an application I want to set upを選択 → Application type でSAML 2.0を選択してNextを押下 - Configure application で
Display name、Descriptionを適宜入力 - IAM Identity Center metadata で
IAM Identity Center SAML metadata fileをダウンロード
SP側に /etc/apache2/mellon/IdP_metadata.xml として保存してapachectl gracefulを実行 - Application metadata で
Upload application SAML metadata fileを選択 →Choose fileより SP メタデータ(mellon_metadata.xml)をアップロード - 画面最下部の
Submitを押下
ユーザ割り当て
- 左ペインで
Application assignments>Applicationsへ移動 → 右ペインでCustomer managedタブへ移動 → 作成したアプリケーションを選択 -
Assigned users and groupsの箇所でAssign users and groupsを押下 - 作成したユーザを検索して選択 →
Assignを押下
属性マッピングの追加
- 左ペインで
Application assignments>Applicationsへ移動 → 右ペインでCustomer managedタブへ移動 → 作成したアプリケーションを選択 -
ActionsのプルダウンメニューでEdit attribute mappingsを選択 - 以下の情報を追加して
Save changesを押下
| 設定名 | 設定値 |
|---|---|
| User attribute in the application | Subject |
| Maps to this string value or user attribute in IAM Identity Center | ${user:subject} |
| Format | transient |
MFA 無効化
- 動作確認のため一時的にMfAを無効化します。
- 左ペインで
Settingsへ移動 → 右ペインでAuthenticationタブへ移動 -
Multi-factor authenticationの箇所で、Configureを押下 - Prompt users for MFA で
Never (disabled)を選択 - 画面最下部の
Save Changesを押下
動作確認が終わったら Only when their sign-in context changes (context-aware) に戻す
動作確認
WebサーバのURLにアクセスして、AWS のログイン画面に遷移すること、作成したユーザー名でログインできること、コンテンツを表示できることを確認する。
Discussion