# XXX support proxies
+ # Fetch a TGT with the given keytab
+ if self.keytab:
+ self._setup_credentials_cache()
+
+ self._fetch_kerberos_ticket()
+
+ def _setup_credentials_cache(self):
+ """
+ Create a temporary file to be used as Kerberos credentials cache
+ """
+ self.credentials_cache = tempfile.NamedTemporaryFile()
+
+ os.environ["KRB5CCNAME"] = self.credentials_cache.name
+
+ def _fetch_kerberos_ticket(self):
+ command = ["kinit", "-k", "-t", self.keytab]
+
+ p = subprocess.run(command, check=True, capture_output=True, text=True)
+
async def _socket(self, path, **kwargs):
return await self._request("GET", path,