summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/installutils.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2013-06-03 12:06:06 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-06-05 12:27:45 +0200
commit6f51f92138ff12eff732bf028751dcfa8ef9b442 (patch)
tree43790070a339e5cc8ae44ac6c48ee4bda16b57e5 /ipaserver/install/installutils.py
parente31eea3268497dc048d50dfcd952a6fb89e8e388 (diff)
downloadfreeipa-6f51f92138ff12eff732bf028751dcfa8ef9b442.tar.gz
freeipa-6f51f92138ff12eff732bf028751dcfa8ef9b442.tar.xz
freeipa-6f51f92138ff12eff732bf028751dcfa8ef9b442.zip
Use private ccache in ipa install tools
All installers that handle Kerberos auth, have been altered to use private ccache, that is ipa-server-install, ipa-dns-install, ipa-replica-install, ipa-ca-install. https://fedorahosted.org/freeipa/ticket/3666
Diffstat (limited to 'ipaserver/install/installutils.py')
-rw-r--r--ipaserver/install/installutils.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 5ed2689d7..a568eae7c 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -28,6 +28,7 @@ import shutil
from ConfigParser import SafeConfigParser, NoOptionError
import traceback
import textwrap
+from contextlib import contextmanager
from dns import resolver, rdatatype
from dns.exception import DNSException
@@ -753,3 +754,24 @@ def check_pkcs12(pkcs12_info, ca_file, hostname):
(pkcs12_filename, e))
return server_cert_name
+
+
+@contextmanager
+def private_ccache():
+
+ (desc, path) = tempfile.mkstemp(prefix='krbcc')
+ os.close(desc)
+
+ original_value = os.environ.get('KRB5CCNAME', None)
+
+ os.environ['KRB5CCNAME'] = path
+
+ yield
+
+ if original_value is not None:
+ os.environ['KRB5CCNAME'] = original_value
+ else:
+ os.environ.pop('KRB5CCNAME')
+
+ if os.path.exists(path):
+ os.remove(path)