LoginSignup
28
21

More than 3 years have passed since last update.

PodmanのセキュリティはDockerよりも何が優れているのか?

Last updated at Posted at 2019-01-26

2019/3/1 追記
Docker(18.09.3)にrootlessモードが搭載されたので更新しました。


はじめに

先日、オープンソースのコンテナエンジンPodmanのバージョン1.0.0が公開されました。
Podman | podman.io

PodmanはKubernetesのPodをよりシンプルに柔軟に利用できるように開発されたDocker互換のコンテナエンジンで、Docker Swarm関連を除いたほとんどのDockerコマンドを備えています。

Dockerと比べてアーキテクチャの違いがいくつかありますが、Podmanは特徴の一つとしてセキュリティの強さを謳っています。
この記事ではセキュリティの観点からPodmanの機能に関する調査結果をまとめていきます。

目次

rootlessコンテナ

rootlessとは非root権限で制御できることです。
非root権限で動かせるコンテナのため、問題が起きた際の影響範囲を限定することができます。

2019年1月現在のDocker 18.09ではrootlessに対応していませんが、rootlessモードの開発が進められています。
Allow running dockerd as a non-root user (Rootless mode) #38050

Docker 19.xxで当該機能が追加される......との噂です。

2019/3/1追記

Docker 18.09.3にてrootlessモードが追加されたそうです:tada:
DockerにRootlessモードが入ったぞ!という話 - Qiita
意外と早かった!

Linux Auditにおける脆弱性の回避

Linuxにはセキュリティイベントを監視する機能として、Linux Auditシステムが搭載されています。
Red Hat Enterprise Linux 7 第5章 システム監査 - Red Hat Customer Portal

その中で利用される一部のフィールド値の扱いが、PodmanとDockerでは異なっており、例えば、Podmanではホスト側から見たloginuidコンテナ側から見たloginuidは同一ですが、Dockerではホスト側から見たloginuidコンテナ側から見たloginuidは異なります。

これはDockerコンテナからのログインユーザーをLinux Auditが識別できない可能性を表しています。

edit_file_and_audit_log
$ sudo docker run --privileged -v /:/host fedora touch /host/etc/shadow
$ sudo ausearch -f /etc/shadow -i
type=PROCTITLE msg=audit(10/10/2018 10:27:20.055:4569) : proctitle=/usr/bin/coreutils
--coreutils-prog-shebang=touch /usr/bin/touch /host/etc/shadow
type=SYSCALL msg=audit(10/10/2018 10:27:20.055:4569) : arch=x86_64 syscall=openat
success=yes exit=3 a0=0xffffff9c a1=0x7ffdb6973f50 a2=O_WRONLY|O_CREAT|O_NOCTTY|
O_NONBLOCK a3=0x1b6 items=2 ppid=11863 pid=11882 auid=unset uid=root gid=root
euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset
comm=touch exe=/usr/bin/coreutils subj=system_u:system_r:spc_t:s0 key=(null)


引用:
Podman: A more secure way to run containers | Opensource.com

上記コマンドでは、Dockerコンテナを起動してファイル編集を行ない、Linux Auditのログを出力していますが、auid=unsetとなっており、ユーザーの特定が不可能であることが分かります。

この原因はDockerがクライアント・サーバ型のアーキテクチャであることに依るものですが、下記ページが非常に分かりやすかったので詳しく知りたい方はご一読ください。
Intro to Podman (Red Hat Enterprise Linux 7.6 Beta) - RHD Blog

参考記事まとめ

Podman | podman.io
Podman: A more secure way to run containers | Opensource.com
Allow running dockerd as a non-root user (Rootless mode) #38050
Red Hat Enterprise Linux 7 第5章 システム監査 - Red Hat Customer Portal
Intro to Podman (Red Hat Enterprise Linux 7.6 Beta) - RHD Blog
Dockerセキュリティ: 今すぐ役に立つテクニックから,次世代技術まで

28
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
21