High-Level Security Profile Generator
(originally from my proposal on https://github.com/docker/docker/issues/17142#issuecomment-148974642 but generic)
The profile would generate artificats of an apparmor profile and seccomp filters.
Obviously doesn't have to be toml since that's super hipster :p
- no one is going to sit and write out all the syscalls/capabilities their app needs
- automatic profiling would be super cool but like
aa-genprofit is never perfect, leads to pain or removing the profile altogether, and an unmaintainable config file (we can always attempt this later)
- maintainable config
- readable by humans and not a linux syscall/cap nerd
- something an app developer would want to write
- someone who did not write the config should be able to understand, at least at a high level, what is restricted
Grouping into categories
High level things you would want to configure should be generic and limited to (for example):
- Filesystem (Disk)
- Runtime (CPU/Memory operations)
- User Operations
The cool thing about
I think we should implement are what they refer to as "flags". It's a set of
syscalls that they allow for a common goal, such as
TAME_RW will allow all
the syscalls for i/o operations but
TAME_RPATH only allows the syscalls that
read-only effects on the filesystem.
We can have this same concept and define them w syscalls and capabilities.
We would need to discuss what these were and find the most common use cases for them.
- If one permission denies a syscall and another allows it, the deny should always override the allow.
- Passing an empty config drops everything and nothing is allowed
Super super super alpha example
jessfraz/bane but better.
[Networking] Flags = [ # this will allow sendto(2), recvfrom(2), socket(2), connect(2) "dns", # adds CAP_NET_RAW "ping" # very high-level "incoming" "outgoing" ] [Filesystem] Flags = [ # will allow lstat(2), chmod(2), chflags(2), # chown(2), unlink(2), fstat(2) on /tmp "tmp" ] # filepaths where you would like to log on write LogOnWrite = [ "/etc/**", "/root/**" ] # read-only filepaths ReadOnly = [ "/sys/**" ] [Runtime] Flags = [ # allows getentropy(2), madvise(2), minherit(2), # mmap(2), mprotect(2), mquery(2), munmap(2) "malloc" ] [User] Flags = [ # allows getuid(2), getgid(2), setuid(2), setugid(2) "create" ]
Will use whatever is installed on the system so if they have apparmor but no seccomp, then it will use apparmor (which can technically do all the syscall, cap, and filesystem privileges).
Taken from apparmor profiles file globbing.
||match a specific file|
||match any files in a directory (including dot files)|
||match any file in a directory starting with a|
||match any file in a directory ending with .png|
||match any file in a directory except dot files|
||match a directory|
||match any directory within /dir/|
||match any directory within /dir/ starting with a|
||match any directory within /dir/ ending with a|
||match any file or directory in or below /dir/|
||match any directory in or below /dir/|
||match any file in or below /dir/|
||match any file or directory in or below /dir/, /dir1/, and /dir2/|
- I think we should allow people to define their own
flags(or whatever we end up calling them). It could be cool to have a way to do it with a
text/templateI believe this is possible if it is implemented the way I am thinking ;)