Python Forum
Delay in fetching kerberos tokens : python gssapi securitycontext
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delay in fetching kerberos tokens : python gssapi securitycontext
#1
0
down vote
favorite

Hi I'm using a python function as follows for fetching kerberos tokens

def get_token(server):

    service = gssapi.Name("HTTP@%s" % server, gssapi.NameType.hostbased_service)

    ctx = gssapi.SecurityContext(name=service, usage="initiate")
    attempts = 0

    while True:
        try:
            print("before")

            token = ctx.step()

            print("after")  
            break
        except Exception as e:
            attempts += 1
            print(attempts)
            if attempts < MAX_TOKEN_ATTEMPTS:
                logger.debug("exception while getting Kerberos token, trying again", exc_info=e)
            else:
                raise OSError("too many failures while getting Kerberos token, discarding request") from e

    b64token = base64.b64encode(token)
    return b64token
The function is giving expected result. However the problem is, in one of my machine, the step "token = ctx.step()" is taking more than 5 sec to complete. In my other other machines it's taking less than 2 sec.

Any idea regrading the reason for delay?

-I have tried using IP address as well as the FQDN as the argument of the main funtion. all same.
-ping from all my machines to the server takes same time.

My environment:

Python 3.5.2
Ubuntu 16.04
Reply
#2
Cross-posted from https://stackoverflow.com/questions/5010...itycontext
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to add a delay right after a request.get() cubangt 6 2,681 Sep-07-2023, 09:29 AM
Last Post: shoesinquiry
  fetching exit status hangs in paramiko saisankalpj 3 1,169 Dec-04-2022, 12:21 AM
Last Post: nilamo
  Fetching the port number using asyncio gary 0 940 Nov-01-2022, 02:53 AM
Last Post: gary
  Request Delay pheadrus 1 3,784 Nov-25-2021, 08:51 PM
Last Post: snippsat
  adding a delay on end Daz2264 6 2,477 Sep-29-2021, 02:57 PM
Last Post: deanhystad
Question trouble with unexpected tokens 8iFwe8wK8 2 1,539 Jun-24-2021, 02:29 PM
Last Post: ibreeden
  python delay without interrupt the whole code Nick_tkinter 4 5,139 Feb-22-2021, 10:51 PM
Last Post: nilamo
  Fetching data from multiple tables in a single request. swaroop 0 1,885 Jan-09-2021, 04:23 PM
Last Post: swaroop
  How to read CSV file one row at the time in a range and some delay in between greenpine 2 4,738 Nov-20-2020, 02:26 PM
Last Post: greenpine
  configure delay on only one link using python3 HiImAl 3 2,710 Oct-21-2020, 07:51 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020