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
20171114inCyberAgent
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
okazaki hajime
November 14, 2017
Technology
2.4k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20171114inCyberAgent
https://connpass.com/event/70903/
okazaki hajime
November 14, 2017
More Decks by okazaki hajime
See All by okazaki hajime
20220810_seccam
okazakihajime
0
140
20171222_owasp_okinawa
okazakihajime
0
900
20170218inOkinawa
okazakihajime
0
240
Other Decks in Technology
See All in Technology
WebGIS AI Agentの紹介
_shimizu
0
590
5分でわかる Amazon Connect_20260608
hwangbyeonghun
0
130
AWS Summit 2026で見えたSIerにとっての Amazon Quickの位置づけ
maf_0521
0
100
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
140
水を運ぶ人としてのリーダーシップ
izumii19
4
1.1k
IaC コードを資産へ:AWS CDK 社内ライブラリと横断展開 / aws-summit-japan-2026
gotok365
10
1.6k
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
150
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
940
自作お家AIエージェントスタックチャンFWで困っている所紹介
74th
0
130
Agile and AI Redmine Japan 2026
hiranabe
4
500
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
7
4.3k
When Platform Engineering Meets GenAI
sucitw
0
200
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
190
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Side Projects
sachag
455
43k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Done Done
chrislema
186
16k
My Coaching Mixtape
mlcsv
0
160
We Have a Design System, Now What?
morganepeng
55
8.2k
Transcript
Dockerを始めて1週間の セキュリティエンジニア 2017/11/14(Tue) CyberAgent - AdtechStudio Security okazaki hajime
自己紹介 • 氏名:岡崎 創(おかざき はじめ) • 出身:埼玉県春日部市 (クレヨンしんちゃんの街) • 職歴: ◦ 3年くらい LAMP環境のフロントエンジニア
◦ その後、3年くらい 上記のインフラエンジニア(サーバエンジニア) ◦ その後、1年くらい Webアプリケーションの脆弱性診断 ◦ その後、サイバーエージェント アドテク本部に入社( 2015/6) • 現在:アドテク本部セキュリティグループに所属
今日はコンテナ縛り?!
本日は Docker Security Beginner
Docker歴:1週間程度 • 利用したDocker version ◦ Docker version 17.09.0-ce • Dockerの登場人物
◦ クライアント、デーモン、コンテナ、イメージ、レジストリ • とりあえず、docker run をしてみた • Docker イメージの作成の仕方は、2つある? ◦ dockerfileを「使う」か「使わないか」 • 現在この程度、、、
docker architecture 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html Dockerアーキテクチャ
• クライアントとデーモン間 ◦ セキュアな通信 ◦ 接続制御 • レジストリ ◦ セキュアな通信
◦ 接続制御 • イメージ ◦ イメージの信頼性 • コンテナ ◦ コンテナの信頼性 ◦ システムコールの制御 Dockerアーキテクチャ - セキュリティポイント
docker architecture - security point 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html Dockerアーキテクチャ - セキュリティポイント
• クライアントとデーモン間 ◦ セキュアな通信 ◦ 接続制御 • レジストリ ◦ セキュアな通信
◦ 接続制御 • イメージ ◦ イメージの信頼性 • コンテナ ◦ コンテナの信頼性 ◦ システムコールの制御 クライアントとデーモン間
クライアントとデーモン間 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html
クライアントとデーモン間 • TLSを利用して安全に接続しましょう • また、上記の証明書はクライアント認証にも使えます #デーモン設定に追加 $ vim /usr/lib/systemd/system/docker.service [Service]
# ExecStart=/usr/bin/dockerd ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=ca.pem --tlscert=server.pem --tlskey=server-key.pem -H tcp://0.0.0.0:2376 $ systemctl daemon-reload $ systemctl restart docker
レジストリ 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html
• クライアントとデーモン間 ◦ セキュアな通信 ◦ 接続制御 • レジストリ ◦ セキュアな通信
◦ 接続制御 • イメージ ◦ イメージの信頼性 • コンテナ ◦ コンテナの信頼性 ◦ システムコールの制御 レジストリ
レジストリ • こちらでも証明書により、通信の暗号化とクライアント認証が可能 *クライアント側 /etc/docker/certs.d/ <-- Certificate directory └── localhost:5000
<-- Hostname:port ├── client.cert <-- Client certificate ├── client.key <-- Client key └── ca.crt <-- Certificate authority that signed the registry certificate
イメージ 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html
• クライアントとデーモン間 ◦ セキュアな通信 ◦ 接続制御 • レジストリ ◦ セキュアな通信
◦ 接続制御 • イメージ ◦ イメージの信頼性 • コンテナ ◦ コンテナの信頼性 ◦ システムコールの制御 イメージ
イメージ • Enterprise edition advancedプランには「Docker Security Scanning」があります ◦ Image security
scanning and continuous vulnerability scanning • Docker Hub内のOfficialイメージはDocker Security Scanningによってセキュリティス キャンが行われています
Docker Security Scanning CVE(Common Vulnerabilities and Exposures):脆弱性情報データベースと連動 参考: https://success.docker.com/Architecture/Docker_Reference_Architecture%3A_Securing_Docker_EE_and_Security_Best_Practices
Docker Security Scanning 参考: https://docs.docker.com/docker-cloud/builds/image-scan/
ちなみに価格は? 参考: https://www.docker.com/pricing
コンテナ 参考: http://docs.docker.jp/engine/introduction/understanding-docker.html
• クライアントとデーモン間 ◦ セキュアな通信 ◦ 接続制御 • レジストリ ◦ セキュアな通信
◦ 接続制御 • イメージ ◦ イメージの信頼性 • コンテナ ◦ コンテナの信頼性 ◦ システムコールの制御 コンテナ
コンテナ • Docker Bench for Security(無料) ◦ コンテナに対するセキュリティチェックが可能 #以下のコマンドで構築可能 $
sudo docker run -it --net host --pid host --cap-add audit_control \ -v /var/lib:/var/lib \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/lib/systemd:/usr/lib/systemd \ -v /etc:/etc --label docker-bench-security \ diogomonica/docker-bench-security 参考: https://github.com/docker/docker-bench-security
無料!?
Docker Bench for Security *チェック項目 [INFO] 1 - Host Configuration
[INFO] 2 - Docker Daemon Configuration [INFO] 3 - Docker Daemon Configuration Files [INFO] 4 - Container Images and Build Files [INFO] 5 - Container Runtime [INFO] 6 - Docker Security Operations *結果 [INFO] 4 - Container Images and Build Files [WARN] 4.1 - Create a user for the container [WARN] * Running as root: vibrant_bassi [WARN] * Running as root: mysql [WARN] * Running as root: php ー> コンテナがrootユーザで動作しているため、警告!
コンテナ --security-opt • docker run時のオプション「--security-opt」で ◦ SELinuxやAppArmorなどのLinuxのアクセス制御を実現できる ◦ dockerのプロセスを指定した SELinuxのラベルやAppArmorのDomainを用いて動かせる
◦ AppArmorはMAC(Mandatory Access Control - 強制アクセス制御)を実現するためのミドルウェア ▪ AppArmorはプログラム単位でファイル・プロセスごとにセキュリティプロファイルを適用できる ◦ プロファイルでは: ▪ どのファイルにどのようにアクセス可・不可 ▪ ネットワークやSocketなどへのアクセス可・不可 • seccomp(secure computing mode) ◦ コンテナ上で利用可能なシステムコールを制御可能 参考: https://docs.docker.com/engine/security/apparmor/ https://oss.sios.com/security/docker-security-20160223
コンテナ $ grep SECCOMP /boot/config-$(uname -r) CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_SECCOMP=y *通常
$ docker container run --rm -it --security-opt seccomp=default.json alpine sh / # chmod 777 / -v mode of '/' changed to 0777 (rwxrwxrwx) *chmod禁止パターン $ docker container run --rm -it --security-opt seccomp=default-no-chmod.json alpine sh / # chmod 777 / -v chmod: /: Operation not permitted 参考: https://github.com/docker/labs/tree/master/security/seccomp
このあたりは、よくわからない 今後の課題
Understanding Docker Security and Best Practices 参考: https://blog.docker.com/2015/05/understanding-docker-security-and- best-practices/ DOCKER
SECURITY blog https://www.docker.com/docker-security
ご清聴 ありがとうございました