Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #19 from vrothberg/consistency-check
Browse files Browse the repository at this point in the history
Consistency check
  • Loading branch information
rhatdan authored Jun 27, 2019
2 parents 9f53970 + 3197227 commit 000d349
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jobs:
- persist_to_workspace:
root: .
paths:
- default.json
- seccomp.json
- store_artifacts:
path: generate
destination: generate
- store_artifacts:
path: default.json
destination: default.json
path: seccomp.json
destination: seccomp.json

unit-tests:
executor: container
Expand All @@ -76,6 +76,7 @@ jobs:
vendor:
executor: container
steps:
- <<: *prepare-env
- checkout
- restore_cache:
keys:
Expand All @@ -85,6 +86,11 @@ jobs:
command: |
make vendor
hack/tree_status.sh
- run:
name: check profile consistency
command: |
make seccomp.json
git diff --exit-code
- save_cache:
key: v1-vendor-{{ checksum "go.sum" }}
paths:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
default.json
*.orig
generate
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ PACKAGE := github.com/seccomp/containers-golang

sources := $(wildcard *.go)

default.json: $(sources)
.PHONY: seccomp.json
seccomp.json: $(sources)
$(GO) build -compiler gc $(BUILDFLAGS) ./cmd/generate.go
$(GO) build -compiler gc ./cmd/generate.go
$(GO) run ${BUILDFLAGS} cmd/generate.go

all: default.json
all: seccomp.json

.PHONY: test-unit
test-unit:
Expand All @@ -28,4 +29,4 @@ vendor:

.PHONY: clean
clean:
rm -f default.json generate
rm -f generate
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
seccomp (short for secure computing mode) is a BPF based syscall filter language and present a more conventional function-call based filtering interface that should be familiar to, and easily adopted by, application developers.

## Building
make - Generates default.json file, which containes the whitelisted syscalls that can be used by container runtime engines like [CRI-O][cri-o], [Buildah][buildah], [Podman][podman] and [Docker][docker], and container runtimes like OCI [Runc][runc] to controll the syscalls available to containers.
make - Generates seccomp.json file, which contains the whitelisted syscalls that can be used by container runtime engines like [CRI-O][cri-o], [Buildah][buildah], [Podman][podman] and [Docker][docker], and container runtimes like OCI [Runc][runc] to controll the syscalls available to containers.

### Supported build tags

Expand Down
2 changes: 1 addition & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
if err != nil {
panic(err)
}
f := filepath.Join(wd, "default.json")
f := filepath.Join(wd, "seccomp.json")

// write the default profile to the file
b, err := json.MarshalIndent(seccomp.DefaultProfile(), "", "\t")
Expand Down
13 changes: 6 additions & 7 deletions seccomp.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"mlockall",
"mmap",
"mmap2",
"mount",
"mprotect",
"mq_getsetattr",
"mq_notify",
Expand All @@ -210,6 +211,7 @@
"munlock",
"munlockall",
"munmap",
"name_to_handle_at",
"nanosleep",
"newfstatat",
"_newselect",
Expand All @@ -234,6 +236,7 @@
"readlink",
"readlinkat",
"readv",
"reboot",
"recv",
"recvfrom",
"recvmmsg",
Expand Down Expand Up @@ -347,6 +350,7 @@
"truncate64",
"ugetrlimit",
"umask",
"umount",
"uname",
"unlink",
"unlinkat",
Expand All @@ -359,12 +363,7 @@
"waitid",
"waitpid",
"write",
"writev",
"mount",
"umount2",
"reboot",
"name_to_handle_at",
"unshare"
"writev"
],
"action": "SCMP_ACT_ALLOW",
"args": [],
Expand Down Expand Up @@ -770,4 +769,4 @@
"excludes": {}
}
]
}
}
2 changes: 1 addition & 1 deletion seccomp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestLoadProfile(t *testing.T) {
}

func TestLoadDefaultProfile(t *testing.T) {
f, err := ioutil.ReadFile("default.json")
f, err := ioutil.ReadFile("seccomp.json")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 000d349

Please sign in to comment.