-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds new BPF programs which restrict the filesystem access (open) inside containers based on configurable allow and deny BPF maps. Allow/deny lists of directories are available in the usespace in lockc configuration. It can be tested by trying to access a denied directory in a container, like: lockc-control-plane-0:~ # docker run --rm -it busybox sh / # ls /sys ls: can't open '/sys': Operation not permitted / # ls /home / # Fixes: #48 Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
- Loading branch information
1 parent
1ca0aef
commit 7cd6a88
Showing
9 changed files
with
676 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
## File access | ||
|
||
lockc comes with policies about file access which is based on allow- and | ||
deny-listing. **Baseline** and **restricted** policies have their own pairs of | ||
lists. All those lists should contain path prefixes. All the children of listed | ||
paths/directories are included, since the decision is made by prefix matching. | ||
|
||
The deny list has precedence over allow list. That's because main purpose of | ||
the deny list is specifying exceptions whose prefixes are specified in the | ||
allow list, but we don't want to allow them. | ||
|
||
To sum it up, when any process in the container tries to access a file, lockc: | ||
|
||
1. Checks whether the given path's prefix is in the deny list. If yes, denies | ||
the access. | ||
2. Checks whether the given path's prefix is in the allow list. If yes, allows | ||
the access. | ||
3. In case of no matches, denies the access. | ||
|
||
By default, the contents of lists are: | ||
|
||
* **baseline** | ||
* allow list | ||
* */bin* | ||
* */dev/console* | ||
* */dev/full* | ||
* */dev/null* | ||
* */dev/pts* | ||
* */dev/tty* | ||
* */dev/urandom* | ||
* */dev/zero* | ||
* */etc* | ||
* */home* | ||
* */lib* | ||
* */proc* | ||
* */sys/fs/cgroup* | ||
* */tmp* | ||
* */usr* | ||
* */var* | ||
* deny list | ||
* */proc/acpi* | ||
* **restricted** | ||
* allow list | ||
* */bin* | ||
* */dev/console* | ||
* */dev/full* | ||
* */dev/null* | ||
* */dev/pts* | ||
* */dev/tty* | ||
* */dev/urandom* | ||
* */dev/zero* | ||
* */etc* | ||
* */home* | ||
* */lib* | ||
* */proc* | ||
* */sys/fs/cgroup* | ||
* */tmp* | ||
* */usr* | ||
* */var* | ||
* deny list | ||
* */proc/acpi* | ||
* */proc/sys* |
Oops, something went wrong.