Open apollo13 opened 4 years ago
This got away by setting:
plugin "docker" {
config {
volumes {
enabled = true
selinuxlabel = "z"
}
}
}
in the nomad config.
There still seems to be a selinux issue because now I get:
type=AVC msg=audit(1583680590.931:2730): avc: denied { connectto } for pid=88248 comm="envoy" path="/opt/nomad/alloc/016ddeb3-3253-e6aa-7795-1b8dea187224/alloc/tmp/consul_grpc.sock" scontext=system_u:system_r:container_t:s0:c764,c777 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1583680590.974:2731): avc: denied { connectto } for pid=88250 comm="envoy" path="/opt/nomad/alloc/cb3eb8f7-f82c-ece8-d3a8-5fc310771358/alloc/tmp/consul_grpc.sock" scontext=system_u:system_r:container_t:s0:c179,c881 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=1
The blogpost https://danwalsh.livejournal.com/81143.html has a good explanation of why this is not working. The best thing to do here is probably --security-opt label=disable
for the envoy container. Would this be a possibility?
I was able to manually fix the sidecars via:
sidecar_task { config { security_opt = ["label=disable"] } }
in the connect
stanza :)
@shoenig I'm not sure if this is something we could explore improving in the documentation / guide?
@tgross For what it's worth, even a simple "beware does not work well with default selinux rules" would probably go far. I guess the main question is: Is active selinux a supported mode of operation for nomad. The same question could probably be asked for app-armor.
If the answer is yes, then the next question becomes: to which extend do you want to support it.
Hey there
Since this issue hasn't had any activity in a while - we're going to automatically close it in 30 days. If you're still seeing this issue with the latest version of Nomad, please respond here and we'll keep this open and take another look at this.
Thanks!
bump
selinuxlabel
is troublesome, https://github.com/hashicorp/nomad/pull/7094
I am having similar issues with Fedora CoreOS 35.x. The envoy container is having permission issues:
chown: changing ownership of '/dev/stderr': Permission denied
Is there a way to configure nomad clients to use the following as default?
connect {
sidecar_task {
config {
security_opt = ["label=disable"]
}
}
}
E.g. set it once for nomad clients on Fedora CoreOS instead of per job. I could tweak /etc/sysconfig/selinux
, but I would rather not deal with that.
I suppose something that allows me to override the default Envoy task:
meta.connect.sidecar_task_security_opt = ["label=disable"]
similarly to how you allow users to adjust:
meta.connect.sidecar_image = "envoyproxy/envoy:1.21.1"
I guess a better way of dealing with this would having the Nomad agent detect if SELinux is present and do the necessary adjustments for envoy to work, however I would appreciate the ability to set the label via meta
in the client config.
Nomad version
Nomad v0.10.4 (f750636ca68e17dcd2445c1ab9c5a34f9ac69345)
Operating system and Environment details
Fedora 31, with 18.09.8
Issue
The envoy health check in consul stays red and
var/log/audit/audit.log
contains denials:After
sentenforce 0
the health check turns green.Reproduction steps
Run
nomad agent -dev
andconsul agent -dev
and deploy the job file from belowJob file (if appropriate)
Consul logs have:
The other logs do not contain anything interesting sadly.