Container Security
Sysdig
Section titled “Sysdig”インストール方法は、こちら
curl -s https://download.sysdig.com/DRAIOS-GPG-KEY.public | sudo apt-key add -sudo curl -s -o /etc/apt/sources.list.d/draios.list https://download.sysdig.com/stable/deb/draios.listsudo apt-get updatesudo apt-get -y install linux-headers-$(uname -r)sudo apt-get -y install sysdigsysdig --versionインストール方法は、こちら
- falco.yaml: Falcoの設定ファイル
- falco_rules.yaml: Falcoのデフォルトルール
- falco_rules.local.yaml: Falcoのカスタムルール
$ cat /etc/falco/falco_rules.local.yaml# Your custom rules!- macro: is_container condition: container.id != host
- list: suspicious_process items: [ps, sleep]
- rule: spawn_suspicious_process_in_container desc: Notice spawn suspicious process within a container condition: evt.type = execve and evt.dir = < and is_container and proc.name in (suspicious_process) output: Spawn suspicious process in a container (container_id=%container.id container_name=%container.name process=%proc.name parent=%proc.pname cmdline=%proc.cmdline) priority: WARNING意図しないコンテナイメージの実行を検知する
Section titled “意図しないコンテナイメージの実行を検知する”コンテナレジストリやイメージ名を指定して、意図しないコンテナイメージの実行を検知することができる。
$ cat /etc/falco/falco_rules.local.yaml
- macro: using_trusted_image condition: (container.image.repository startswith "docker.io/library" or container.image.repository startswith "docker.io/nginx")
- rule: Using untrusted container image desc: Detect using untrusted container image condition: evt.type = container and not using_trusted_image output: "Container started using untrusted container image. (user=\%user.name image=\%container.image.repository:\%container.image.tag)" priority: INFOdocker-bench-security
Section titled “docker-bench-security”docker-bench-securityをクローンし、docker-bench-security.shを実行することで、Dockerのセキュリティ設定をチェックすることができる。結果は、docker-bench-security/log/ に置かれる。
特定の監査項目をスキップする場合は、-eオプションを使用する。