mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
merge
This commit is contained in:
@@ -12,6 +12,7 @@ install:
|
||||
install -m 755 ipa-finduser $(SBINDIR)
|
||||
install -m 755 ipa-usermod $(SBINDIR)
|
||||
install -m 755 ipa-deluser $(SBINDIR)
|
||||
install -m 755 ipa-lockuser $(SBINDIR)
|
||||
install -m 755 ipa-addgroup $(SBINDIR)
|
||||
install -m 755 ipa-delgroup $(SBINDIR)
|
||||
install -m 755 ipa-findgroup $(SBINDIR)
|
||||
|
||||
@@ -228,7 +228,7 @@ def main():
|
||||
# Set the User's password
|
||||
if password is not None:
|
||||
try:
|
||||
client.modifyPassword(principal, None, password)
|
||||
client.modifyPassword(principal, '', password)
|
||||
except ipa.ipaerror.IPAError, e:
|
||||
print "User added but setting the password failed."
|
||||
print "%s" % (e.message)
|
||||
|
||||
@@ -50,7 +50,19 @@ def main():
|
||||
|
||||
try:
|
||||
client = ipaclient.IPAClient()
|
||||
ret = client.delete_group(args[1])
|
||||
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
||||
|
||||
counter = groups[0]
|
||||
groups = groups[1:]
|
||||
|
||||
if counter == 0:
|
||||
print "Group '%s' not found." % args[1]
|
||||
return 2
|
||||
if counter != 1:
|
||||
print "An exact group match was not found. Found %d groups" % counter
|
||||
return 2
|
||||
|
||||
ret = client.delete_group(groups[0].dn)
|
||||
if (ret == "Success"):
|
||||
print args[1] + " successfully deleted"
|
||||
else:
|
||||
|
||||
@@ -34,8 +34,6 @@ def usage():
|
||||
|
||||
def parse_options():
|
||||
parser = OptionParser()
|
||||
parser.add_option("-d", "--delete", action="store_true", dest="deluser",
|
||||
help="Delete the user, don't inactivate them.")
|
||||
parser.add_option("--usage", action="store_true",
|
||||
help="Program usage")
|
||||
|
||||
@@ -50,21 +48,10 @@ def main():
|
||||
if len(args) != 2:
|
||||
usage()
|
||||
|
||||
msg = "inactivated"
|
||||
try:
|
||||
client = ipaclient.IPAClient()
|
||||
if options.deluser:
|
||||
ret = client.delete_user(args[1])
|
||||
msg = "deleted"
|
||||
else:
|
||||
try:
|
||||
ret = client.mark_user_inactive(args[1])
|
||||
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_EMPTY_MODLIST):
|
||||
print "User is already marked inactive"
|
||||
return 0
|
||||
except:
|
||||
raise
|
||||
print args[1] + " successfully %s" % msg
|
||||
ret = client.delete_user(args[1])
|
||||
print args[1] + " successfully deleted"
|
||||
except xmlrpclib.Fault, fault:
|
||||
if fault.faultCode == errno.ECONNREFUSED:
|
||||
print "The IPA XML-RPC service is not responding."
|
||||
|
||||
93
ipa-admintools/ipa-lockuser
Normal file
93
ipa-admintools/ipa-lockuser
Normal file
@@ -0,0 +1,93 @@
|
||||
#! /usr/bin/python -E
|
||||
# Authors: Rob Crittenden <rcritten@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2007 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; version 2 only
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
import ipa
|
||||
import ipa.ipaclient as ipaclient
|
||||
import ipa.config
|
||||
import errno
|
||||
|
||||
import xmlrpclib
|
||||
import kerberos
|
||||
|
||||
def usage():
|
||||
print "ipa-lockuser user"
|
||||
sys.exit(1)
|
||||
|
||||
def parse_options():
|
||||
parser = OptionParser()
|
||||
parser.add_option("-u", "--unlock", action="store_true", dest="unlock",
|
||||
help="Unlock a user's account")
|
||||
parser.add_option("--usage", action="store_true",
|
||||
help="Program usage")
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
return options, args
|
||||
|
||||
def main():
|
||||
options, args = parse_options()
|
||||
|
||||
if len(args) != 2:
|
||||
usage()
|
||||
|
||||
msg = "inactivated"
|
||||
try:
|
||||
client = ipaclient.IPAClient()
|
||||
if options.unlock:
|
||||
try:
|
||||
ret = client.mark_user_active(args[1])
|
||||
msg = "unlocked"
|
||||
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_EMPTY_MODLIST):
|
||||
print "User is already marked active"
|
||||
return 0
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
try:
|
||||
ret = client.mark_user_inactive(args[1])
|
||||
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_EMPTY_MODLIST):
|
||||
print "User is already marked inactive"
|
||||
return 0
|
||||
except:
|
||||
raise
|
||||
print args[1] + " successfully %s" % msg
|
||||
except xmlrpclib.Fault, fault:
|
||||
if fault.faultCode == errno.ECONNREFUSED:
|
||||
print "The IPA XML-RPC service is not responding."
|
||||
else:
|
||||
print fault.faultString
|
||||
return 1
|
||||
except kerberos.GSSError, e:
|
||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
||||
return 1
|
||||
except xmlrpclib.ProtocolError, e:
|
||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||
return 1
|
||||
except ipa.ipaerror.IPAError, e:
|
||||
print "%s" % (e.message)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -98,7 +98,7 @@ def main():
|
||||
|
||||
try:
|
||||
client = ipaclient.IPAClient()
|
||||
client.modifyPassword(principal, None, password)
|
||||
client.modifyPassword(principal, '', password)
|
||||
except xmlrpclib.Fault, fault:
|
||||
if fault.faultCode == errno.ECONNREFUSED:
|
||||
print "The IPA XML-RPC service is not responding."
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
MANDIR = $(DESTDIR)/usr/share/man
|
||||
|
||||
MANFILES=\
|
||||
ipa-adddelegation.1 \
|
||||
ipa-addgroup.1 \
|
||||
ipa-adduser.1 \
|
||||
ipa-deldelegation.1 \
|
||||
ipa-delgroup.1 \
|
||||
ipa-deluser.1 \
|
||||
ipa-findgroup.1 \
|
||||
ipa-finduser.1 \
|
||||
ipa-groupmod.1 \
|
||||
ipa-listdelegation.1 \
|
||||
ipa-lockuser.1 \
|
||||
ipa-moddelegation.1 \
|
||||
ipa-passwd.1 \
|
||||
ipa-usermod.1
|
||||
|
||||
|
||||
@@ -19,20 +19,14 @@
|
||||
.\"
|
||||
.TH "ipa-deluser" "1" "Oct 10 2007" "freeipa" ""
|
||||
.SH "NAME"
|
||||
ipa\-deluser \- Delete or inactivate a user
|
||||
ipa\-deluser \- Delete a user
|
||||
|
||||
.SH "SYNOPSIS"
|
||||
ipa\-deluser [\fIOPTION\fR]... \fIuser\fR
|
||||
ipa\-deluser \fIuser\fR
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
Inactivates a user with login name \fIname\fR.
|
||||
Deletes a user with login name \fIname\fR.
|
||||
|
||||
By default users are not completely removed. They are marked as inactive. Use the [\-d|\-\-delete] option to completely remove them.
|
||||
|
||||
Users are automatically removed from groups when they are deleted. The are not when inactivated.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-delete
|
||||
Completely remove the user from the database. The default is to mark the user inactive.
|
||||
Users are automatically removed from groups when they are deleted.
|
||||
.SH "EXIT STATUS"
|
||||
The exit status is 0 on success, nonzero on error.
|
||||
|
||||
36
ipa-admintools/man/ipa-lockuser.1
Normal file
36
ipa-admintools/man/ipa-lockuser.1
Normal file
@@ -0,0 +1,36 @@
|
||||
.\" A man page for ipa-lockuser
|
||||
.\" Copyright (C) 2007 Red Hat, Inc.
|
||||
.\"
|
||||
.\" This is free software; you can redistribute it and/or modify it under
|
||||
.\" the terms of the GNU Library General Public License as published by
|
||||
.\" the Free Software Foundation; either version 2 of the License, or
|
||||
.\" (at your option) any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful, but
|
||||
.\" WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
.\" General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU Library General Public
|
||||
.\" License along with this program; if not, write to the Free Software
|
||||
.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
.\"
|
||||
.\" Author: Rob Crittenden <rcritten@redhat.com>
|
||||
.\"
|
||||
.TH "ipa-lockuser" "1" "Oct 10 2007" "freeipa" ""
|
||||
.SH "NAME"
|
||||
ipa\-lockuser \- Lock or unlock a user account
|
||||
|
||||
.SH "SYNOPSIS"
|
||||
ipa\-lockuser [\fIOPTION\fR]... \fIuser\fR
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
Locks a user account with login name \fIname\fR.
|
||||
|
||||
Users are not removed from groups when their account is locked.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
\fB\-u\fR, \fB\-\-unlock
|
||||
Unlock a user's account
|
||||
.SH "EXIT STATUS"
|
||||
The exit status is 0 on success, nonzero on error.
|
||||
Reference in New Issue
Block a user