Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +16 to +26
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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:

# Search for any existing crypto-policy related files or configurations in the repo
find . -type f -name "*crypto*" | head -20

Repository: openshift-kni/telco-reference

Length of output: 250


🏁 Script executed:

cat -n telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-master.yaml

Repository: openshift-kni/telco-reference

Length of output: 1010


Ensure the crypto policy is applied before all multi-user services start.

update-crypto-policies affects services when they start. This unit is ordered only before sshd.service but installed to multi-user.target, so other daemons (kubelet, crio, networking services, etc.) can start with the previous policy and retain it until restarted. To guarantee DEFAULT:NO-SHA1 is in effect across all services on boot, use Before=multi-user.target instead of Before=sshd.service, or add explicit ordering for every service that must inherit this policy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-master.yaml`
around lines 16 - 26, The unit currently only orders Before=sshd.service so many
services started by multi-user.target may inherit the old policy; modify the
unit that contains ExecStart=/usr/bin/update-crypto-policies --set
DEFAULT:NO-SHA1 (the oneshot service with RemainAfterExit=yes and
WantedBy=multi-user.target) to order it before multi-user.target (e.g., replace
or add Before=multi-user.target) so the crypto policy is applied before all
multi-user services start.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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 -20

Repository: 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-policy

Repository: 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 -20

Repository: openshift-kni/telco-reference

Length of output: 847


🏁 Script executed:

cat -n telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-worker.yaml

Repository: openshift-kni/telco-reference

Length of output: 1010


🏁 Script executed:

cat -n telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-master.yaml

Repository: 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 yaml

Repository: 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 2

Repository: openshift-kni/telco-reference

Length of output: 11608


🌐 Web query:

update-crypto-policies RHEL behavior persistent system configuration

💡 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.

update-crypto-policies --set DEFAULT:NO-SHA1 writes persistent configuration to /etc/crypto-policies/, but policies apply only when services start. With this unit ordered only Before=sshd.service and installed to multi-user.target, other system daemons (kubelet, container runtimes, etc.) may start during boot before this service completes and initialize without the strict crypto policy. Add explicit ordering dependencies for all services that must enforce DEFAULT:NO-SHA1 on startup, or move this unit earlier in boot sequencing to guarantee it completes before critical workload services initialize.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@telco-ran/configuration/machineconfigs/crypto-policy/75-crypto-policy-high-worker.yaml`
around lines 16 - 26, The unit runs update-crypto-policies
(ExecStart=/usr/bin/update-crypto-policies --set DEFAULT:NO-SHA1) too late (only
Before=sshd.service, WantedBy=multi-user.target) so other critical daemons may
start without the new policy; modify the unit in
75-crypto-policy-high-worker.yaml to explicitly order it before workload
services (e.g., add Before=kubelet.service containerd.service docker.service
crio.service sshd.service) while keeping
After=systemd-machine-id-commit.service, and move the install target earlier
(e.g., change WantedBy=basic.target or sysinit.target) so the policy is applied
before those services initialize.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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 -30

Repository: openshift-kni/telco-reference

Length of output: 8369


🌐 Web query:

Ignition overwrite true behavior replaces entire file

💡 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:

RHEL authselect /etc/pam.d/system-auth profile-generated content

💡 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:

RHEL 8 9 authselect custom profile PAM files management best practices

💡 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.

overwrite: true plus full file bodies turns a one-option remediation into a fork of /etc/pam.d/system-auth and /etc/pam.d/password-auth. Ignition replaces the entire files, and these paths are managed by RHEL authselect—direct modifications are overwritten when authselect regenerates the profile. This means future base-image PAM changes will not apply unless these encoded blobs are manually refreshed. Use a custom authselect profile instead, which is the supported method for persistent PAM modifications.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telco-ran/configuration/machineconfigs/pam/75-pam-auth-high-master.yaml`
around lines 13 - 24, The MachineConfig "75-pam-auth-high-master.yaml" is
pinning full PAM files (system-auth and password-auth) via overwrite: true and
encoded source blobs, which will forever fork RHEL's authselect-managed files;
instead remove the overwrite/full-file contents for system-auth and
password-auth and implement the change as an authselect custom profile (deploy
the custom profile and enable it via authselect) so PAM is managed by
authselect; update the MachineConfig to deliver only the authselect profile
assets or a bootstrap script that runs authselect select/profile-apply rather
than writing full /etc/pam.d blobs (search for the keys overwrite: true, the
source: "data:..., and the target filenames system-auth and password-auth to
locate the code to change).

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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 f

Repository: 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 -20

Repository: openshift-kni/telco-reference

Length of output: 220


🌐 Web query:

RHEL authselect PAM files overwrite guidance best practices

💡 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:

Ignition machineconfig overwrite true PAM authentication files

💡 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 #653, #1774154). - Version Match: Use Ignition v3.4+ for OCP 4.15+.

Citations:


Avoid pinning the full PAM stack in this MachineConfig.

overwrite: true with full file contents replaces /etc/pam.d/system-auth and /etc/pam.d/password-auth entirely. RHEL's authselect tool manages these files and will warn against manual edits. By using Ignition to override them, you take on the maintenance burden for these files—future base-image PAM changes, security updates, and authselect profile improvements will not apply unless you manually refresh these encoded blobs. Instead, use an authselect custom profile (authselect create-profile myprofile --base-on sssd) to apply the nullok removal in a way that integrates with authselect's lifecycle, or use targeted Ignition edits to modify only the specific lines needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telco-ran/configuration/machineconfigs/pam/75-pam-auth-high-worker.yaml`
around lines 13 - 24, The MachineConfig is overwriting the entire PAM stack by
setting overwrite: true and embedding full contents for /etc/pam.d/system-auth
and /etc/pam.d/password-auth (the long "source: data:..." blobs), which
conflicts with RHEL's authselect; instead, remove the full-file replacements and
implement the nullok removal via an authselect custom profile (authselect
create-profile myprofile --base-on sssd) or by changing the MachineConfig to
perform a targeted edit that patches only the specific pam_unix.so auth/password
lines; update the resources that reference /etc/pam.d/system-auth and
/etc/pam.d/password-auth accordingly, and ensure the MachineConfig no longer
uses overwrite: true for these paths so authselect-managed updates continue to
apply.