NRPE race-condition caused by "chown" ran at update_nrpe_config and nrpe charm

Bug #1906284 reported by Pedro Guimarães
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kubernetes Worker Charm
Incomplete
Undecided
Unassigned
NRPE Charm
Won't Fix
Medium
Unassigned

Bug Description

Hi,

Running latest stable charms.
Some of nrpe checks on kubernetes-worker fail with:

Unable to run kubectl and parse output

That is caused whenever /var/lib/nagios is owned by root instead of nagios user.
That is a clear race condition between nrpe and worker charms.

On worker code, I can see:
https://github.com/charmed-kubernetes/charm-kubernetes-worker/blob/8c3c6061bec0e90ce1eaea24d570d5e7e19e8a78/reactive/kubernetes_worker.py#L1111

Where worker sets owner of the folder as nagios.
On nrpe charm, however, I see the folder is set for root:

2020-11-27 12:07:56 INFO juju-log Making dir /usr/local/lib/nagios/plugins root:root 755
2020-11-27 12:07:56 INFO juju-log Making dir /var/lib/nagios/export/ root:root 755

Therefore, some units may end up with root owner as well. That will depend on which hook is ran before.

This is also confirmed on stat command:
https://pastebin.ubuntu.com/p/RD7scS4G2Z/

Where failing units have root as owner.

Tags: seg sts
Revision history for this message
Pedro Guimarães (pguimaraes) wrote :

Also adding NRPE charm, since it should be setting proper permissions on /var/lib/nagios as part of install hook.

Revision history for this message
Chris Johnston (cjohnston) wrote :

@Pedro, can you confirm which revision of the charms you are using? This should have been fixed in 1.19+ck1 as https://bugs.launchpad.net/charm-kubernetes-worker/+bug/1866382

George Kraft (cynerva)
Changed in charm-kubernetes-worker:
status: New → Incomplete
Eric Desrochers (slashd)
tags: added: seg sts
Edin S (exsdev)
Changed in charm-nrpe:
importance: Undecided → Medium
Revision history for this message
Eric Chen (eric-chen) wrote :

Close this issue because of no update of this issue over 1 year.
Please consider using the new Canonical Observability Stack instead.
(https://charmhub.io/topics/canonical-observability-stack)

Changed in charm-nrpe:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.