Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kerberos authentication with python

I need to write a script in python to check a webpage, which is protected by kerberos. Is there any possibility to do this from within python and how? The script is going to be deployed on a linux environment with python 2.4.something installed.

dertoni

like image 395
dertoni Avatar asked Feb 13 '09 09:02

dertoni


People also ask

How do I use Kerberos authentication in Python?

The basic flow of a typical Kerberos authentication is as follows: Client sends an unauthenticated request to the server. Server sends back a 401 response with a WWW-Authenticate: Negotiate header with no authentication details. Client sends a new request with an Authorization: Negotiate header.

Which Python module would you use to authenticate against Kerberos?

Ansible is designed to check if kerberos package is installed and, if so, it uses kerberos authentication.

How do I get Kerberos ticket in Python?

There are two ways you can simulate KINIT behaviour using programming and those are: Calling kinit shell command from python with the appropriate arguments or (as I did) calling one method that pretty much does everything: krb5_get_init_creds_password(k5ctx, &cred, k5princ, password, NULL, NULL, 0, NULL, NULL);


1 Answers

I think that python-krbV and most Linux distributions also have a python-kerberos package. For example, Debian has one of the same name. Here's the documentation on it

Extract from link:

"This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. The goal is to avoid having to build a module that wraps the entire Kerberos.framework, and instead offer a limited set of functions that do what is needed for client/server Kerberos authentication based on http://www.ietf.org/rfc/rfc4559.txt. "

like image 103
batbrat Avatar answered Sep 22 '22 03:09

batbrat