コンテナ CI/CD On GKE の追求 GCP Google Cloud で実現するセキュアな Anthos Day

Transcription

Google CloudAnthos DayGCP で実現するセキュアなコンテナ CI/CD on GKE �雅也1

新井 雅也米川 賢治Masaya AraiKenji �ア@msy78linkedinhttps://qiita.com/kenzkenz2

アジェンダ NRI について セキュアなコンテナ CI/CD が求められる背景 GCP の全体構成と設計戦略 まとめ3

NRI について014

引用:https://www.nri.com/jp/service5

NRI が手掛ける GCP の活用事例Anthos や Apigee , G Suite を取扱い、Google Cloud 関連をトータルでサポート6

セキュアなコンテナ CI/CD が求められる背景027

�アジリティ開発 & 提供金融機関、Fintech 企業など利用Fintech サービス利用者※ Fintech 領域の例8

�アジリティ開発 & 提供金融機関、Fintech 企業など利用Fintech サービスフィードバック利用者※ Fintech 領域の例9

�アジリティ開発 & 提供金融機関、Fintech 企業など利用Fintech �サイクルを � Fintech 領域の例10

1

ISC安全対策基準PCIDSS12

�主なセキュリティ観点13

制本番影響分離14

��統制本番影響分離15

相反する要件両立を目指して GCP と コンテナ CI/CD 用統制本番影響分離16

相反する要件両立を目指して GCP と コンテナ CI/CD �クセス制御運用統制本番影響分離17

相反する要件両立を目指して GCP と コンテナ CI/CD �クセス制御運用統制本番影響分離18

相反する要件両立を目指して GCP と コンテナ CI/CD ス制御運用統制本番影響分離CI/CD パイプラインの構成GCP のセキュリティ機能を駆使19

相反する要件両立を目指して GCP と コンテナ CI/CD ��ュアなコンテナ CI/CD ��イCI/CD パイプラインの構成GCP のセキュリティ機能を駆使20

GKE を中心に、 CloudBuild や OSS ��る高速デプロイCI/CD パイプラインの構成GCP のセキュリティ機能を駆使21

GKE を中心に、 CloudBuild や OSS ��プロイCI/CD パイプラインの構成GCP のセキュリティ機能を駆使22

GKE を中心に、 CloudBuild や OSS �速デプロイGitHubCloud BuildCI/CD パイプラインの構成GCP のセキュリティ機能を駆使23

GKE を中心に、 CloudBuild や OSS CDGitHubKMSCloud BuildTerraformCI/CD パイプラインの構成GCP のセキュリティ機能を駆使24

03GCP の全体構成と設計戦略25

ベースとなる GCP 環境は GKE と CloudBuild などが中心RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring26

ベースとなる GCP 環境は GKE と CloudBuild などが中心RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyCloud IAMSecurityCommand �ィ観点Cloud NATTerraformデータ保護GitHubCloud Buildアクセス制御Key oudMonitoring27

GCP / コンテナの全体設計28

GCP プロジェクト (Production)プロジェクト (CI/CD)GKEプロジェクト (Staging)GKECloud BuildContainerRegistryプロジェクト (Development)GKE29

GCP プロジェクト (Production)プロジェクト ��発生しないようにIaC にて管理プロジェクト (Staging)GKECloud BuildContainerRegistryプロジェクト (Development)GKETerraform30

�クト (Production)プロジェクト (CI/CD)GKEtag: abc tag: 123tag: abc tag: 123プロジェクト (Staging)GKECloud BuildContainerRegistrytag: abc tag: 123プロジェクト (Development)GKETerraform31

�離環境差分は configmap/secret �ト (Production)プロジェクト (CI/CD)GKEtag: abc tag: 123tag: abc tag: 123プロジェクト (Staging)GKECloud BuildContainerRegistrytag: abc tag: 123プロジェクト (Development)GKETerraform32

�番影響分離プロジェクト �� (CI/CD)GKEtag: abc tag: 123tag: abc tag: 123プロジェクト (Staging)GKEGitHubCloud BuildContainerRegistrytag: abc tag: 123プロジェクト (Development)GKETerraform33

内部ユーザはCloud Identity ープを管理Cloud IdentityOrganizationプロジェクト ロジェクト クト (Development)IAPGKE34

内部ユーザはCloud Identity ��影響分離Other ClientCloud IdentityOrganizationプロジェクト ロジェクト クト ��ドポイントは IAP で制御IAPGKE35

git ブランチ戦略と GCP 環境の CI/CD 設計36

ブランチ戦略は Git Feature Flow itHubGit feature flow37

ブランチ戦略は Git Feature Flow 境はpull request itHub今回拡張(変更)した箇所38

tHubpull request & merge39

�ロジェクト (CI/CD)GitHubプロジェクト(Production)Cloud ロジェクト 0

�プロジェクト (CI/CD)GitHubプロジェクト(Production)Cloud BuildGKEプロジェクト (Staging)GKEpull request & merge(リリースを行う feature strydeployプロジェクト(Development)GKE41

�)プロジェクト (CI/CD)GitHubプロジェクト(Production)Cloud ジェクト (Development)GKE42

�プロジェクト (CI/CD)GitHubプロジェクト(Production)Cloud ジェクト (Development)GKE43

�プロジェクト (CI/CD)GitHubプロジェクト(Production)Cloud riggerbuildプロジェクト (Development)GKE44

緊急 hotfix �ェクト (CI/CD)GitHubプロジェクト(Production)Cloud shTriggerbuildプロジェクト (Development)GKE45

