| Server IP : 88.99.149.37 / Your IP : 216.73.216.141 Web Server : nginx/1.31.2 System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64 User : muralimurth ( 1015) PHP Version : 8.4.23 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/dracut/modules.d/01fips-crypto-policies/ |
Upload File : |
#!/usr/bin/sh
command -v getarg > /dev/null || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ] || [ -z "$fipsmode" ]; then
# Do nothing if not in FIPS mode
return 0
fi
policyfile=/etc/crypto-policies/config
fipspolicyfile=/usr/share/crypto-policies/default-fips-config
backends=/etc/crypto-policies/back-ends
fipsbackends=/usr/share/crypto-policies/back-ends/FIPS
# When in FIPS mode, check the active crypto policy by reading the
# $root/etc/crypto-policies/config file. If it is not "FIPS", or does not start
# with "FIPS:", automatically switch to the FIPS policy by creating
# bind-mounts.
if ! [ -r "${NEWROOT}${policyfile}" ]; then
# No crypto-policies configured, possibly not a system that uses
# crypto-policies?
return 0
fi
if ! [ -f "${NEWROOT}${fipspolicyfile}" ]; then
# crypto-policies is too old to deal with automatic bind-mounting of the
# FIPS policy over the normal policy, do not attempt to do the bind-mount.
return 0
fi
policy=$(cat "${NEWROOT}${policyfile}")
# Remove the largest suffix pattern matching ":*" from the string (i.e., the
# complete list of active policy modules), then check for FIPS. This is part of
# POSIX sh (https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02).
if [ "${policy%%:*}" = "FIPS" ]; then
return 0
fi
# Current crypto policy is not FIPS or FIPS-based, but the system is in FIPS
# mode; this is an inconsistent configuration. Automatically bind-mount a FIPS
# configuration over this.
if ! mount -o bind,ro "${NEWROOT}${fipsbackends}" "${NEWROOT}${backends}"; then
warn "Failed to bind-mount FIPS policy over ${backends} (the system is in FIPS mode, but the crypto-policy is not)."
# If this bind-mount failed, don't attempt to do the other one to avoid
# a system that seems to be in FIPS crypto-policy but actually is not.
return 0
fi
mount -o bind,ro "${NEWROOT}${fipspolicyfile}" "${NEWROOT}${policyfile}" \
|| warn "Failed to bind-mount FIPS crypto-policy state file over ${policyfile} (the system is in FIPS mode, but the crypto-policy is not)."