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

feat: Add variable that handles semantic check for sudoers #22

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

radosroka
Copy link
Collaborator

Enhancement: Add variable that handles semantic check for sudoers.

Reason: This was part of the original MVP of the role.

Result: To make role really idempotent.

Issue Tracker Tickets (Jira or BZ if any):
https://issues.redhat.com/browse/SECENGSP-5532

@radosroka
Copy link
Collaborator Author

[citest]

@@ -0,0 +1,579 @@
#!/usr/bin/python
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need some python unit tests for this module. Maybe the source has some tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am adding python unit tests to CI in #23

README.md Show resolved Hide resolved
@radosroka
Copy link
Collaborator Author

radosroka commented Aug 20, 2024

I believe scan_sudoers script will be rewritten in future so it uses cvtsudoers json output. This was just easier for now.

tasks/main.yml Outdated Show resolved Hide resolved
tasks/main.yml Outdated Show resolved Hide resolved
tasks/main.yml Outdated Show resolved Hide resolved
tasks/main.yml Outdated Show resolved Hide resolved
@radosroka radosroka force-pushed the idempotency branch 2 times, most recently from 0a11d5c to 7a00c2e Compare August 22, 2024 14:42
@radosroka
Copy link
Collaborator Author

[citest]

@spetrosi spetrosi changed the title Add variable that handles semantic check for sudoers feat: Add variable that handles semantic check for sudoers Aug 26, 2024
@spetrosi
Copy link
Contributor

Please rebase to get Python CI tests

Copy link

codecov bot commented Sep 12, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@radosroka
Copy link
Collaborator Author

[citest]

@radosroka radosroka force-pushed the idempotency branch 6 times, most recently from 2574a06 to 79cc171 Compare September 15, 2024 22:39
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Fixed Show fixed Hide fixed
library/scan_sudoers.py Fixed Show fixed Hide fixed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
@radosroka
Copy link
Collaborator Author

[citest]

library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
@radosroka radosroka force-pushed the idempotency branch 2 times, most recently from e865fe4 to c093c9c Compare September 23, 2024 12:43
library/scan_sudoers.py Fixed Show fixed Hide fixed
library/scan_sudoers.py Fixed Show fixed Hide fixed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
library/scan_sudoers.py Fixed Show fixed Hide fixed
library/scan_sudoers.py Dismissed Show dismissed Hide dismissed
@radosroka
Copy link
Collaborator Author

[citest]

This variable provides semantic check of already configured
sudoers in case ansible setup is not needed and it is skipped.

Signed-off-by: Radovan Sroka <[email protected]>
@radosroka
Copy link
Collaborator Author

[citest]

@radosroka
Copy link
Collaborator Author

[citest]

@richm
Copy link
Contributor

richm commented Oct 14, 2024

the tests cannot find the module scan_sudoers - in the directory tests/roles/linux-system-roles.sudo/ add a symlink pointing to the library directory - that is, ls -al tests/roles/linux-system-roles.sudo/ should have a library -> ../../../library/

you can also remove the handlers symlink since it is not used

@richm
Copy link
Contributor

richm commented Oct 14, 2024

@radosroka I submitted a PR against your branch - radosroka#2 - this should make the linters and tests all pass

@richm
Copy link
Contributor

richm commented Oct 16, 2024

[citest]

1 similar comment
@radosroka
Copy link
Collaborator Author

[citest]

tasks/main.yml Outdated Show resolved Hide resolved
@radosroka
Copy link
Collaborator Author

[citest]

radosroka and others added 2 commits October 17, 2024 13:56
sudoers will be scanned every time since it's easier to have
the strucure generated every time
Co-authored-by: Richard Megginson <[email protected]>
@radosroka
Copy link
Collaborator Author

[citest]

@radosroka
Copy link
Collaborator Author

@spetrosi @richm What do you think about those regular expressions? I don't see any problem there.

@richm
Copy link
Contributor

richm commented Oct 17, 2024

@spetrosi @richm What do you think about those regular expressions? I don't see any problem there.

I don't either. I suppose a user could specify some value that would cause problems, but the likelihood of that is extremely low, and it won't cause big problems even if so. plus:

I believe scan_sudoers script will be rewritten in future so it uses cvtsudoers json output. This was just easier for now.

which will completely eliminate the regex problem in the future.

@richm richm merged commit ba6d4e7 into linux-system-roles:main Oct 17, 2024
26 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