590d18
From 414c1303d60e6e7ca46b29e0e2e066bca03c9e0b Mon Sep 17 00:00:00 2001
99b6f7
From: Martin Kosek <mkosek@redhat.com>
e3ffab
Date: Fri, 5 Sep 2014 11:26:18 +0200
e3ffab
Subject: [PATCH] Remove pkinit plugin
99b6f7
99b6f7
This patch completely removes any signs of pkinit in the IPA package. It
99b6f7
should be used only as addition to the first patch attached to the
99b6f7
ticket.
99b6f7
99b6f7
Rebased patch by Jan Zeleny and Rob Crittenden.
99b6f7
99b6f7
https://fedorahosted.org/freeipa/ticket/616
99b6f7
---
99b6f7
 API.txt                  |   5 ---
e3ffab
 ipalib/plugins/pkinit.py | 105 -----------------------------------------------
e3ffab
 2 files changed, 110 deletions(-)
99b6f7
 delete mode 100644 ipalib/plugins/pkinit.py
99b6f7
99b6f7
diff --git a/API.txt b/API.txt
590d18
index 5253e1585e000f39d6e185a94548037dfe54d4d8..0b626cb0db44ec9adfb688bd5afddb4b17d950d6 100644
99b6f7
--- a/API.txt
99b6f7
+++ b/API.txt
590d18
@@ -3199,11 +3199,6 @@ command: ping
99b6f7
 args: 0,1,1
99b6f7
 option: Str('version?', exclude='webui')
99b6f7
 output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
99b6f7
-command: pkinit_anonymous
99b6f7
-args: 1,1,1
99b6f7
-arg: Str('action')
99b6f7
-option: Str('version?', exclude='webui')
99b6f7
-output: Output('result', None, None)
99b6f7
 command: plugins
99b6f7
 args: 0,3,3
99b6f7
 option: Flag('all', autofill=True, cli_name='all', default=True, exclude='webui')
99b6f7
diff --git a/ipalib/plugins/pkinit.py b/ipalib/plugins/pkinit.py
99b6f7
deleted file mode 100644
e3ffab
index 5f00b2b46ff94cca7f98876c0171f455c210d778..0000000000000000000000000000000000000000
99b6f7
--- a/ipalib/plugins/pkinit.py
99b6f7
+++ /dev/null
e3ffab
@@ -1,105 +0,0 @@
99b6f7
-# Authors:
99b6f7
-#   Simo Sorce <ssorce@redhat.com>
99b6f7
-#
99b6f7
-# Copyright (C) 2010  Red Hat
99b6f7
-# see file 'COPYING' for use and warranty information
99b6f7
-#
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/>.
99b6f7
-
99b6f7
-from ipalib import api, errors
99b6f7
-from ipalib import Int, Str
99b6f7
-from ipalib import Object, Command
99b6f7
-from ipalib import _
e3ffab
-from ipalib.plugable import Registry
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
-""")
99b6f7
-
e3ffab
-register = Registry()
e3ffab
-
e3ffab
-@register()
99b6f7
-class pkinit(Object):
99b6f7
-    """
99b6f7
-    PKINIT Options
99b6f7
-    """
99b6f7
-    object_name = _('pkinit')
99b6f7
-
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
-
99b6f7
-    princ_name = 'WELLKNOWN/ANONYMOUS@%s' % 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)
99b6f7
-
99b6f7
-- 
590d18
2.5.1
99b6f7