mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-11-02 20:30:26 -06:00
Move fips_enabled to a common library to share across different plugins
Related: https://pagure.io/freeipa/issue/7659 Reviewed-By: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
1 parent
c2e1cdf8a3
commit
de8f969f2d
3 files changed
+28
-23
No files matched your search
@@ -46,7 +46,6 @@
|
||||
/* Type of connection for this operation;*/
|
||||
#define LDAP_EXTOP_PASSMOD_CONN_SECURE
|
||||
|
||||
#define PROC_SYS_FIPS "/proc/sys/crypto/fips_enabled"
|
||||
|
||||
/* Uncomment the following #undef FOR TESTING:
|
||||
* allows non-SSL connections to use the password change extended op */
|
||||
@@ -64,27 +63,6 @@ static const char *ipapwd_def_encsalts[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static bool fips_enabled(void)
|
||||
{
|
||||
int fd;
|
||||
ssize_t len;
|
||||
char buf[8];
|
||||
|
||||
fd = open(PROC_SYS_FIPS, O_RDONLY);
|
||||
if (fd != -1) {
|
||||
len = read(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
/* Assume FIPS in enabled if PROC_SYS_FIPS contains a non-0 value
|
||||
* similar to the is_fips_enabled() check in
|
||||
* ipaplatform/redhat/tasks.py */
|
||||
if (!(len == 2 && buf[0] == '0' && buf[1] == '\n')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static struct ipapwd_krbcfg *ipapwd_getConfig(void)
|
||||
{
|
||||
krb5_error_code krberr;
|
||||
@@ -255,7 +233,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void)
|
||||
|
||||
/* get the ipa etc/ipaConfig entry */
|
||||
config->allow_nt_hash = false;
|
||||
if (fips_enabled()) {
|
||||
if (ipapwd_fips_enabled()) {
|
||||
LOG("FIPS mode is enabled, NT hashes are not allowed.\n");
|
||||
} else {
|
||||
ret = ipapwd_getEntry(ipa_etc_config_dn, &config_entry, NULL);
|
||||
|
||||
Reference in new issue
Block a user