From 3d2feac0e416c66ba37eee53ef5b3833c2c3e414 Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Mon, 16 Mar 2015 16:43:10 +0100 Subject: 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 Reviewed-By: Simo Sorce Reviewed-By: Petr Spacek --- daemons/dnssec/ipa-dnskeysync-replica | 6 ++++-- daemons/dnssec/ipa-dnskeysyncd | 4 +++- daemons/dnssec/ipa-ods-exporter | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'daemons') diff --git a/daemons/dnssec/ipa-dnskeysync-replica b/daemons/dnssec/ipa-dnskeysync-replica index 8a0ae8a9a..bcf928215 100755 --- a/daemons/dnssec/ipa-dnskeysync-replica +++ b/daemons/dnssec/ipa-dnskeysync-replica @@ -139,14 +139,16 @@ log.setLevel(level=logging.DEBUG) # Kerberos initialization PRINCIPAL = str('%s/%s' % (DAEMONNAME, ipalib.api.env.host)) log.debug('Kerberos principal: %s', PRINCIPAL) -ipautil.kinit_hostprincipal(paths.IPA_DNSKEYSYNCD_KEYTAB, WORKDIR, PRINCIPAL) +ccache_filename = os.path.join(WORKDIR, 'ccache') +ipautil.kinit_keytab(PRINCIPAL, paths.IPA_DNSKEYSYNCD_KEYTAB, ccache_filename) +os.environ['KRB5CCNAME'] = ccache_filename log.debug('Got TGT') # LDAP initialization ldap = ipalib.api.Backend[ldap2] # fixme log.debug('Connecting to LDAP') -ldap.connect(ccache="%s/ccache" % WORKDIR) +ldap.connect(ccache=ccache_filename) log.debug('Connected') diff --git a/daemons/dnssec/ipa-dnskeysyncd b/daemons/dnssec/ipa-dnskeysyncd index 919130343..b17c8d94e 100755 --- a/daemons/dnssec/ipa-dnskeysyncd +++ b/daemons/dnssec/ipa-dnskeysyncd @@ -65,7 +65,9 @@ log = root_logger # Kerberos initialization PRINCIPAL = str('%s/%s' % (DAEMONNAME, api.env.host)) log.debug('Kerberos principal: %s', PRINCIPAL) -ipautil.kinit_hostprincipal(KEYTAB_FB, WORKDIR, PRINCIPAL) +ccache_filename = os.path.join(WORKDIR, 'ccache') +ipautil.kinit_keytab(PRINCIPAL, KEYTAB_FB, ccache_filename) +os.environ['KRB5CCNAME'] = ccache_filename # LDAP initialization basedn = DN(api.env.container_dns, api.env.basedn) diff --git a/daemons/dnssec/ipa-ods-exporter b/daemons/dnssec/ipa-ods-exporter index 401f35087..6d33b79bb 100755 --- a/daemons/dnssec/ipa-ods-exporter +++ b/daemons/dnssec/ipa-ods-exporter @@ -399,7 +399,9 @@ ipalib.api.finalize() # Kerberos initialization PRINCIPAL = str('%s/%s' % (DAEMONNAME, ipalib.api.env.host)) log.debug('Kerberos principal: %s', PRINCIPAL) -ipautil.kinit_hostprincipal(paths.IPA_ODS_EXPORTER_KEYTAB, WORKDIR, PRINCIPAL) +ccache_name = os.path.join(WORKDIR, 'ccache') +ipautil.kinit_keytab(PRINCIPAL, paths.IPA_ODS_EXPORTER_KEYTAB, ccache_name) +os.environ['KRB5CCNAME'] = ccache_name log.debug('Got TGT') # LDAP initialization @@ -407,7 +409,7 @@ dns_dn = DN(ipalib.api.env.container_dns, ipalib.api.env.basedn) ldap = ipalib.api.Backend[ldap2] # fixme log.debug('Connecting to LDAP') -ldap.connect(ccache="%s/ccache" % WORKDIR) +ldap.connect(ccache=ccache_name) log.debug('Connected') -- cgit