Skip to content

ctr: CLI Flag (seccomp-profile) for setting custom seccomp profile.#4525

Merged
estesp merged 1 commit intocontainerd:masterfrom
shishir-a412ed:seccomp
Sep 3, 2020
Merged

ctr: CLI Flag (seccomp-profile) for setting custom seccomp profile.#4525
estesp merged 1 commit intocontainerd:masterfrom
shishir-a412ed:seccomp

Conversation

@shishir-a412ed
Copy link
Copy Markdown
Contributor

No description provided.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 2, 2020

Build succeeded.

@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

Currently, there is no provision to pass a custom seccomp profile using the containerd CLI (ctr).

The current PR introduces a new flag to ctr container create command: seccomp-profile
seccomp must be set to true in order to use this flag [This is to maintain backward compatibility]

  1. Tested this on a ubuntu 18.04.3.
$ ctr container create --help

   --seccomp                 enable the default seccomp profile
   --seccomp-profile value   file path to custom seccomp profile. seccomp must be set to true, before using seccomp-profile
  1. Saved the default seccomp profile provided by docker at /opt/seccomp/seccomp.json

Removed chmod syscall from /opt/seccomp/seccomp.json

  1. Create the container
ctr container create --seccomp=true --seccomp-profile="/opt/seccomp/seccomp.json" docker.io/library/redis:alpine redis
  1. Start the task
ctr task start redis
  1. Exec into the container, and check if Seccomp is enabled, and verify you cannot chmod.
root@vagrant:~/go/src/github.com/containerd# ctr task exec -t --exec-id 123 redis /bin/sh
/data # cat /proc/1/status|grep Seccomp
Seccomp:	2
/data # touch hello.txt
/data # ls -lt
total 0
-rw-r--r--    1 root     root             0 Sep  2 23:02 hello.txt
/data # chmod 0755 hello.txt
chmod: hello.txt: Operation not permitted
/data #

ping @cpuguy83 We discussed this briefly on slack.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 2, 2020

Build succeeded.

Copy link
Copy Markdown
Contributor

@Zyqsempai Zyqsempai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@estesp estesp merged commit 4339431 into containerd:master Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants