Closed briandowns closed 3 years ago
I think we need to do more than this - the log files are getting created at filepath.Join(s.DataDir, "server/logs/audit.log")
which is inheriting container_var_lib_t
since DataDir is /var/lib/rancher/rke2
. Granting full access to container_var_lib_t
is overly broad from a policy perspective; we should probably make the server logs dir container_log_t
and then allow actions on that type if we don't already do so.
I think we need to do more than this - the log files are getting created at
filepath.Join(s.DataDir, "server/logs/audit.log")
which is inheritingcontainer_var_lib_t
since DataDir is/var/lib/rancher/rke2
. Granting full access tocontainer_var_lib_t
is overly broad from a policy perspective; we should probably make the server logs dircontainer_log_t
and then allow actions on that type if we don't already do so.
Happy for feedback. What I pushed initially resolved the issue.
Yeah that would fix it but I don't think its quite the best approach from a least privilege perspective.
So there are a couple things going on in this PR:
rke2_service_t
against container_var_lib_t
. this feels just a hair shy rke2_service_t
:arrow_right: spc_t
which isn't what we wantWe should limit the fix to:
rke2_service_t
so that it can read/write under /var/lib/rancher/rke2/server/logs/
@dweomer IMO we should make /var/lib/rancher/rke2/server/logs/
container_log_t
and then grant access to that.
@dweomer IMO we should make
/var/lib/rancher/rke2/server/logs/
container_log_t
and then grant access to that.
@dweomer and I worked out an approach that I'll be pushing in a few minutes.
@dweomer IMO we should make
/var/lib/rancher/rke2/server/logs/
container_log_t
and then grant access to that.
This is exactly what @briandowns and I discussed.
This PR adds the ability for the kube-apiserver to write to the audit log when auditing is enabled.
Fixes issue raised here.