grantseltzer / karn Goto Github PK
View Code? Open in Web Editor NEWSimplifying Seccomp enforcement in containerized or non-containerized apps
Home Page: https://www.grant.pizza/blog/karn/
License: Mozilla Public License 2.0
Simplifying Seccomp enforcement in containerized or non-containerized apps
Home Page: https://www.grant.pizza/blog/karn/
License: Mozilla Public License 2.0
Run unit tests, have a github hook, all that jazz
This is currently breaking the build, woops
Default action should take the same precedence as normal seccomp rules.
It may be particularly useful if there was a 'notes' field in the declarations so they can be interacted with as opposed to just TOML comments.
For example:
/mnt
but it's possible to mount devices elsewhere. The 'notes' field may say "You need to use /mnt
or edit the declaration to your custom location".Functionality can then be built into the generate command to display notes as computation is done.
There needs to be a package for validating individual values, as well as a full spec. The package should be consumed internally at all input points, as well as a small CLI tool
This means checking actual values for:
For example, if not seccomp action default is specified, make it errno.
This includes creating ~/.karn/declarations
and placing official ones there
The declaration definition should be changed to this (in spec.go
):
// Declaration holds all the data from karn declaration files
type Declaration struct {
SystemCalls SystemCalls `toml:"System-Calls,omitempty"`
Capabilities Capabilities `toml:"Capabilities,omitempty"`
Filesystem FileSystem `toml:"Filesystem,omitempty"`
Network Network `toml:"Network,omitempty"`
System System `toml:"System,omitempty"`
Includes []string `toml:"Includes,omitempty"`
}
This allows for filling in overlap with the varying levels of entitlements. For example, a declaration that grants access to reading/writing from removable devices will need the filesystem
declaration as well as access to the particular socket paths. Instead of copying the filesystem fields into the new one, you can just specify "filesystem" in the Includes
field.
There's some challenge to this, i.e. making sure there aren't duplicate rules specified and solving for circular includes.
karn entitlements
would work.
gobindata is a tool for embedding data into a binary. This is perfect for shipping karn as one static binary with all the entitlement declarations bundled inside.
I haven't fully researched go-bindata's interface but this might be best handled by adding a make target to handle it. Here's an example of a project doing it this way.
The unit tests in generate are missing an import for "github.com/grantseltzer/karn/tests" which is used for the type 'MockWriter'
18:35:50 grant in ~> karn on ~> master
[*] karn generate -d declarations --apparmor
Error: unrecognized action: %!s(MISSING)
i.e. "non-network app", "non-exec-filesys", "read-only"
The default docker seccomp has a lot of these relationships, will be useful resource.
Example:
...
"names": [
"bpf",
"clone",
"fanotify_init",
"lookup_dcookie",
"mount",
"name_to_handle_at",
"perf_event_open",
"quotactl",
"setdomainname",
"sethostname",
"setns",
"umount",
"umount2",
"unshare"
],
"action": "SCMP_ACT_ALLOW",
"args": [],
"comment": "",
"includes": {
"caps": [
"CAP_SYS_ADMIN"
]
},
"excludes": {}
}
...
If one declarations specifies to kill clone
and another says to errno clone
, only one rule should be added (in this case, kill). Instead these are appended. Basically this needs to be implemented.
See the clashing-rules subtest
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.