Skip to content

Using Kerberos Authentication and keep the keytab at close #1730

@fabianseelbach

Description

@fabianseelbach

If I use the paramiko Client with Kerberos Authentication (gssapi-with-mic), and loop over a list of servers I can only connect to the first server.

The reason for this is, I open the Client, and if I'm done with the server I close the Client.
At that point the keytab is beiing destroyed and the next authentication fails.

I use something like this:

import paramiko
servers = ["server1", "server2"]
stdouts = []
for server in servers:
    Client = paramiko.SSHClient()
    Client.connect(hostname=server, username=user, gss_auth=True)
    stdin, stdout, stderr = Client.exec_command("hostname", get_pty=True)
    Client.close()
    stdouts.append(stdout)

Is it possible to keep the keytab at a close()?
Or, is there another way to achieve that?

I'm using:
paramiko==2.7.1
gssapi==1.6.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions