Skip to content
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

make cockpit definition optional #163

Merged
merged 1 commit into from
Feb 9, 2024
Merged

make cockpit definition optional #163

merged 1 commit into from
Feb 9, 2024

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Feb 2, 2024

The problem is that the cockpit policy moved to the cockpit package in EL9, not in the main selinux policy anymore.
Thus, when installing on a system without cockpit (and its policy), you get ugly errors like:

Failed to resolve typeattributeset statement at /var/lib/selinux/targeted/tmp/modules/400/foreman/cil:66

And more importantly: the whole policy fails to load, leading to many issues at runtime.

To avoid this, we have to wrap the cockpit-related parts of the policy with optional_policy and introduce an own entrypoint that we can use in our file contexts, as there is no optional() for those.

foreman.fc Outdated Show resolved Hide resolved
@evgeni evgeni marked this pull request as draft February 2, 2024 18:12
@evgeni evgeni force-pushed the optional-cockpit branch 2 times, most recently from 10266e3 to bd2fba2 Compare February 8, 2024 09:15
@evgeni evgeni marked this pull request as ready for review February 8, 2024 09:34
foreman.te Show resolved Hide resolved
@evgeni
Copy link
Member Author

evgeni commented Feb 8, 2024

huh, this breaks fresh installs, wild:

error: lsetfilecon: (37 /usr/share/gems/gems/foreman_remote_execution-12.0.5/extra/cockpit/foreman-cockpit-session;65c4c92b, system_u:object_r:foreman_cockpit_session_exec_t:s0) Permission denied
error: Plugin selinux: hook fsm_file_prepare failed

@evgeni
Copy link
Member Author

evgeni commented Feb 8, 2024

# restorecon -v /usr/share/gems/gems/foreman_remote_execution-12.0.5/extra/cockpit/foreman-cockpit-session
restorecon: Could not set context for /usr/share/gems/gems/foreman_remote_execution-12.0.5/extra/cockpit/foreman-cockpit-session:  Permission denied

# dnf install cockpit
…

# restorecon -v /usr/share/gems/gems/foreman_remote_execution-12.0.5/extra/cockpit/foreman-cockpit-session
Relabeled /usr/share/gems/gems/foreman_remote_execution-12.0.5/extra/cockpit/foreman-cockpit-session from unconfined_u:object_r:usr_t:s0 to unconfined_u:object_r:foreman_cockpit_session_exec_t:s0

🤯

@evgeni
Copy link
Member Author

evgeni commented Feb 8, 2024

should be fixed by theforeman/foreman-packaging#10404

@evgeni
Copy link
Member Author

evgeni commented Feb 9, 2024

I've moved the symlink-remove parts into #164 as they are independent from EL9.

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

To my limited understanding, this should be fine

@evgeni evgeni merged commit 2eb3126 into develop Feb 9, 2024
8 of 9 checks passed
@evgeni evgeni deleted the optional-cockpit branch February 9, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants