ac7d03
From 2eb94f86872ee7ea191dc3e44fcb3d5a4683ae67 Mon Sep 17 00:00:00 2001
ac7d03
From: Stanislav Laznicka <slaznick@redhat.com>
ac7d03
Date: Wed, 10 May 2017 15:54:21 +0200
ac7d03
Subject: [PATCH] Remove pkinit-anonymous command
99b6f7
ac7d03
Ever since from v4.5, FreeIPA expects at least some kind of
ac7d03
anonymous PKINIT to work. The pkinit-anonymous command was supposed
ac7d03
to enable/disable anonymous pkinit by locking/unlocking the
ac7d03
anonymous principal. We can't allow this for FreeIPA to work
ac7d03
so we are removing the command as it was never supported anyway.
99b6f7
ac7d03
https://pagure.io/freeipa/issue/6936
99b6f7
ac7d03
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
99b6f7
---
ac7d03
 API.txt                     |  6 ---
ac7d03
 VERSION.m4                  |  4 +-
ac7d03
 ipaserver/plugins/pkinit.py | 94 ++-------------------------------------------
ac7d03
 3 files changed, 6 insertions(+), 98 deletions(-)
99b6f7
99b6f7
diff --git a/API.txt b/API.txt
ac7d03
index 7594157384511c1317738dafb41361676a2a0fd7..4e6754afe2deab5c963577f1e1363f1123a31a86 100644
99b6f7
--- a/API.txt
99b6f7
+++ b/API.txt
ac7d03
@@ -3736,11 +3736,6 @@ command: ping/1
99b6f7
 args: 0,1,1
403b09
 option: Str('version?')
403b09
 output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
403b09
-command: pkinit_anonymous/1
99b6f7
-args: 1,1,1
99b6f7
-arg: Str('action')
403b09
-option: Str('version?')
403b09
-output: Output('result')
403b09
 command: plugins/1
99b6f7
 args: 0,3,3
403b09
 option: Flag('all', autofill=True, cli_name='all', default=True)
ac7d03
@@ -6803,7 +6798,6 @@ default: permission_remove_member/1
403b09
 default: permission_show/1
403b09
 default: ping/1
ac7d03
 default: pkinit/1
403b09
-default: pkinit_anonymous/1
403b09
 default: plugins/1
403b09
 default: privilege/1
403b09
 default: privilege_add/1
ac7d03
diff --git a/VERSION.m4 b/VERSION.m4
ac7d03
index 31e7c1d6e7054d3b4ef1d9dfaf349d2959f8330a..e10ee3cad6f5a6e023ea3cb9ec20591b7caae0bd 100644
ac7d03
--- a/VERSION.m4
ac7d03
+++ b/VERSION.m4
ac7d03
@@ -73,8 +73,8 @@ define(IPA_DATA_VERSION, 20100614120000)
ac7d03
 #                                                      #
ac7d03
 ########################################################
ac7d03
 define(IPA_API_VERSION_MAJOR, 2)
ac7d03
-define(IPA_API_VERSION_MINOR, 224)
ac7d03
-# Last change: Add rename option to sudorule objects
ac7d03
+define(IPA_API_VERSION_MINOR, 226)
ac7d03
+# Last change: Remove the pkinit-anonymous command
ac7d03
 
ac7d03
 
ac7d03
 ########################################################
403b09
diff --git a/ipaserver/plugins/pkinit.py b/ipaserver/plugins/pkinit.py
ac7d03
index b6b3f38828e86e6e677fadc9c4a638b2eee5171f..e49b31091d676865fa7f023be8edc3cdef9d6d2c 100644
403b09
--- a/ipaserver/plugins/pkinit.py
ac7d03
+++ b/ipaserver/plugins/pkinit.py
ac7d03
@@ -1,52 +1,14 @@
99b6f7
-# Authors:
99b6f7
-#   Simo Sorce <ssorce@redhat.com>
ac7d03
 #
99b6f7
-# Copyright (C) 2010  Red Hat
99b6f7
-# see file 'COPYING' for use and warranty information
ac7d03
+# Copyright (C) 2017  FreeIPA Contributors see COPYING for license
ac7d03
 #
