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

semanage: Fix parsing of ignoredirs #758

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

rwmjones
Copy link
Contributor

From /etc/selinux/semanage.conf from a RHEL 9.1 system, this line
caused problems:

ignoredirs=/root;/bin;/boot;/dev;/etc [...]

Parse this as a list of Rx.fspath.

Also this adds the RHEL 9 file as another test case and adjusts the
output of the existing test case.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2077120
Signed-off-by: Richard W.M. Jones [email protected]

Copy link
Member

@georgehansper georgehansper left a comment

Choose a reason for hiding this comment

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

This fix works, and the solution is in-line with the existing Inifile module.

In the event of someone using the previous version of the semange.aug lens to modify an ignoredirs entry with just a single directory, that person would need to update their Augeas path from (eg. for a value of /root ):

set /files/etc/selinux/semanage.conf/ignoredirs "/root"

to

set /files/etc/selinux/semanage.conf/ignoredirs/1 "/root"

Given that the previous version of the semange.aug lens did not allow ; in the ignoredirs value, this use-case is likely to be rare.

From /etc/selinux/semanage.conf from a RHEL 9.1 system, this line
caused problems:

  ignoredirs=/root;/bin;/boot;/dev;/etc [...]

Parse this as a list of modified Rx.fspath, generating a tree like:

  /files/etc/selinux/semanage.conf/ignoredirs/1 = /root
  /files/etc/selinux/semanage.conf/ignoredirs/2 = /bin
  /files/etc/selinux/semanage.conf/ignoredirs/3 = /dev
  /files/etc/selinux/semanage.conf/ignoredirs/4 = /etc
  [...]

Also this adds the RHEL 9 file as another test case and adjusts the
output of the existing test case.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2077120
Signed-off-by: Richard W.M. Jones <[email protected]>
@rwmjones
Copy link
Contributor Author

(rebased on top of master, no other changes)

Copy link
Member

@georgehansper georgehansper left a comment

Choose a reason for hiding this comment

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

As per my previous comment, I think this is good solution.

@georgehansper georgehansper merged commit a3ba6e2 into hercules-team:master Oct 6, 2022
rwmjones added a commit to rwmjones/augeas that referenced this pull request Oct 12, 2022
From /etc/selinux/semanage.conf from a RHEL 9.1 system, this line
caused problems:

  ignoredirs=/root;/bin;/boot;/dev;/etc [...]

Parse this as a list of modified Rx.fspath, generating a tree like:

  /files/etc/selinux/semanage.conf/ignoredirs/1 = /root
  /files/etc/selinux/semanage.conf/ignoredirs/2 = /bin
  /files/etc/selinux/semanage.conf/ignoredirs/3 = /dev
  /files/etc/selinux/semanage.conf/ignoredirs/4 = /etc
  [...]

Also this adds the RHEL 9 file as another test case and adjusts the
output of the existing test case.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2077120
Signed-off-by: Richard W.M. Jones <[email protected]>

Signed-off-by: Richard W.M. Jones <[email protected]>
(cherry picked from commit a3ba6e2)
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.

2 participants