|
|
ddb60b |
Author: Antonio Torres <antorres@redhat.com>
|
|
|
ddb60b |
Date: Fri Jul 2 07:12:48 2021 -0400
|
|
|
ddb60b |
Subject: [PATCH] exit if host in FIPS mode and MD5 not explicitly allowed
|
|
|
ddb60b |
|
|
|
ddb60b |
FIPS does not allow MD5, which FreeRADIUS needs to work. The user should
|
|
|
ddb60b |
explicitly allow MD5 usage by setting the RADIUS_MD5_FIPS_OVERRIDE environment
|
|
|
ddb60b |
variable to 1 or else FR should exit at start.
|
|
|
ddb60b |
|
|
|
ddb60b |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1958979
|
|
|
ddb60b |
Signed-off-by: Antonio Torres antorres@redhat.com
|
|
|
ddb60b |
---
|
|
|
ddb60b |
src/main/radiusd.c | 14 ++++++++++++++
|
|
|
ddb60b |
1 file changed, 14 insertions(+)
|
|
|
ddb60b |
|
|
|
ddb60b |
diff --git a/src/main/radiusd.c b/src/main/radiusd.c
|
|
|
ddb60b |
index 9739514509..58a48895e6 100644
|
|
|
ddb60b |
--- a/src/main/radiusd.c
|
|
|
ddb60b |
+++ b/src/main/radiusd.c
|
|
|
ddb60b |
@@ -298,6 +298,20 @@ int main(int argc, char *argv[])
|
|
|
ddb60b |
exit(EXIT_FAILURE);
|
|
|
ddb60b |
}
|
|
|
ddb60b |
|
|
|
ddb60b |
+ /*
|
|
|
ddb60b |
+ * If host is in FIPS mode, we need the user to explicitly allow MD5 usage.
|
|
|
ddb60b |
+ */
|
|
|
ddb60b |
+ char *fips_md5_override = getenv("RADIUS_MD5_FIPS_OVERRIDE");
|
|
|
ddb60b |
+ FILE *fips_file = fopen("/proc/sys/crypto/fips_enabled", "r");
|
|
|
ddb60b |
+ if (fips_file != NULL) {
|
|
|
ddb60b |
+ int fips_enabled = fgetc(fips_file) - '0';
|
|
|
ddb60b |
+ fclose(fips_file);
|
|
|
ddb60b |
+ if (fips_enabled == 1 && (fips_md5_override == NULL || atoi(fips_md5_override) != 1)) {
|
|
|
ddb60b |
+ fprintf(stderr, "Cannot run FreeRADIUS in FIPS mode because it uses MD5. To allow MD5 usage, set RADIUS_MD5_FIPS_OVERRIDE=1 before starting FreeRADIUS.\n");
|
|
|
ddb60b |
+ exit(EXIT_FAILURE);
|
|
|
ddb60b |
+ }
|
|
|
ddb60b |
+ }
|
|
|
ddb60b |
+
|
|
|
ddb60b |
/*
|
|
|
ddb60b |
* According to the talloc peeps, no two threads may modify any part of
|
|
|
ddb60b |
* a ctx tree with a common root without synchronisation.
|