環境用ブランチに直接 push 応本番影響分離GitHubproduction ブランチhotfix ブランチディベロッパーstaging ブランチfeature ブランチdevelop ブランチ46

環境用ブランチに直接 push �デプロイできてしまうGitHub直 pushproduction ��GKE未承認でデプロイされるhotfix ブランチディベロッパーstaging ブランチfeature ブランチdevelop ブランチ47

作業ミスで環境用ブランチに直接 push 離GitHubproduction ブランチhotfix ブランチディベロッパーstaging ブランチfeature ブランチdevelop ブランチ48

作業ミスで環境用ブランチに直接 push 離保護ブランチ設定GitHub直 push 禁止production ブランチhotfix ブランチディベロッパーmergestaging ブランチfeature ブランチmergemergedevelop ブランチ49

作業ミスで環境用ブランチに直接 push 離保護ブランチ設定GitHub直 push 禁止production ブランチhotfix ブランチディベロッパーmergepull request& merge のみ許可staging ブランチfeature ��挟むdevelop ブランチ50

�を持つレビュアーのみ merge itHubproduction ブランチCODEOWNERSmerge 時のレビュアーを限定hotfix �権限無し)staging ブランチfeature ュー権限あり)develop ブランチ51

GCP 上で扱うデータの暗号化52

暗号化 (at rest) : 可能な限り CMEK ecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring53

暗号化 (at rest) : 可能な限り CMEK ecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud Buildユーザが KMS で管理している鍵で CloudMonitoringStorage や各 VM の Persistent Disk ry54

暗号化 (at rest) : 可能な限り CMEK ecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingLogging �めれば、CMEK で暗号化された GCS に保存可能TerraformGKECloud SQLIdentity-AwareProxyCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring55

暗号化 (in transit) : クライアントと LB 間、LB ��対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring56

暗号化 (in transit) : クライアントと LB 間、LB ��対応本番影響分離RecommendationsVPC Service ControlsLB で SSL Policy を利用して、SSL バージョン等を指定Cloud ArmorOrganization PolicyCloud LoadBalancingGoogle managed な SSL 証明書(Let’s Encrypt) を利用TerraformVirtual Private CloudGKECloud SQLIdentity-AwareProxyCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring57

暗号化 (in transit) : クライアントと LB 間、LB ��対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud 書使い、LBProxyバックエンド間で https 通信TerraformCloud NATとCloud IAMSecurityCommand CenterKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring58

サービス保護設計59

予防的統制: ��性対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring60

予防的統制: ��性対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey gGitHubCloud BuildContainerRegistryCloudMonitoring61

予防的統制: ��性対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingCloud SQLIdentity-AwareProxyTerraform利用する GCP リソースのアクセスを制御GKECloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring62

予防的統制: ��性対応本番影響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud ud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring63

発見的統制: VPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring64

発見的統制: VPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATAudit Logging で不正な操作を確認。要件に応じて GCS や BQ にエクスポートGitHubCloud BuildContainerRegistryKey ManagementServiceLoggingCloudMonitoring65

発見的統制: VPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildMonitoring udMonitoring66

響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring67

継続監視/改善Recommendations を利用した IAM ationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring68

響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyGKECloud LoadBalancingCloud SQLIdentity-AwareProxyTerraformCloud NATCloud IAMGCP のベストプラクティスや CIS Command CenterKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring69

響分離RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud ��メージの push 時、新規 CVE 発見時に継続してOSの脆弱性を確認70

響分離RecommendationsVPC Service ControlsVirtual Private CloudCloud ArmorOrganization PolicyGKECloud LoadBalancingCloud SQLIdentity-AwareProxyTerraformCloud NATCloud IAMOSS �をチェックSecurityCommand CenterKey ManagementServiceLoggingGitHubCloud ��メージの push 時、新規 CVE 発見時に継続してOSの脆弱性を確認71

App �ンによりセキュリティ観点で CI/CD loud �ェック脆弱性スキャンの実施※ App �72

おまけ: GKE を活かした設計 :)73

GKE ならではの機能も活用 :)RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring74

GKE ならではの機能も活用 :)RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudOrganization PolicyCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformCloud IAMingress で LB を管理することで、 k8s のデプロイとシームレスに連携Cloud NATSecurityCommand CenterKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring75

GKE ならではの機能も活用 :)Workload Identity �ドの集約率を向上VPC Service ControlsCloud ArmorVirtual Private CloudService AccountCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformOrganization PolicyCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring76

container native loadbalancing で LB と pod 間の通信を効率化GKE ならではの機能も活用 :)RecommendationsVPC Service ControlsCloud ArmorVirtual Private CloudService AccountCloud LoadBalancingGKECloud SQLIdentity-AwareProxyTerraformOrganization PolicyCloud IAMSecurityCommand CenterCloud NATKey ManagementServiceLoggingGitHubCloud BuildContainerRegistryCloudMonitoring77

まとめ0478

相反する要件両立を目指して GCP と コンテナ CI/CD ��ュアなコンテナ CI/CD ��による高速デプロイCI/CD パイプラインの構成GCP のセキュリティ機能を駆使79

Thank you80

Cloud Build KMS CI/CD GitHub セキュリティ・ルール準拠 Terraform CI/CD パイプ ラインの構成 GCP のセキュリティ 機能を駆使 24 GKE を中心に、 CloudBuild や OSS を丁寧に活用していく