99b6f7
-# This program is free software; you can redistribute it and/or modify
99b6f7
-# it under the terms of the GNU General Public License as published by
99b6f7
-# the Free Software Foundation, either version 3 of the License, or
99b6f7
-# (at your option) any later version.
99b6f7
-#
99b6f7
-# This program is distributed in the hope that it will be useful,
99b6f7
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
99b6f7
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99b6f7
-# GNU General Public License for more details.
99b6f7
-#
99b6f7
-# You should have received a copy of the GNU General Public License
99b6f7
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
ac7d03
 
99b6f7
-from ipalib import api, errors
403b09
-from ipalib import Str
99b6f7
-from ipalib import Object, Command
ac7d03
+from ipalib import Object
ac7d03
 from ipalib import _
ac7d03
 from ipalib.plugable import Registry
ac7d03
-from ipalib.constants import ANON_USER
99b6f7
-from ipapython.dn import DN
99b6f7
-
99b6f7
-__doc__ = _("""
99b6f7
-Kerberos pkinit options
99b6f7
-
99b6f7
-Enable or disable anonymous pkinit using the principal
99b6f7
-WELLKNOWN/ANONYMOUS@REALM. The server must have been installed with
99b6f7
-pkinit support.
99b6f7
-
99b6f7
-EXAMPLES:
99b6f7
-
99b6f7
- Enable anonymous pkinit:
99b6f7
-  ipa pkinit-anonymous enable
99b6f7
-
99b6f7
- Disable anonymous pkinit:
99b6f7
-  ipa pkinit-anonymous disable
99b6f7
-
99b6f7
-For more information on anonymous pkinit see:
99b6f7
-
99b6f7
-http://k5wiki.kerberos.org/wiki/Projects/Anonymous_pkinit
99b6f7
-""")
ac7d03
 
ac7d03
 register = Registry()
ac7d03
 
ac7d03
+
ac7d03
 @register()
ac7d03
 class pkinit(Object):
ac7d03
     """
ac7d03
@@ -54,52 +16,4 @@ class pkinit(Object):
ac7d03
     """
ac7d03
     object_name = _('pkinit')
ac7d03
 
99b6f7
-    label=_('PKINIT')
99b6f7
-
99b6f7
-
99b6f7
-def valid_arg(ugettext, action):
99b6f7
-    """
99b6f7
-    Accepts only Enable/Disable.
99b6f7
-    """
99b6f7
-    a = action.lower()
99b6f7
-    if a != 'enable' and a != 'disable':
99b6f7
-        raise errors.ValidationError(
99b6f7
-            name='action',
99b6f7
-            error=_('Unknown command %s') % action
99b6f7
-        )
99b6f7
-
e3ffab
-@register()
99b6f7
-class pkinit_anonymous(Command):
99b6f7
-    __doc__ = _('Enable or Disable Anonymous PKINIT.')
99b6f7
-
ac7d03
-    princ_name = '%s@%s' % (ANON_USER, api.env.realm)
99b6f7
-    default_dn = DN(('krbprincipalname', princ_name), ('cn', api.env.realm), ('cn', 'kerberos'), api.env.basedn)
99b6f7
-
99b6f7
-    takes_args = (
99b6f7
-        Str('action', valid_arg),
99b6f7
-    )
99b6f7
-
99b6f7
-    def execute(self, action, **options):
99b6f7
-        ldap = self.api.Backend.ldap2
99b6f7
-        set_lock = False
99b6f7
-        lock = None
99b6f7
-
e3ffab
-        entry_attrs = ldap.get_entry(self.default_dn, ['nsaccountlock'])
99b6f7
-
99b6f7
-        if 'nsaccountlock' in entry_attrs:
99b6f7
-            lock = entry_attrs['nsaccountlock'][0].lower()
99b6f7
-
99b6f7
-        if action.lower() == 'enable':
99b6f7
-            if lock == 'true':
99b6f7
-                set_lock = True
99b6f7
-                lock = None
99b6f7
-        elif action.lower() == 'disable':
99b6f7
-            if lock != 'true':
99b6f7
-                set_lock = True
99b6f7
-                lock = 'TRUE'
99b6f7
-
99b6f7
-        if set_lock:
e3ffab
-            entry_attrs['nsaccountlock'] = lock
e3ffab
-            ldap.update_entry(entry_attrs)
99b6f7
-
99b6f7
-        return dict(result=True)
ac7d03
+    label = _('PKINIT')
99b6f7
-- 
ac7d03
2.9.4
99b6f7