Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GitHub ActionsのOIDC認証
Search
Tomofumi Kondo
March 01, 2022
Programming
270
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GitHub ActionsのOIDC認証
2021年に新しく発表された、GitHub ActionsのOIDC認証機能についての紹介。
Tomofumi Kondo
March 01, 2022
Transcript
18 slides
GitHub ActionsのOIDC認証 東北大学4年 近藤智文 @tomokon_0314
目次 1. OIDCとは 2. GitHub ActionsのOIDC認証機能 3. デモ 4. まとめ
1. OIDCとは Open ID Connectの略 信頼されたOIDCプロバイダーが提供するトークンによって認証・認可を行う仕組 み。 OIDCのユーザーとなるサービスは、認証された主体の情報を示す「IDトークン」 や、認可されたアクションを示す「アクセストークン」というトークンを認可 サーバーに発行してもらう。
リソースサーバーに対するリクエストにそれらのトークンを含めることで、リ ソースに対して許可されたアクションを行うことができる。
1. OIDCとは
2. GitHub ActionsのOIDC認証機能 1. Cloud Providerの方でGitHubの特定の組織・リポジトリ・ブランチに対して アクションを許可するロールを作成しておく 2. GitHub ActionsのジョブでJWTを発行してCloud
Providerにリクエストし、 アクセストークンを得る 3. 得たトークンを使ってCloud ProviderのAPIを叩くなどして、Cloud Provider のリソースに対するアクション(サービスのデプロイとか)を実行する。 About security hardening with OpenID Connectより引用
2. GitHub ActionsのOIDC認証機能 メリット 従来は、AWSのリソースに対して特定のアクションを実行できるユーザーを作成 し、そのユーザーのアクセスキーとシークレットキー(IDとパスワードみたいなも の)をGitHubのsecretsに登録してGitHub Actionsで利用していた。 しかし、それでは認証情報をAWSの外部に置くことになるので流出の危険があり セキュリティ的に良くない。
OIDC認証を使うことで、workflow実行時に毎度発行される短命なトークンを利 用して認証を行えるため、secretsに認証情報を保存しなくてよくなる
3. デモ GitHub ActionsのOIDC認証を使用し、AWSのリソースに対してアクションの制 御を行うデモをする。
3. デモ AWSにてOIDCプロバイダを設定する
3. デモ AWSにてOIDCプロバイダを設定する Provider URL https://token.actions.githubuserconte nt.com Audience sts.amazonaws.com
3. デモ AWSにてOIDC用のロールを作成する
3. デモ OIDC用ロールの信頼ポリシー 例(抜粋) ``` "Principal": { "Federated":"arn:aws:iam::<アカウントID>:oidc-provider/token.actions.githubusercontent.com" }, "Action":
"sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "token.actions.githubusercontent.com:sub":"repo:<GitHubの組織名>/<GitHubのリポジトリ 名>:ref:refs/heads/main", "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" } } ```
3. デモ OIDC用ロールに紐づける権限(抜粋) 今回は`sts get-caller-identity`を実行できる権限を付与しておく ``` { "Effect": "Allow", "Action":
"sts:GetCallerIdentity", "Resource": "*" } ```
3. デモ GitHubにてテスト用リポジトリの作成 組織名・リポジトリ名は先ほど設定した信頼ポリシーに一致させる 今回はこれで↓
3. デモ OIDC認証を使うGitHub Actionsのworkflow(抜粋) GitHub OIDC Providerが発行するOIDC認証用のJWTを使うための権限の設定 ``` permissions: id-token:
write ```
3. デモ OIDC認証を使うGitHub Actionsのworkflow(抜粋) AWSから先ほど作ったロールに紐づくトークンを取得する ``` - name: configure AWS
credentials uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-oidc-test role-session-name: testrolesession aws-region: ${{ env.AWS_REGION }} ```
OIDC認証を使うGitHub Actionsのworkflow(抜粋) 前のステップで取得したトークンを同封してAWSのAPIを叩く ``` - name: get caller identity run:
| aws sts get-caller-identity ``` 3. デモ
3. デモ OIDC認証を使うGitHub Actionsのworkflow(抜粋) workflowの結果
4. まとめ • GitHub ActionsのOIDC認証を使うことで、secretsに認証情報を保存しなく てよくなるため、認証情報の流出の危険性がなくなる。 • GitHub ActionsのworkflowからAWSのリソースに対するアクセス制御を柔軟 に行うことができる。
More Decks by Tomofumi Kondo
See All by Tomofumi Kondo
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
600
OVSとLinuxネットワークで実現するHVの透過的プロキシとセキュアなVPCネットワーク
tomokon
0
61
kagentとMCPで実現するKubernetes-nativeなAIアラート自動応答システム
tomokon
0
53
Cinder Backupを活用したユーザー負担の少ないクロスリージョンボリューム移行システム
tomokon
0
39
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
280
Goで作る!ストレージ筐体間での安全なCinder volume移行システムの開発と運用
tomokon
0
220
Goによるインタプリタ開発
tomokon
1
120
初めてのTerraform
tomokon
1
71
ハッカソンで便利なインフラ構築サービス
tomokon
0
300
Other Decks in Programming
See All in Programming
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
140
protojson における文字化けの扱い
kazuki1023
0
460
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
170
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
680
Distance field of Julia set
kinakomoti321
0
330
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
Debian JP Projectのサーバー構成
uwabami
1
180
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
250
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
210
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Google's AI Overviews - The New Search
badams
0
1.7k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
680
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
310
A better future with KSS
kneath
240
18k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Chasing Engaging Ingredients in Design
codingconduct
0
410
Documentation Writing (for coders)
carmenintech
77
5.7k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
340