Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kubernetesのセキュリティのベストプラクティス
Search
Ian Lewis
March 08, 2018
Technology
12
16k
Kubernetesのセキュリティのベストプラクティス
Ian Lewis
March 08, 2018
Tweet
Share
More Decks by Ian Lewis
See All by Ian Lewis
Kubernetes Security Best Practices
ianlewis
39
26k
The Enemy Within: Running untrusted code in Kubernetes
ianlewis
0
1.2k
The Enemy Within: Running untrusted code with gVisor
ianlewis
4
980
KubeCon EU Runtime Track Recap
ianlewis
3
1.5k
コンテナによるNoOpsオートメーション
ianlewis
2
140
Google Kubernetes Engine 概要 & アップデート @ GCPUG Kansai Summit Day 2018
ianlewis
2
850
Extending Kubernetes with Custom Resources and Operator Frameworks
ianlewis
10
3.6k
Scheduling and Resource Management in Kubernetes
ianlewis
2
1.3k
Keynote: The Kubernetes Community
ianlewis
0
190
Other Decks in Technology
See All in Technology
完全に理解した!生成AI自社プロダクトのアジャイル開発の進め方!/ Fully understood! Agile tips for developing our generative AI product!(AOAI Dev Day)
jnymyk
1
120
データベース研修 分析向けSQL入門【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
110
JBUG岡山 #6 WordCamp男木島の チームビルディング
takeshifurusato
0
150
テストケースの自動生成に生成AIの導入を試みた話と生成AIによる今後の期待
shift_evolve
0
190
20240725 LLMによるDXのビジョンと、今何からやるべきか @Azure OpenAI Service Dev Day
nrryuya
3
1.2k
[NIKKEI Tech Talk]Bias for Action!! 実践から学ぶための仕組とコミュニティ / Community for Practice and Learning
kanamasa
0
280
「単なる OAuth 2.0 を認証に使うと、車が通れるほどのどでかいセキュリティー・ホールができる」のか検証してみた
terara
0
380
開発生産性をむしろ向上させる セキュリティパートナーの作り方 / Dev Productivity Con 2024
flatt_security
0
390
AIアシスタントの活用で品質の向上と開発ワークフローのスピードアップ
nagix
1
220
Github Actions 로 Android 팀의 효율성 극대화
hadonghyun
0
160
エンジニアの生存戦略 〜クラウド潮流の経験から紐解く技術トレンドのメカニズムと乗りこなし方〜
shimy
9
1.9k
AOAI Dev Day - Opening Session
yoshidashingo
2
470
Featured
See All Featured
Designing with Data
zakiwarfel
96
5k
For a Future-Friendly Web
brad_frost
173
9.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
The Cult of Friendly URLs
andyhume
75
5.9k
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
78
15k
Design by the Numbers
sachag
277
19k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
15
4.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
248
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
Being A Developer After 40
akosma
72
580k
Transcript
Kubernetesのセキュリティ ベストプラクティス ianmlewis@
Ian Lewis • ianlewis@ • Google • Tokyo, Japan •
#kubernetes, #go, #python
Kubernetes • コンテナ オーケストレーション • インフラ API/ フレームワーク
Guestbookアプリ • Web Frontend ◦ ウェブアプリ ◦ HTML/JS/CSS • Message
◦ メッセージを 保存・閲覧 • NGWord ◦ NG ワードを 検出する Kubernetes Cluster Web Frontend Redis NGWord message
Kubernetes API Server 1. フロントエンド Pod から トークンを取得 2. トークンを利用し、
API サーバーを攻撃 3. シークレットなどを取得 し、さらに サービスを攻撃 Kubernetes Cluster Web Frontend Redis NGWord message ① ② ③
Mitigate 1 & 2: RBAC • Role Based Access Control
• ユーザーやサービスアカウントへロールを付与 • ロールが権限を持つ ◦ get secrets ◦ update configmap ◦ etc. • RBAC 設定はネームスプペース範囲 • GKE では IAM と連携
Mitigate 1 & 2: RBAC ClusterRole ClusterRoleBinding 1:many many:1 Verb
+ Type
Mitigate 2: API Server Firewall • API サーバーへのアクセスを IP アドレスに制限
• GKE: ◦ gcloud container clusters create --enable-master-authorized-networks --master-authorized-networks=....
Mitigate 3: Network Policy • データベースへのアクセスを必要のある Pod に制限 • ラブルセレクターで
Pod を選択 • ネットワークプラグインで実装されてる : Calico, Weave, etc.
NetworkPolicy kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: redis spec: podSelector:
matchLabels: name: redis ingress: - from: - podSelector: matchLabels: name: guestbook
ホストへアクセス 1. コンテナ外へ突破 2. Kubelet を攻撃 3. 同じホストに実行中の コンテナを攻撃 Host
Web Frontend
Mitigate 1: non-rootユーザーで実行 apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: runAsUser: 1000
Mitigate 1: 読込専用ファイルシステム apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: readOnlyRootFilesystem: true
Mitigate 1: no_new_privs apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: allowPrivilegeEscalation: false
Mitigate 1: 組み合わせ apiVersion: v1 kind: Pod metadata: name: security-context-demo
spec: securityContext: runAsUser: 1000 readOnlyRootFilesystem: true allowPrivilegeEscalation: false
Your App Container seccomp Mitigate 1: seccomp/ AppArmor/ SELinux AppArmor/
SELinux
seccomp apiVersion: v1 kind: Pod metadata: name: mypod annotations: seccomp.security.alpha.kubernetes.io/pod:
runtime/default ...
AppArmor apiVersion: v1 kind: Pod metadata: name: mypod annotations: container.apparmor.security.beta.kubernetes.io/hello:
runtime/default spec: containers: - name: hello ...
SELinux apiVersion: v1 kind: Pod metadata: name: mypod spec: securityContext:
seLinuxOptions: level: "s0:c123,c456" containers: - name: hello ...
Mitigate 2 & 3: Kubeletの権限を制限する • RBAC for Kubelet: ◦
--authorization-mode=RBAC,Node --admission-control=...,NodeRestriction • Rotate Kubelet certs: ◦ kubelet … --rotate-certificates
Unsecured Pods • You follow the rules but others don't
Kubernetes Cluster Web Frontend Redis NGWord message
Mitigate: PodSecurityPolicy apiVersion: extensions/v1beta1 kind: PodSecurityPolicy metadata: name: example spec:
privileged: false # Don't allow privileged pods! # The rest fills in some required fields. seLinux: rule: RunAsAny supplementalGroups: rule: RunAsAny runAsUser: rule: 1000 fsGroup: rule: RunAsAny volumes: - '*'
istio • Service mesh • Envoy proxy 組み込み
トラフィクを傍受 1. ネットーワーク上の通 信を傍受 2. あるサビースに不正リ クエストを送る Kubernetes Cluster Web
Frontend Redis NGWord message
istio 1. サービス間の プロクシー 2. 暗号化 3. 証明書の自動更新 4. ポリシーが
セントラルサーバで集 中して管理する Kubernetes Cluster Web Frontend Redis NGWord message
Thanks!