Skip to content

Allow aiodns/pycares to watch /etc directory for resolver configuration changes#93

Merged
evgeni merged 3 commits intopulp:mainfrom
Odilhao:allow-etc-watch-pulpcore-worker
Oct 8, 2025
Merged

Allow aiodns/pycares to watch /etc directory for resolver configuration changes#93
evgeni merged 3 commits intopulp:mainfrom
Odilhao:allow-etc-watch-pulpcore-worker

Conversation

@Odilhao
Copy link
Copy Markdown
Contributor

@Odilhao Odilhao commented Oct 7, 2025

This change fixes SELinux AVC denials that occur when upgrading pulpcore from 3.73.15 to 3.85.1. The pulpcore-worker process now monitors the /etc directory for configuration file changes using inotify.

The AVC denial was:
avc: denied { watch } for pid=... comm="pulpcore-worker" path="/etc" scontext=system_u:system_r:pulpcore_t:s0 tcontext=system_u:object_r:etc_t:s0

Changes:

  • Add etc_t type to require section
  • Allow pulpcore_t domain to watch etc_t directories

This is a minimal and targeted fix that only grants the specific watch permission needed for configuration file monitoring.

This change fixes SELinux AVC denials that occur when upgrading pulpcore
from 3.73.15 to 3.85.1. The pulpcore-worker process now monitors the
/etc directory for configuration file changes using inotify.

The AVC denial was:
avc: denied { watch } for pid=... comm="pulpcore-worker" path="/etc"
scontext=system_u:system_r:pulpcore_t:s0 tcontext=system_u:object_r:etc_t:s0

Changes:
- Add etc_t type to require section
- Allow pulpcore_t domain to watch etc_t directories

This is a minimal and targeted fix that only grants the specific watch
permission needed for configuration file monitoring.
Comment thread pulpcore.te Outdated
read_files_pattern(pulpcore_server_t, pulpcore_etc_t, pulpcore_etc_t)

# Allow pulpcore-worker to watch /etc directory for configuration changes
allow pulpcore_t etc_t:dir watch;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't watching pulpcore_etc_t be sufficient? Or is it literally watching /etc? Can you link to the code change that introduced this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know what introduced this (still under investigation), but it's really all /etc.

Also, I managed to repro this in pulpcore-content too, so it needs pulpcore_server_t too

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So after disabling permissive on pulpcore_t/pulpcore_server_t, I managed to repro this issue and get an usefull error:

Oct  8 09:33:08 pipe-katello-server-nightly-centos9-stream pulpcore-worker-1[100288]: pulp [294f2a3b-71be-4740-a21b-7ed728eb485e]: aiodns:WARNING: Failed to create DNS resolver channel with automatic monitoring of resolver configuration changes. This usually means the system ran out of inotify watches. Falling back to socket state callback. Consider increasing the system inotify watch limit: Failed to initialize c-ares channel

We used aiodns 3.2.0 in 3.73, but bumped it to 3.5.0 for 3.85, as part of that (more precisely in 3.3.0), it gained the above c-ares/pycares thing (see aio-libs/aiodns#145) (later enhanced for the above message in aio-libs/aiodns#151)

So this is a legit change and we should allow that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it monitors /etc in case /etc/resolv.conf is updated (recreated)? Guess we can't be any more specific than etc_t in that case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

Comment thread pulpcore.te Outdated
Comment thread pulpcore.te Outdated
@evgeni evgeni changed the title Allow pulpcore-worker to watch /etc directory for configuration changes Allow aiodns/pycares to watch /etc directory for resolver configuration changes Oct 8, 2025
Comment thread pulpcore.te Outdated
@evgeni
Copy link
Copy Markdown
Member

evgeni commented Oct 8, 2025

(I'm running a last install pipeline with the packit build to verify, will merge then)

@evgeni evgeni merged commit 4c81b5c into pulp:main Oct 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants