-
Notifications
You must be signed in to change notification settings - Fork 519
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
support configuring audit rules from bootstrap container #3831
support configuring audit rules from bootstrap container #3831
Conversation
For `auditctl` to work, the process must have CAP_AUDIT_CONTROL, and must be running in the initial PID namespace. Signed-off-by: Ben Cressey <[email protected]>
This makes it easier to associate journal output with a particular container, instead of having to match it to the PID of the parent `host-ctr` process. Signed-off-by: Ben Cressey <[email protected]>
@diranged - any concerns about the It means bootstrap container output will show up in the journal like this:
Rather than like this:
This doesn't address your feature request in #3811 but it may make the logs more useful in the interim. |
Yeah - I think this is an overall improvement, so I support it. I appreciate you checking in, this will not break anything on our end right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the linting suggestions, those are new.
Opened #3840 to track this. |
Issue number:
Closes #3808
Description of changes:
Run bootstrap containers in the host PID namespace, and with
CAP_AUDIT_CONTROL
, so that audit rules can be configured.To facilitate debugging, associate the journal entries to the matching host or bootstrap container by setting the
SyslogIdentifier
field. This was helpful when troubleshooting issues with myauditctl
container.Testing done:
When adding path-based watches, there's an additional wrinkle in that the path will be based on the current root, which will be the root of the bootstrap container's mount namespace.
To work around this, it's necessary to invoke auditctl like this:
Or like this:
It's also a good idea to clear out previous rules (
auditctl -D
) so that the default rules don't filter out events of interest. Syscall auditing is disabled by default, and non-SELinux related messages are discarded.With that in mind, I used the following script in my bootstrap container:
This produced the following output at launch:
Afterwards, the rules were visible on the host and
/etc/passwd
writes were logged.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.