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

Use selinux facts to compare module checksums before copying to a node #144

Merged
merged 6 commits into from Feb 2, 2023

Conversation

bachradsusi
Copy link
Member

Should address #142

This is early development version which already supports standard cases on rhel8.-6 and later.

Even though it still needs to be finished, I'd appreciate any early feedback.

tasks/main.yml Outdated
@@ -115,10 +115,9 @@
- name: Load SELinux modules
include_tasks: selinux_load_module.yml
vars:
name: "{{ item.name | default('') }}"
name: "{{ item.name | default( item.path | basename | splitext | first ) }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "{{ item.name | default( item.path | basename | splitext | first ) }}"
name: "{{ item.name | default(item.path | basename | splitext | first) }}"

tasks/main.yml Show resolved Hide resolved
@richm
Copy link
Contributor

richm commented Jan 31, 2023

[citest]

@richm
Copy link
Contributor

richm commented Feb 1, 2023

You'll need to rebase now that #145 is merged which should fix the CI test issues

@richm
Copy link
Contributor

richm commented Feb 1, 2023

Also, if you really need to use become for some reason, see #145 for some alternatives.

- generate facts using libsemanage instead of spawning `semodule`

- add modules checksum

Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
@bachradsusi
Copy link
Member Author

[citest]

1 similar comment
@richm
Copy link
Contributor

richm commented Feb 1, 2023

[citest]

@bachradsusi
Copy link
Member Author

Is there a way to get previous results? Ive waited for them several hours and now they're gone :)

@richm
Copy link
Contributor

richm commented Feb 1, 2023

Is there a way to get previous results? Ive waited for them several hours and now they're gone :)

It's possible, but not easy. What I can tell you is that in the previous run all of the tests passed except for RHEL-9.2/ansible-2.14, RHEL-7.9/ansible-2.14, RHEL-6.10/ansible-2.9, Fedora-36/ansible-2.14
All of these look like a problem with the ci system, not with the selinux role, which is why I'm re-running to see if they pass. Looks like rhel6 has an issue with other roles so may have to cancel that one.

@bachradsusi
Copy link
Member Author

ok

@richm
Copy link
Contributor

richm commented Feb 1, 2023

@bachradsusi I think this is ready - do you want to remove the WIP?

@bachradsusi
Copy link
Member Author

selinux_modules_facts module returns empty installed modules on rhel6:

10.0.137.51 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python",
        "selinux_checksums": true,
        "selinux_installed_modules": {},
        "selinux_priorities": false
    },
    "changed": false
}

Given that the libsemanage checksum is not supported on rhel6 and that the role doesn't use it, it's probably not a big deal but I guess I should fix it before it's merged.

- fallback to semanage_module_list() when there's no
semanage_module_list_all()

- use priority 0 when libsemanage does not support it
).communicate()
checksums = True
try:
r, modinfo, num_modules = semanage.semanage_module_list_all(sh)

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable

Local variable 'sh' may be used before it is initialized.
@bachradsusi
Copy link
Member Author

[citest]

@bachradsusi bachradsusi changed the title WIP: Use selinux facts to compare module checksums before copying to a node Use selinux facts to compare module checksums before copying to a node Feb 2, 2023
@bachradsusi
Copy link
Member Author

I think it's ready.

@richm richm merged commit 7272343 into linux-system-roles:main Feb 2, 2023
richm added a commit to richm/linux-system-roles-selinux that referenced this pull request Feb 2, 2023
[1.5.3] - 2023-02-02
--------------------

### New Features

- none

### Bug Fixes

- Use selinux facts to compare module checksums before copying to a node (linux-system-roles#144)

### Other Changes

- do not use 'become' in tests, examples (linux-system-roles#145)

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
richm added a commit that referenced this pull request Feb 2, 2023
[1.5.3] - 2023-02-02
--------------------

### New Features

- none

### Bug Fixes

- Use selinux facts to compare module checksums before copying to a node (#144)

### Other Changes

- do not use 'become' in tests, examples (#145)

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
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.

None yet

2 participants