-
Notifications
You must be signed in to change notification settings - Fork 64
CNF-21212: RAN Hardening (4.22) - HIGH Severity Compliance Remediations #529
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfig | ||
| metadata: | ||
| name: 75-crypto-policy-high-master | ||
| labels: | ||
| machineconfiguration.openshift.io/role: master | ||
| spec: | ||
| config: | ||
| ignition: | ||
| version: 3.5.0 | ||
| systemd: | ||
| units: | ||
| - name: configure-crypto-policy.service | ||
| enabled: true | ||
| contents: | | ||
| [Unit] | ||
| Description=Configure System Crypto Policy | ||
| Before=sshd.service | ||
| After=systemd-machine-id-commit.service | ||
| ConditionFirstBoot=no | ||
| [Service] | ||
| Type=oneshot | ||
| ExecStart=/usr/bin/update-crypto-policies --set DEFAULT:NO-SHA1 | ||
| RemainAfterExit=yes | ||
| [Install] | ||
| WantedBy=multi-user.target | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfig | ||
| metadata: | ||
| name: 75-crypto-policy-high-worker | ||
| labels: | ||
| machineconfiguration.openshift.io/role: worker | ||
| spec: | ||
| config: | ||
| ignition: | ||
| version: 3.5.0 | ||
| systemd: | ||
| units: | ||
| - name: configure-crypto-policy.service | ||
| enabled: true | ||
| contents: | | ||
| [Unit] | ||
| Description=Configure System Crypto Policy | ||
| Before=sshd.service | ||
| After=systemd-machine-id-commit.service | ||
| ConditionFirstBoot=no | ||
| [Service] | ||
| Type=oneshot | ||
| ExecStart=/usr/bin/update-crypto-policies --set DEFAULT:NO-SHA1 | ||
| RemainAfterExit=yes | ||
| [Install] | ||
| WantedBy=multi-user.target | ||
|
Comment on lines
+16
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's check if the file exists and understand the repository structure
find . -name "*75-crypto-policy*" -o -name "*crypto-policy*" | head -20Repository: openshift-kni/telco-reference Length of output: 305 🏁 Script executed: # List the directory structure around the crypto-policy config
git ls-files | grep -i crypto-policyRepository: openshift-kni/telco-reference Length of output: 246 🏁 Script executed: # Check if this is an OpenShift/MachineConfig context by looking for related files
git ls-files | grep -E "(machineconfig|MachineConfig)" | head -20Repository: openshift-kni/telco-reference Length of output: 847 🏁 Script executed: cat -n telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-worker.yamlRepository: openshift-kni/telco-reference Length of output: 1010 🏁 Script executed: cat -n telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-master.yamlRepository: openshift-kni/telco-reference Length of output: 1010 🏁 Script executed: # Search for any other references to crypto-policy or update-crypto-policies in the repo
rg -i "update-crypto-policies|crypto-policies" --type yamlRepository: openshift-kni/telco-reference Length of output: 398 🏁 Script executed: # Look for any documentation or comments about crypto-policy strategy
rg -i "crypto.policy|nist|sha1" --type yaml -B 2 -A 2Repository: openshift-kni/telco-reference Length of output: 11608 🌐 Web query:
💡 Result: The update-crypto-policies command in RHEL manages system-wide cryptographic policies, which configure core cryptographic subsystems (e.g., OpenSSL, GnuTLS, NSS, OpenSSH) across the system. It creates a persistent system configuration. Key behavior: - Running update-crypto-policies --set (e.g., sudo update-crypto-policies --set FUTURE) overwrites /etc/crypto-policies/config with the selected policy name (including subpolicies like DEFAULT:NO-SHA1). - It generates policy files in /etc/crypto-policies/back-ends/ for each supported back-end (e.g., openssl.config, openssh.config symlinks or includes). - It writes the expanded policy definition to /etc/crypto-policies/state/CURRENT.pol and the policy name to /etc/crypto-policies/state/current. - These changes in /etc/ are persistent across reboots and package updates (though update-crypto-policies --check can detect mismatches if back-ends are manually edited). - Policies apply on application startup; a system reboot is recommended for full effect on running services. - View current policy: update-crypto-policies --show. - Predefined policies: DEFAULT (balanced), LEGACY (compatibility), FUTURE (strict), FIPS. This ensures centralized, persistent control over allowed algorithms, protocols, ciphers, and key sizes system-wide. Citations:
Ensure critical services apply the crypto policy immediately.
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfig | ||
| metadata: | ||
| name: 75-pam-auth-high-master | ||
| labels: | ||
| machineconfiguration.openshift.io/role: master | ||
| spec: | ||
| config: | ||
| ignition: | ||
| version: 3.5.0 | ||
| storage: | ||
| files: | ||
| - path: /etc/pam.d/system-auth | ||
| mode: 0644 | ||
| overwrite: true | ||
| contents: | ||
| # nullok removed from pam_unix.so auth and password lines | ||
| source: "data:,auth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_usertype.so%20issystem%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20use_authtok%0Apassword%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A" | ||
| - path: /etc/pam.d/password-auth | ||
| mode: 0644 | ||
| overwrite: true | ||
| contents: | ||
| # nullok removed from pam_unix.so auth and password lines | ||
| source: "data:,auth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_usertype.so%20issystem%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20use_authtok%0Apassword%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A" | ||
|
Comment on lines
+13
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's examine the actual file to understand its structure
cat -n telco-ran/configuration/machineconfigs/pam/75-pam-auth-high-master.yaml | head -30Repository: openshift-kni/telco-reference Length of output: 8369 🌐 Web query:
💡 Result: In CoreOS/Fedora CoreOS Ignition (the first-boot configuration tool), the overwrite: true field in a storage.files entry controls whether Ignition replaces the entire existing file at the specified path with the new contents from the config's contents.source (inline data or remote URL). By default (overwrite: false, since Ignition spec v3.0.0), if a file exists at the path: - Ignition verifies the file exists but does not modify its contents, mode, owner, or group. - If no contents are specified, it creates an empty file if needed. With overwrite: true: - Ignition overwrites (replaces) the entire existing file with the specified contents, regardless of prior content. - It also applies the specified mode, user, and group (defaults: mode 0644, root:root). - This is required to update files that already exist on first boot (e.g., from base image). Example config snippet: { "ignition": {"version": "3.5.0"}, "storage": { "files": [{ "path": "/etc/example.conf", "overwrite": true, "contents": {"source": "data:text/plain;base64,ZXhhbXBsZQ%3D%3D"}, "mode": 644 }] } } This replaces /etc/example.conf entirely with "example". Note: Ignition runs only once on first boot; changes are immutable afterward without reprovisioning. For idempotency on retries/failures, use verified hashes. This behavior is consistent across directories/links too, but the query focuses on files. Citations:
🌐 Web query:
💡 Result: The /etc/pam.d/system-auth file in RHEL is automatically generated and managed by authselect when a profile is selected (e.g., via 'authselect select sssd'). It contains a header warning not to edit manually, followed by PAM stack configurations for auth, account, password, and session phases. The exact content varies by selected profile (sssd, minimal, winbind) and enabled features (with-faillock, with-smartcard, etc.). Example header from RHEL 10 sssd profile (sources 7,8,9): # Do not modify this file manually, use authselect instead. Any user changes will be overwritten. # You can stop authselect from managing your configuration by calling 'authselect opt-out'. # See authselect(8) for more details. Example auth stack snippet from RHEL 8/9 sssd profile (sources 2,4,11,15,44): auth required pam_env.so auth required pam_faildelay.so delay=2000000 auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet auth sufficient pam_unix.so nullok try_first_pass auth requisite pam_succeed_if.so uid >= 1000 quiet_success auth sufficient pam_sss.so forward_pass auth required pam_deny.so The full template for sssd profile is available in the authselect upstream source (source 51): https://github.com/authselect/authselect/blob/master/profiles/sssd/system-auth It uses conditional syntax like {include if "with-faillock"} for modules such as pam_faillock.so, pam_fprintd.so (fingerprint), pam_u2f.so (U2F), pam_unix.so, pam_sss.so, pam_gssapi, etc., across all PAM types (auth, account, password, session). Common includes: pam_access.so (with-pamaccess), pam_gnome_keyring.so, pam_ecryptfs.so, pam_oddjob_mkhomedir.so. To view exact generated content on a system: cat /etc/pam.d/system-auth after running authselect select [features]. Direct manual edits are overwritten on next authselect apply-changes or select (sources 1-10). Use custom profiles for modifications (source 3). Profiles are in /usr/share/authselect/default/ on RHEL systems. Citations:
🌐 Web query:
💡 Result: Best practices for managing custom authselect profiles and PAM files on RHEL 8 and 9: 1. Avoid direct editing of /etc/pam.d/ files or /etc/nsswitch.conf. Authselect regenerates these from profile templates. Manual changes are overwritten and cause errors on authselect check or apply-changes. 2. Create custom profiles only when built-in profiles (sssd, winbind, minimal) with features (e.g., with-faillock, with-mkhomedir, with-smartcard) are insufficient. 3. To create a custom profile: sudo authselect create-profile myprofile -b sssd [--symlink-pam --symlink-meta --symlink-nsswitch] - Use --symlink-pam if NOT modifying PAM templates (system-auth, password-auth) to inherit upstream updates. - Omit --symlink-pam if customizing PAM templates, as changes must persist across authselect-libs upgrades. - Custom profiles stored in /etc/authselect/custom/myprofile/. 4. Edit templates in the custom profile directory: - PAM: system-auth, password-auth, postlogin, etc. - NSS: nsswitch.conf - Use authselect feature syntax like {if "with-faillock": ...} for conditional modules. 5. Apply the profile: sudo authselect select custom/myprofile [with-feature1 with-feature2] [--force] 6. Always run authselect check after changes to verify integrity. Fix issues with --force or restore backup. 7. Backup before changes: sudo authselect backup my-backup Restore: sudo authselect backup-restore my-backup 8. Apply user overrides: Edit /etc/authselect/user-* files then sudo authselect apply-changes. 9. For IdM/AD joins (ipa-client-install, realm join), do not modify auto-configured profiles. 10. Test thoroughly: authselect test to preview changes. This ensures maintainable, upgradable configurations without breaking authentication. Citations:
Avoid pinning the whole PAM stack in this MachineConfig.
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: machineconfiguration.openshift.io/v1 | ||
| kind: MachineConfig | ||
| metadata: | ||
| name: 75-pam-auth-high-worker | ||
| labels: | ||
| machineconfiguration.openshift.io/role: worker | ||
| spec: | ||
| config: | ||
| ignition: | ||
| version: 3.5.0 | ||
| storage: | ||
| files: | ||
| - path: /etc/pam.d/system-auth | ||
| mode: 0644 | ||
| overwrite: true | ||
| contents: | ||
| # nullok removed from pam_unix.so auth and password lines | ||
| source: "data:,auth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_usertype.so%20issystem%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20use_authtok%0Apassword%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A" | ||
| - path: /etc/pam.d/password-auth | ||
| mode: 0644 | ||
| overwrite: true | ||
| contents: | ||
| # nullok removed from pam_unix.so auth and password lines | ||
| source: "data:,auth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_usertype.so%20isregular%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_usertype.so%20issystem%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20use_authtok%0Apassword%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A" | ||
|
Comment on lines
+13
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's check if the file exists and examine its full content
find . -name "75-pam-auth-high-worker.yaml" -type fRepository: openshift-kni/telco-reference Length of output: 146 🏁 Script executed: # Search for other pam-related config files to understand the pattern
find . -path "*pam*" -name "*.yaml" -o -path "*pam*" -name "*.yml" | head -20Repository: openshift-kni/telco-reference Length of output: 220 🌐 Web query:
💡 Result: Do not directly edit PAM files in /etc/pam.d/ (such as system-auth, password-auth). Authselect manages these files and will overwrite manual changes. Best practices: - Use 'authselect select [with-]' to configure (e.g., 'authselect select sssd with-faillock'). Use --force only if necessary to overwrite changes. - Enable/disable features with 'authselect enable-feature ' or 'authselect disable-feature '. - Check integrity: 'authselect check'. If modified, run 'authselect apply-changes' to restore. - For customizations beyond features, create custom profile: 'authselect create-profile myprofile --base-on sssd', edit templates in /etc/authselect/custom/myprofile/, then 'authselect select custom/myprofile'. - Always backup first: 'authselect backup my-backup'. - Avoid opt-out unless necessary, as it gives full manual control but loses authselect benefits. - PAM files contain warnings: "Do not modify this file manually, use authselect instead. Any user changes will be overwritten." This applies to RHEL 8,9,10 per official docs. Citations:
🌐 Web query:
💡 Result: In OpenShift Container Platform (using RHCOS nodes) and Fedora CoreOS, Ignition configurations within MachineConfig objects allow overwriting PAM authentication files (e.g., in /etc/pam.d/) using the storage.files section with overwrite: true. ## Key Concepts - Ignition storage.files: Specifies files to write to the filesystem. The overwrite field (boolean, defaults to false) determines if an existing file at the path is replaced. - From Ignition spec: Files default to overwrite: false since v3.0.0; set to true to force replacement. - MachineConfig: OpenShift's CRD embeds Ignition configs. The Machine Config Operator (MCO) applies them to nodes, rebooting as needed. MCO detects drift if files change outside its control but respects overwrite: true for managed files. - PAM Files: /etc/pam.d/* (e.g., system-auth, password-auth) control authentication. Customizing them via Ignition overwrites defaults for features like password auth, SSSD, or U2F. ## Example: Overwrite PAM Config for SSH Password Auth (FCOS/RHCOS) Use Butane YAML (converted to Ignition via butane tool), then embed in MachineConfig. Butane config (pam-auth.bu): variant: openshift # or fcos version: 4.17.0 # Match OCP/RHCOS version storage: files: - path: /etc/ssh/sshd_config.d/20-enable-passwords.conf mode: 0644 overwrite: true contents: inline: | PasswordAuthentication yes - path: /etc/pam.d/system-auth mode: 0644 overwrite: true contents: inline: | #%PAM-1.0 # Custom PAM stack; adjust as needed (e.g., add pam_unix.so for passwords) auth required pam_faildelay.so delay=2000000 auth sufficient pam_unix.so nullok try_first_pass # ... full stack from standard RHEL/FCOS PAM Convert: butane --pretty --strict pam-auth.bu -o pam-auth.yaml MachineConfig YAML (99-worker-pam.yaml): apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: worker name: 99-worker-pam spec: config: # Paste rendered Ignition from above ignition: version: 3.4.0 storage: files: - path: /etc/ssh/sshd_config.d/20-enable-passwords.conf overwrite: true mode: 420 # Decimal 0644 contents: source: data:text/plain;charset=utf-8;base64,UGFzc3dvcmRBdXRoZW50aWNhdGlvbiB5ZXM= # base64 of content - path: /etc/pam.d/system-auth overwrite: true mode: 420 contents: source: data:,... # base64 of full PAM content Apply: oc apply -f 99-worker-pam.yaml Nodes reboot, MCO applies changes. Monitor: oc get mcp worker. ## Warnings - Drift Detection: Manual edits to managed files degrade nodes until corrected. - Security: Enabling password auth increases risk; prefer SSH keys. - SSSD/PAM: For SSSD, overwrite /etc/pam.d/* and /etc/nsswitch.conf (see issues Citations:
Avoid pinning the full PAM stack in this MachineConfig.
🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
update-crypto-policies systemd when takes effect immediately💡 Result:
Running update-crypto-policies (e.g., update-crypto-policies --set FUTURE) updates configuration files in /etc/crypto-policies/back-ends/ for supported cryptographic backends like OpenSSL, GnuTLS, NSS, OpenSSH, BIND, etc. These changes take effect for newly started applications and services immediately. For long-running services managed by systemd (e.g., sshd, httpd, nginx), a restart is typically required to reload the configs, as policies are loaded at startup. By default, the tool attempts to reload some running applications that support dynamic reloading via the --no-reload option (which skips this). However, official documentation (Red Hat, man pages) recommends restarting affected systemd services or rebooting for full effect, especially since not all services support reload. No specific --systemd option exists; systemd integration is via service restarts/reloads post-update.
Citations:
🌐 Web query:
systemd multi-user.target boot order Before After ordering💡 Result:
The systemd multi-user.target is a special target that represents a non-graphical multi-user system state, equivalent to SysV runlevels 2, 3, and 4. It is reached during boot after basic system initialization. Boot order (Before/After ordering from official docs and unit file): - Before: sysinit.target (implicit for most services), various early boot targets like local-fs.target, swap.target, network.target, getty.target (via symlinks in multi-user.target.wants). - Requires and After: basic.target (directly from unit file). - Conflicts: rescue.service, rescue.target. - After graphical.target pulls it in (graphical.target Requires=multi-user.target). Unit file contents (/usr/lib/systemd/system/multi-user.target): [Unit] Description=Multi-User System Documentation=man:systemd.special(7) Requires=basic.target Conflicts=rescue.service rescue.target After=basic.target rescue.service rescue.target AllowIsolate=yes To view on a system: systemctl cat multi-user.target or systemctl show multi-user.target -p Requires,After,Conflicts,Before. Services wanting to start at multi-user use WantedBy=multi-user.target in [Install]. To run before multi-user.target, use Before=multi-user.target. To run after, use After=multi-user.target. Boot flow: sysinit.target -> basic.target -> multi-user.target (-> graphical.target if default).
Citations:
🏁 Script executed:
Repository: openshift-kni/telco-reference
Length of output: 250
🏁 Script executed:
Repository: openshift-kni/telco-reference
Length of output: 1010
Ensure the crypto policy is applied before all multi-user services start.
update-crypto-policiesaffects services when they start. This unit is ordered only beforesshd.servicebut installed tomulti-user.target, so other daemons (kubelet, crio, networking services, etc.) can start with the previous policy and retain it until restarted. To guaranteeDEFAULT:NO-SHA1is in effect across all services on boot, useBefore=multi-user.targetinstead ofBefore=sshd.service, or add explicit ordering for every service that must inherit this policy.🤖 Prompt for AI Agents