-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to generate profiles #2
Comments
There are two ways to do it, and it is usually a combination of both. I will write a little explanation of our process somewhere here on Github for any who are interested. First, we use the tracer to generate a basic profile. To do this for '/bin/ls': /usr/bin/oz-seccomp-tracer -t -x -d -o /tmp/ls.seccomp /bin/ls (the -t flag is for training mode, -x is for some other useful output, -d is to for debug output, -o specifies the output file). Our tracer functionality is in transition for now. This means that the output needs to be fixed a little bit by hand and reviewed before it can be used directly. Here is the output from the tracer run I just did on /bin/ls - it's overly aggressive where it doesn't necessarily need to be, i.e., maybe I don't care about the parameters to mmap, or maybe we do. Also, the output right now reflects a bug we need to fix: mprotect: (arg2 == PROT_NONE) || ^^ (the dangling ||) This is happening because we aren't finished our port to gosecco. You need to look for and remove this stuff. Full output from my run below:
|
Once we generate what we consider to be a candidate profile using a runtime analysis with the tracer, we install the profile in Oz (in /var/lib/oz/cells.d and update the profile json for the app), and turn seccomp enforcement off by setting enforce: to false in the seccomp structure. We can also set a debug switch there too, which adds additional output that is useful when making a new whitelist. We then run the application in oz, and any seccomp hits are recorded in /var/log/oz-daemon.log (or daemon.log) for us to review for manual adjustments to the whitelist. On my system, I am still testing a candidate whitelist for 'bitcoin-qt', so where's what my /var/lib/oz/cells.d/bitcoin-qt.json looks like - take note of the seccomp subsection:
|
As I mentioned, seccomp enforcement can be set to off for an application in its oz profile - here is one profile with it enforcement set to true, and no debug parameter:
^^^^ in there you can set "enforce" to false and add "debug" and set it to true. You need to HUP the oz-daemon process for these changes to be read and implemented. Any running sandbox will need to be restarted following this. Seccomp "hits" (policy violations) will be in the aforementioned log. |
I can work with you on this interactively if you join our IRC channel (#subgraph/OFTC) |
Oh -- I should add one thing. The list of constants built into gosecco (our seccomp-bpf library) and what the tracer detects are not the same. If the library doesn't have a constant that the tracer outputs, it can be defined in the profile itself. We're going to the figure out a solution to this later, maybe it will just be in a global include file with some very low level and/or arch specific constants. Take a look at this profile for an example:
|
Thank you for your long reply. I will try this over the weekend. |
How did you generate the profiles and their dependencies like the necessary syscall list?
I am having trouble generating working profiles.
The text was updated successfully, but these errors were encountered: