URL: https://github.com/freeipa/freeipa/pull/1252
Author: stlaz
 Title: #1252: [Backport][ipa-4-6] Don't allow OTP or RADIUS in FIPS mode
Action: opened

PR body:
"""
This PR was opened automatically because PR #1244 was pushed to master and 
backport to ipa-4-6 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1252/head:pr1252
git checkout pr1252
From 536812bbdb8e2589861a076c4ba9cddd6468a5b1 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 7 Nov 2017 14:42:12 +0100
Subject: [PATCH] Don't allow OTP or RADIUS in FIPS mode

RADIUS, which is also internally used in the process of OTP
authentication by ipa-otpd, requires MD5 checksums which
makes it impossible to be used in FIPS mode. Don't allow users
setting OTP or RADIUS authentication if in FIPS mode.

https://pagure.io/freeipa/issue/7168
---
 ipaserver/plugins/baseuser.py |  3 +++
 ipaserver/plugins/config.py   | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/ipaserver/plugins/baseuser.py b/ipaserver/plugins/baseuser.py
index ef5585822f..ea4cd90996 100644
--- a/ipaserver/plugins/baseuser.py
+++ b/ipaserver/plugins/baseuser.py
@@ -31,6 +31,7 @@
     LDAPAddAttributeViaOption, LDAPRemoveAttributeViaOption,
     add_missing_object_class)
 from ipaserver.plugins.service import (validate_realm, normalize_principal)
+from ipaserver.plugins.config import check_fips_auth_opts
 from ipalib.request import context
 from ipalib import _
 from ipalib.constants import PATTERN_GROUPUSER_NAME
@@ -480,6 +481,7 @@ def pre_common_callback(self, ldap, dn, entry_attrs, attrs_list, *keys,
                             **options):
         assert isinstance(dn, DN)
         set_krbcanonicalname(entry_attrs)
+        check_fips_auth_opts(fips_mode=self.api.env.fips_mode, **options)
         self.obj.convert_usercertificate_pre(entry_attrs)
 
     def post_common_callback(self, ldap, dn, entry_attrs, *keys, **options):
@@ -603,6 +605,7 @@ def pre_common_callback(self, ldap, dn, entry_attrs, attrs_list, *keys,
         assert isinstance(dn, DN)
         add_sshpubkey_to_attrs_pre(self.context, attrs_list)
 
+        check_fips_auth_opts(fips_mode=self.api.env.fips_mode, **options)
         self.check_namelength(ldap, **options)
 
         self.check_mail(entry_attrs)
diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
index ce15e6096f..c9033fa8e7 100644
--- a/ipaserver/plugins/config.py
+++ b/ipaserver/plugins/config.py
@@ -85,6 +85,20 @@
 
 register = Registry()
 
+
+def check_fips_auth_opts(fips_mode, **options):
+    """
+    OTP and RADIUS are not allowed in FIPS mode since they use MD5
+    checksums (OTP uses our RADIUS responder daemon ipa-otpd).
+    """
+    if 'ipauserauthtype' in options and fips_mode:
+        if ('otp' in options['ipauserauthtype'] or
+                'radius' in options['ipauserauthtype']):
+            raise errors.InvocationError(
+                'OTP and RADIUS authentication in FIPS is '
+                'not yet supported')
+
+
 @register()
 class config(LDAPObject):
     """
@@ -398,6 +412,8 @@ class config_mod(LDAPUpdate):
 
     def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
         assert isinstance(dn, DN)
+        check_fips_auth_opts(fips_mode=self.api.env.fips_mode, **options)
+
         if 'ipadefaultprimarygroup' in entry_attrs:
             group=entry_attrs['ipadefaultprimarygroup']
             try:
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to