Skip to content

Commit

Permalink
Revert AuthZ policy, RO applies to volumes as well
Browse files Browse the repository at this point in the history
Refs #47
  • Loading branch information
bviktor committed Jan 14, 2020
1 parent e5d7398 commit 2666dc8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ansible/roles/docker/files/authz.rego
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ unconfined
input.Body.HostConfig.SecurityOpt[_] == "seccomp:unconfined"
}

# prohibit write access to the host file system which
# would essentially grant root privileges to the user
# prohibit access to the host file system outside /home
# which would essentially grant root privileges to the user

valid_host_path_prefixes = {"home/"}

# binds
# `docker run -v /:/host-root`

host_bind_paths[bind]
host_bind_paths[trimmed]
{
input.Body.HostConfig.Binds[_] = bind
split(bind, ":", parts)
trim(parts[0], "/", trimmed)
}

valid_host_bind_paths[host_path]
{
host_bind_paths[host_path]
endswith(host_path, ":ro")
startswith(host_path, valid_host_path_prefixes[_])
}

valid_bind_mapping_whitelist
Expand All @@ -43,15 +47,16 @@ valid_bind_mapping_whitelist
# bind mounts
# `docker run --mount type=bind,source=/,target=/host-root`

host_mount_paths[mount]
host_mount_paths[trimmed]
{
input.Body.HostConfig.Mounts[_] = mount
trim(mount.Source, "/", trimmed)
}

valid_host_mount_paths[host_path]
{
host_mount_paths[host_path]
host_path.ReadOnly
startswith(host_path, valid_host_path_prefixes[_])
}

valid_mount_mapping_whitelist
Expand Down

0 comments on commit 2666dc8

Please sign in to comment.