pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
99b6f7
From 62b7d72f65ab8ac90a62486bb170133755764bc7 Mon Sep 17 00:00:00 2001
99b6f7
From: Martin Kosek <mkosek@redhat.com>
99b6f7
Date: Wed, 22 May 2013 09:40:39 +0200
99b6f7
Subject: [PATCH 1002/1006] 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 ---
99b6f7
 ipalib/plugins/pkinit.py | 101 -----------------------------------------------
99b6f7
 2 files changed, 106 deletions(-)
99b6f7
 delete mode 100644 ipalib/plugins/pkinit.py
99b6f7
99b6f7
diff --git a/API.txt b/API.txt
99b6f7
index 5418f31dc8d936ee629155aff08c05577cf9c4ee..ec5b3c9f6459e048c516a64dbab2396306fa6a72 100644
99b6f7
--- a/API.txt
99b6f7
+++ b/API.txt
99b6f7
@@ -2336,11 +2336,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
99b6f7
index 981e411df520e175fa88f1de02a4eae36d687ede..0000000000000000000000000000000000000000
99b6f7
--- a/ipalib/plugins/pkinit.py
99b6f7
+++ /dev/null
99b6f7
@@ -1,101 +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 _
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
-
99b6f7
-class pkinit(Object):
99b6f7
-    """
99b6f7
-    PKINIT Options
99b6f7
-    """
99b6f7
-    object_name = _('pkinit')
99b6f7
-
99b6f7
-    label=_('PKINIT')
99b6f7
-
99b6f7
-api.register(pkinit)
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
-
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
-
99b6f7
-        (dn, 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:
99b6f7
-            ldap.update_entry(dn, {'nsaccountlock':lock})
99b6f7
-
99b6f7
-        return dict(result=True)
99b6f7
-
99b6f7
-api.register(pkinit_anonymous)
99b6f7
-- 
99b6f7
1.8.3.1
99b6f7