mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
- Centralize try/except so the entire program is covered. This make it
possible to catch KeyboardInterrupt during the import process. - Add function for handling python differences with GSSError 434798
This commit is contained in:
parent
d5f5026454
commit
ad8096b51f
@ -18,21 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
import ipa.aci
|
|
||||||
import ipa.ipaadminutil as ipaadminutil
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-adddelegation [-l|--list]"
|
print "ipa-adddelegation [-l|--list]"
|
||||||
print "ipa-adddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
|
print "ipa-adddelegation [-a|--attributes attr1,attr2,..,attrn] [-s|--source STRING] [-t|--target STRING] name"
|
||||||
@ -65,9 +50,9 @@ def main():
|
|||||||
|
|
||||||
if options.list:
|
if options.list:
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
list = client.get_all_attrs()
|
l = client.get_all_attrs()
|
||||||
|
|
||||||
for x in list:
|
for x in l:
|
||||||
print x
|
print x
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@ -78,7 +63,6 @@ def main():
|
|||||||
if not options.attributes or not options.source or not options.target:
|
if not options.attributes or not options.source or not options.target:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
|
|
||||||
source_grp = client.find_groups(options.source)
|
source_grp = client.find_groups(options.source)
|
||||||
@ -154,24 +138,45 @@ def main():
|
|||||||
aci_entry.setValue('aci', new_aci.export_to_string())
|
aci_entry.setValue('aci', new_aci.export_to_string())
|
||||||
|
|
||||||
client.update_entry(aci_entry)
|
client.update_entry(aci_entry)
|
||||||
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
|
|
||||||
|
|
||||||
print "Delegation %s successfully added" % args[1]
|
print "Delegation %s successfully added" % args[1]
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.user
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.aci
|
||||||
|
import ipa.ipaadminutil as ipaadminutil
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,20 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.group
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipavalidate as ipavalidate
|
|
||||||
import ipa.config
|
|
||||||
import ipa.ipaerror
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import ldap
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-addgroup [-d|--description STRING] [-g|--gid GID] group"
|
print "ipa-addgroup [-d|--description STRING] [-g|--gid GID] group"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -95,27 +81,46 @@ def main():
|
|||||||
group.setValue('cn', cn)
|
group.setValue('cn', cn)
|
||||||
group.setValue('description', desc)
|
group.setValue('description', desc)
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
client.add_group(group)
|
client.add_group(group)
|
||||||
print cn + " successfully added"
|
print cn + " successfully added"
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.group
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipavalidate as ipavalidate
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipaerror
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import ldap
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,23 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipavalidate as ipavalidate
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import getpass
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-addservice [--force] principal"
|
print "ipa-addservice [--force] principal"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -64,12 +47,47 @@ def main():
|
|||||||
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
|
|
||||||
try:
|
|
||||||
client.add_service_principal(princ_name, "%d" % options.force)
|
client.add_service_principal(princ_name, "%d" % options.force)
|
||||||
|
|
||||||
except Exception, e:
|
return 0
|
||||||
print str(e)
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.user
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipavalidate as ipavalidate
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
if __name__ == "__main__":
|
import base64
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import getpass
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,21 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipavalidate as ipavalidate
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import getpass
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell] [-g|--groups] [-k|krb-principal [-M|mailAddress] user"
|
print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell] [-g|--groups] [-k|krb-principal [-M|mailAddress] user"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -209,24 +194,8 @@ def main():
|
|||||||
if shell:
|
if shell:
|
||||||
user.setValue('loginshell', shell)
|
user.setValue('loginshell', shell)
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
client.add_user(user)
|
client.add_user(user)
|
||||||
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
|
|
||||||
|
|
||||||
# Set the User's password
|
# Set the User's password
|
||||||
if password is not None:
|
if password is not None:
|
||||||
@ -251,5 +220,41 @@ def main():
|
|||||||
print username + " successfully added"
|
print username + " successfully added"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.user
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipavalidate as ipavalidate
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import getpass
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import copy
|
|
||||||
import errno
|
|
||||||
|
|
||||||
import ipa.aci
|
|
||||||
from ipa import ipaerror
|
|
||||||
|
|
||||||
aci_fields = ['*', 'aci']
|
aci_fields = ['*', 'aci']
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
@ -55,7 +42,6 @@ def main():
|
|||||||
usage()
|
usage()
|
||||||
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
try:
|
|
||||||
aci_entry = client.get_aci_entry(aci_fields)
|
aci_entry = client.get_aci_entry(aci_fields)
|
||||||
|
|
||||||
aci_str_list = aci_entry.getValues('aci')
|
aci_str_list = aci_entry.getValues('aci')
|
||||||
@ -87,26 +73,45 @@ def main():
|
|||||||
|
|
||||||
client.update_entry(aci_entry)
|
client.update_entry(aci_entry)
|
||||||
print "Delegation removed."
|
print "Delegation removed."
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import copy
|
||||||
|
import errno
|
||||||
|
|
||||||
|
import ipa.aci
|
||||||
|
from ipa import ipaerror
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except (SyntaxError, ipaerror.IPAError), e:
|
except (SyntaxError, ipaerror.IPAError), e:
|
||||||
print "Delegation deletion failed: " + str(e)
|
print "Delegation deletion failed: " + str(e)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,16 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 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():
|
def usage():
|
||||||
print "ipa-delgroup group"
|
print "ipa-delgroup group"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -48,7 +38,6 @@ def main():
|
|||||||
if options.usage or len(args) != 2:
|
if options.usage or len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
||||||
|
|
||||||
@ -67,23 +56,39 @@ def main():
|
|||||||
print args[1] + " successfully deleted"
|
print args[1] + " successfully deleted"
|
||||||
else:
|
else:
|
||||||
print args[1] + " " + ret
|
print args[1] + " " + ret
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import errno
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,23 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipavalidate as ipavalidate
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import getpass
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-delservice principal"
|
print "ipa-delservice principal"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -59,7 +42,6 @@ def main():
|
|||||||
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
|
|
||||||
try:
|
|
||||||
hosts = client.find_service_principal(args[1], sattrs=None)
|
hosts = client.find_service_principal(args[1], sattrs=None)
|
||||||
counter = hosts[0]
|
counter = hosts[0]
|
||||||
hosts = hosts[1:]
|
hosts = hosts[1:]
|
||||||
@ -73,12 +55,42 @@ def main():
|
|||||||
|
|
||||||
client.delete_service_principal(hosts[0].dn)
|
client.delete_service_principal(hosts[0].dn)
|
||||||
|
|
||||||
except Exception, e:
|
print "Successfully deleted"
|
||||||
print str(e)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
print hosts[0] + " successfully deleted"
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,16 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 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():
|
def usage():
|
||||||
print "ipa-deluser user"
|
print "ipa-deluser user"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -48,27 +38,42 @@ def main():
|
|||||||
if options.usage or len(args) != 2:
|
if options.usage or len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
ret = client.delete_user(args[1])
|
ret = client.delete_user(args[1])
|
||||||
print args[1] + " successfully deleted"
|
print args[1] + " successfully deleted"
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
import errno
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,17 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipaadminutil as ipaadminutil
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import errno
|
|
||||||
import sys
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-findgroup [-a|--all] [-n|--notranslate] group"
|
print "ipa-findgroup [-a|--all] [-n|--notranslate] group"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
@ -56,7 +45,6 @@ def main():
|
|||||||
if options.usage or len(args) != 2:
|
if options.usage or len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
if options.all is None:
|
if options.all is None:
|
||||||
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
groups = client.find_groups(args[1], ['cn','description','gidnumber','nsAccountLock'])
|
||||||
@ -120,23 +108,39 @@ def main():
|
|||||||
# blank line between results
|
# blank line between results
|
||||||
print
|
print
|
||||||
|
|
||||||
except xmlrpclib.Fault, fault:
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipaadminutil as ipaadminutil
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import sys
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
import ipa.ipautil as ipautil
|
|
||||||
import ipa.ipaadminutil as ipaadminutil
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import errno
|
|
||||||
import sys
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-findservice host"
|
print "ipa-findservice host"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
@ -53,7 +40,6 @@ def main():
|
|||||||
if options.usage or len(args) != 2:
|
if options.usage or len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
hosts = client.find_service_principal(args[1], sattrs=None)
|
hosts = client.find_service_principal(args[1], sattrs=None)
|
||||||
|
|
||||||
@ -67,27 +53,42 @@ def main():
|
|||||||
print "These results are truncated."
|
print "These results are truncated."
|
||||||
print "Please refine your search and try again."
|
print "Please refine your search and try again."
|
||||||
|
|
||||||
|
|
||||||
for ent in hosts:
|
for ent in hosts:
|
||||||
print ent.krbprincipalname
|
print ent.krbprincipalname
|
||||||
|
|
||||||
except xmlrpclib.Fault, fault:
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.ipaadminutil as ipaadminutil
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import sys
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
import ipa.ipautil as ipautil
|
|
||||||
import ipa.ipaadminutil as ipaadminutil
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import errno
|
|
||||||
import sys
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-finduser [-a|--all] [-n|--notranslate] user"
|
print "ipa-finduser [-a|--all] [-n|--notranslate] user"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
@ -79,7 +66,6 @@ def main():
|
|||||||
if options.usage or len(args) != 2:
|
if options.usage or len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
if options.all is None:
|
if options.all is None:
|
||||||
users = client.find_users(args[1], sattrs=['uid','cn','homeDirectory','loginshell'])
|
users = client.find_users(args[1], sattrs=['uid','cn','homeDirectory','loginshell'])
|
||||||
@ -131,23 +117,40 @@ def main():
|
|||||||
# blank line between results
|
# blank line between results
|
||||||
print
|
print
|
||||||
|
|
||||||
except xmlrpclib.Fault, fault:
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.ipaadminutil as ipaadminutil
|
||||||
|
import base64
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import sys
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import operator
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import errno
|
|
||||||
|
|
||||||
import ipa.aci
|
|
||||||
from ipa import ipaerror
|
|
||||||
|
|
||||||
aci_fields = ['*', 'aci']
|
aci_fields = ['*', 'aci']
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-listdelgation"
|
print "ipa-listdelgation"
|
||||||
@ -54,23 +41,7 @@ def main():
|
|||||||
usage()
|
usage()
|
||||||
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
try:
|
|
||||||
aci_entry = client.get_aci_entry(aci_fields)
|
aci_entry = client.get_aci_entry(aci_fields)
|
||||||
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 ipaerror.IPAError, e:
|
|
||||||
print("Delegation list failed: " + str(e))
|
|
||||||
return 1
|
|
||||||
|
|
||||||
aci_str_list = aci_entry.getValues('aci')
|
aci_str_list = aci_entry.getValues('aci')
|
||||||
if aci_str_list is None:
|
if aci_str_list is None:
|
||||||
@ -102,5 +73,39 @@ def main():
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
|
||||||
|
import operator
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import errno
|
||||||
|
|
||||||
|
import ipa.aci
|
||||||
|
from ipa import ipaerror
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipaerror.IPAError, e:
|
||||||
|
print("Delegation list failed: " + str(e))
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,16 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 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():
|
def usage():
|
||||||
print "ipa-lockuser [-u|--unlock] user"
|
print "ipa-lockuser [-u|--unlock] user"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -51,7 +41,6 @@ def main():
|
|||||||
usage()
|
usage()
|
||||||
|
|
||||||
msg = "inactivated"
|
msg = "inactivated"
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
if options.unlock:
|
if options.unlock:
|
||||||
try:
|
try:
|
||||||
@ -71,23 +60,39 @@ def main():
|
|||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
print args[1] + " successfully %s" % msg
|
print args[1] + " successfully %s" % msg
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import errno
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,22 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipaadminutil as ipaadminutil
|
|
||||||
import ipa.config
|
|
||||||
import ipa.aci
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import copy
|
|
||||||
import errno
|
|
||||||
|
|
||||||
aci_fields = ['*', 'aci']
|
aci_fields = ['*', 'aci']
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
@ -77,7 +61,6 @@ def main():
|
|||||||
if not options.attributes and not options.source and not options.target:
|
if not options.attributes and not options.source and not options.target:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
|
|
||||||
# first do some sanity checking
|
# first do some sanity checking
|
||||||
@ -178,24 +161,45 @@ def main():
|
|||||||
aci_entry.setValue('aci', new_aci_str_list)
|
aci_entry.setValue('aci', new_aci_str_list)
|
||||||
|
|
||||||
client.update_entry(aci_entry)
|
client.update_entry(aci_entry)
|
||||||
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
|
|
||||||
|
|
||||||
print "Delegation %s successfully updated" % args[1]
|
print "Delegation %s successfully updated" % args[1]
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipaadminutil as ipaadminutil
|
||||||
|
import ipa.config
|
||||||
|
import ipa.aci
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import copy
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.group
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
import ipa.ipaerror
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import ldap
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-modgroup [-l|--list]"
|
print "ipa-modgroup [-l|--list]"
|
||||||
print "ipa-modgroup [-a|--add] [-r|--remove] user group"
|
print "ipa-modgroup [-a|--add] [-r|--remove] user group"
|
||||||
@ -107,7 +94,6 @@ def main():
|
|||||||
elif ((options.desc or options.addattr or options.delattr or options.setattr) and (len(args) != 2)):
|
elif ((options.desc or options.addattr or options.delattr or options.setattr) and (len(args) != 2)):
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
if options.add:
|
if options.add:
|
||||||
group = get_group(client, options, args[2])
|
group = get_group(client, options, args[2])
|
||||||
@ -162,23 +148,41 @@ def main():
|
|||||||
|
|
||||||
client.update_group(group)
|
client.update_group(group)
|
||||||
print args[1] + " successfully updated"
|
print args[1] + " successfully updated"
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.group
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
import ipa.ipaerror
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import ldap
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (ipautil.get_gsserror(e))
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.user
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.ipavalidate as ipavalidate
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import ldap
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-moduser [--list]"
|
print "ipa-moduser [--list]"
|
||||||
print "ipa-moduser [-a|--activate] [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] user"
|
print "ipa-moduser [-a|--activate] [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] [-s|--shell STRING] [--addattr attribute=value] [--delattr attribute] [--setattr attribute=value] user"
|
||||||
@ -116,12 +103,8 @@ def main():
|
|||||||
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_NOT_FOUND):
|
except ipa.ipaerror.exception_for(ipa.ipaerror.LDAP_NOT_FOUND):
|
||||||
print "User %s not found" % username
|
print "User %s not found" % username
|
||||||
return 1
|
return 1
|
||||||
except ipa.ipaerror.IPAError, e:
|
except:
|
||||||
print "%s" % e.message
|
raise
|
||||||
return 1
|
|
||||||
except kerberos.GSSError, e:
|
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# If any options are set we use just those. Otherwise ask for all of them.
|
# If any options are set we use just those. Otherwise ask for all of them.
|
||||||
if options.gn or options.sn or options.directory or options.gecos or options.mail or options.shell or options.addattr or options.delattr or options.setattr or options.activate:
|
if options.gn or options.sn or options.directory or options.gecos or options.mail or options.shell or options.addattr or options.delattr or options.setattr or options.activate:
|
||||||
@ -249,7 +232,6 @@ def main():
|
|||||||
value = cvalue + [value]
|
value = cvalue + [value]
|
||||||
user.setValue(attr, value)
|
user.setValue(attr, value)
|
||||||
|
|
||||||
try:
|
|
||||||
if options.activate:
|
if options.activate:
|
||||||
try:
|
try:
|
||||||
client.mark_user_active(user.getValues('uid'))
|
client.mark_user_active(user.getValues('uid'))
|
||||||
@ -259,25 +241,45 @@ def main():
|
|||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
client.update_user(user)
|
client.update_user(user)
|
||||||
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
|
|
||||||
|
|
||||||
print username + " successfully updated"
|
print username + " successfully updated"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.user
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.ipavalidate as ipavalidate
|
||||||
|
import ipa.ipautil as ipautil
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import ldap
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[0][1])
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -18,19 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Tempal Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Tempal 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 xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import krbV
|
|
||||||
import ldap
|
|
||||||
import getpass
|
|
||||||
import errno
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-passwd [user]"
|
print "ipa-passwd [user]"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -105,26 +92,43 @@ def main():
|
|||||||
print "Password change cancelled"
|
print "Password change cancelled"
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
client.modifyPassword(principal, '', password)
|
client.modifyPassword(principal, '', password)
|
||||||
except xmlrpclib.Fault, fault:
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import krbV
|
||||||
|
import ldap
|
||||||
|
import getpass
|
||||||
|
import errno
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
except SystemExit, e:
|
||||||
|
sys.exit(e)
|
||||||
|
except KeyboardInterrupt, e:
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
if fault.faultCode == errno.ECONNREFUSED:
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
print "The IPA XML-RPC service is not responding."
|
print "The IPA XML-RPC service is not responding."
|
||||||
else:
|
else:
|
||||||
print fault.faultString
|
print fault.faultString
|
||||||
return 1
|
sys.exit(1)
|
||||||
except kerberos.GSSError, e:
|
except kerberos.GSSError, e:
|
||||||
print "Could not initialize GSSAPI: %s/%s" % (e[0][0][0], e[0][1][0])
|
print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[0][1])
|
||||||
return 1
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError, e:
|
except xmlrpclib.ProtocolError, e:
|
||||||
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
return 1
|
sys.exit(1)
|
||||||
except ipa.ipaerror.IPAError, e:
|
except ipa.ipaerror.IPAError, e:
|
||||||
print "%s" % (e.message)
|
print "%s" % (e.message)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
@ -18,18 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
from optparse import OptionParser
|
|
||||||
import ipa
|
|
||||||
import ipa.entity
|
|
||||||
import ipa.ipaclient as ipaclient
|
|
||||||
import ipa.config
|
|
||||||
|
|
||||||
import xmlrpclib
|
|
||||||
import kerberos
|
|
||||||
import errno
|
|
||||||
import validate
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "ipa-pwpolicy [--maxlife days] [--minlife hours] [--history number] [--minclasses number] [--minlength number]"
|
print "ipa-pwpolicy [--maxlife days] [--minlife hours] [--history number] [--minclasses number] [--minlength number]"
|
||||||
print "ipa-pwpolicy --show"
|
print "ipa-pwpolicy --show"
|
||||||
@ -74,6 +62,7 @@ def update_policy(client, options):
|
|||||||
|
|
||||||
new = ipa.entity.Entity(current.toDict())
|
new = ipa.entity.Entity(current.toDict())
|
||||||
|
|
||||||
|
try:
|
||||||
if options.maxlife:
|
if options.maxlife:
|
||||||
if validate.is_integer(options.maxlife, min=0):
|
if validate.is_integer(options.maxlife, min=0):
|
||||||
new.setValue('krbmaxpwdlife', options.maxlife)
|
new.setValue('krbmaxpwdlife', options.maxlife)
|
||||||
@ -89,6 +78,12 @@ def update_policy(client, options):
|
|||||||
if options.minlength:
|
if options.minlength:
|
||||||
if validate.is_integer(options.minlength, min=0):
|
if validate.is_integer(options.minlength, min=0):
|
||||||
new.setValue('krbpwdminlength', options.minlength)
|
new.setValue('krbpwdminlength', options.minlength)
|
||||||
|
except validate.VdtTypeError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
return 1
|
||||||
|
except validate.VdtValueTooSmallError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
return 1
|
||||||
|
|
||||||
client.update_password_policy(new)
|
client.update_password_policy(new)
|
||||||
|
|
||||||
@ -98,7 +93,6 @@ def main():
|
|||||||
if options.usage:
|
if options.usage:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
|
||||||
client = ipaclient.IPAClient()
|
client = ipaclient.IPAClient()
|
||||||
|
|
||||||
if options.show:
|
if options.show:
|
||||||
@ -106,36 +100,40 @@ def main():
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
update_policy(client, options)
|
update_policy(client, options)
|
||||||
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], e[0][1])
|
|
||||||
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
|
|
||||||
except validate.VdtTypeError, e:
|
|
||||||
print "%s" % (e.message)
|
|
||||||
return 1
|
|
||||||
except validate.VdtValueTooSmallError, e:
|
|
||||||
print "%s" % (e.message)
|
|
||||||
return 1
|
|
||||||
except KeyboardInterrupt, e:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
|
import ipa
|
||||||
|
import ipa.entity
|
||||||
|
import ipa.ipaclient as ipaclient
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
|
import xmlrpclib
|
||||||
|
import kerberos
|
||||||
|
import errno
|
||||||
|
import validate
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
except SystemExit, e:
|
except SystemExit, e:
|
||||||
sys.exit(e)
|
sys.exit(e)
|
||||||
except KeyboardInterrupt, e:
|
except KeyboardInterrupt, e:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except xmlrpclib.Fault, fault:
|
||||||
|
if fault.faultCode == errno.ECONNREFUSED:
|
||||||
|
print "The IPA XML-RPC service is not responding."
|
||||||
|
else:
|
||||||
|
print fault.faultString
|
||||||
|
sys.exit(1)
|
||||||
|
except kerberos.GSSError, e:
|
||||||
|
print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[0][1])
|
||||||
|
sys.exit(1)
|
||||||
|
except xmlrpclib.ProtocolError, e:
|
||||||
|
print "Unable to connect to IPA server: %s" % (e.errmsg)
|
||||||
|
sys.exit(1)
|
||||||
|
except ipa.ipaerror.IPAError, e:
|
||||||
|
print "%s" % (e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
@ -828,3 +828,15 @@ class ItemCompleter:
|
|||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
def get_gsserror(e):
|
||||||
|
"""A GSSError exception looks differently in python 2.4 than it does
|
||||||
|
in python 2.5, deal with it."""
|
||||||
|
|
||||||
|
try:
|
||||||
|
primary = e[0]
|
||||||
|
secondary = e[1]
|
||||||
|
except:
|
||||||
|
primary = e[0][0]
|
||||||
|
secondary = e[0][1]
|
||||||
|
|
||||||
|
return (primary[0], secondary[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user