mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Adopted kinit_keytab and kinit_password for kerberos auth
Calls to ipautil.run using kinit were replaced with calls kinit_keytab/kinit_password functions implemented in the PATCH 0015. Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Simo Sorce <ssorce@redhat.com> Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
a8e30e9671
commit
3d2feac0e4
@@ -26,6 +26,7 @@ import os
|
||||
import urlparse
|
||||
import time
|
||||
import tempfile
|
||||
from krbV import Krb5Error
|
||||
|
||||
import SSSDConfig
|
||||
|
||||
@@ -431,10 +432,11 @@ def main():
|
||||
os.close(ccache_fd)
|
||||
try:
|
||||
try:
|
||||
host_princ = str('host/%s@%s' % (api.env.host, api.env.realm))
|
||||
ipautil.kinit_keytab(host_princ, paths.KRB5_KEYTAB, ccache_name)
|
||||
os.environ['KRB5CCNAME'] = ccache_name
|
||||
ipautil.run([paths.KINIT, '-k', '-t', paths.KRB5_KEYTAB, 'host/%s@%s' % (api.env.host, api.env.realm)])
|
||||
except ipautil.CalledProcessError, e:
|
||||
sys.exit("Failed to obtain host TGT.")
|
||||
except Krb5Error as e:
|
||||
sys.exit("Failed to obtain host TGT: %s" % e)
|
||||
# Now we have a TGT, connect to IPA
|
||||
try:
|
||||
api.Backend.rpcclient.connect()
|
||||
|
||||
@@ -55,9 +55,11 @@ class CertUpdate(admintool.AdminTool):
|
||||
ldap = ipaldap.IPAdmin(server)
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix="tmp-")
|
||||
ccache_name = os.path.join(tmpdir, 'ccache')
|
||||
try:
|
||||
principal = str('host/%s@%s' % (api.env.host, api.env.realm))
|
||||
ipautil.kinit_hostprincipal(paths.KRB5_KEYTAB, tmpdir, principal)
|
||||
ipautil.kinit_keytab(principal, paths.KRB5_KEYTAB, ccache_name)
|
||||
os.environ['KRB5CCNAME'] = ccache_name
|
||||
|
||||
api.Backend.rpcclient.connect()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user