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

Ubuntu enable unix #12660

Merged
merged 18 commits into from
Dec 17, 2024
Merged

Conversation

alanmcanonical
Copy link
Contributor

@alanmcanonical alanmcanonical commented Dec 2, 2024

Description:

  • Create bash_pam_unix_enable macro
  • Use pam-auth-update to remediate the accounts_password_pam_unix_remember and set_password_hashing_algorithm_systemauth
  • In oval, change from any character (.) to non-comment character ([^#]) and add word boundary to pam_unix_algorithms

Rationale:

  • Use pam-auth-update to dynamically remediate and test pam stack
  • The original oval will fail if there is a algo name sha5122, so we need word boundary to constrain the pam_unix_algorithms pattern

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Used by openshift-ci bot. needs-ok-to-test Used by openshift-ci bot. labels Dec 2, 2024
Copy link

openshift-ci bot commented Dec 2, 2024

Hi @alanmcanonical. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

github-actions bot commented Dec 2, 2024

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@dodys dodys self-assigned this Dec 2, 2024
@dodys dodys requested a review from a team December 2, 2024 16:31
@dodys dodys added this to the 0.1.76 milestone Dec 2, 2024
@alanmcanonical alanmcanonical force-pushed the ubuntu_enable_unix branch 2 times, most recently from 534534e to f0fe48c Compare December 3, 2024 17:22
@dodys dodys added the Ubuntu Ubuntu product related. label Dec 3, 2024
@alanmcanonical alanmcanonical marked this pull request as ready for review December 10, 2024 14:31
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Dec 10, 2024
Copy link
Contributor

@mpurg mpurg left a comment

Choose a reason for hiding this comment

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

Changes needed

shared/macros/10-bash.jinja Outdated Show resolved Hide resolved
shared/macros/10-bash.jinja Outdated Show resolved Hide resolved
@openshift-merge-robot openshift-merge-robot added the needs-rebase Used by openshift-ci bot. label Dec 11, 2024
@alanmcanonical alanmcanonical marked this pull request as draft December 11, 2024 17:18
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Dec 11, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Used by openshift-ci bot. label Dec 16, 2024
@alanmcanonical alanmcanonical marked this pull request as ready for review December 16, 2024 16:56
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Dec 16, 2024
Copy link
Contributor

@mpurg mpurg left a comment

Choose a reason for hiding this comment

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

Few changes

FILE="/etc/pam.d/common-password"
sed -i 's/\(.*pam_unix\.so.*\)\s\<nullok\>\(.*\)/\1\2/g' ${FILE}
{{{ bash_pam_unix_enable() }}}
config_file="/usr/share/pam-configs/unix"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be cac_unix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved in 4b4714b

{{% set pam_unix_algorithms = "(sha512|yescrypt|gost_yescrypt|blowfish|sha256|md5|bigcrypt)" %}}
{{% set hashing_pattern = line_pattern + "(?!.*" + pam_unix_algorithms + ".*" + pam_unix_algorithms + ").*" + pam_unix_algorithms + ".*$" %}}
{{% set pam_unix_algorithms = "\\b(sha512|yescrypt|gost_yescrypt|blowfish|sha256|md5|bigcrypt)\\b" %}}
{{% set hashing_pattern = line_pattern + "(?!.*" + pam_unix_algorithms + "[^#]*" + pam_unix_algorithms + ")[^#]*" + pam_unix_algorithms + ".*$" %}}
Copy link
Contributor

Choose a reason for hiding this comment

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

The changes to the regexes affect all platforms. Would be better to make a separate PR for this.

Copy link
Contributor Author

@alanmcanonical alanmcanonical Dec 17, 2024

Choose a reason for hiding this comment

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

A small change from any character (.) to non-comment character ([^#]) and add word boundary to pam_unix_algorithms

Copy link
Contributor

@mpurg mpurg left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

codeclimate bot commented Dec 17, 2024

Code Climate has analyzed commit 4b4714b and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 60.9% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@dodys dodys left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@dodys dodys merged commit a09dab2 into ComplianceAsCode:master Dec 17, 2024
93 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. Ubuntu Ubuntu product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants