Repository URL to install this package:
|
Version:
3.4.51 ▾
|
ó
°EYc @ s: d Z d d l Z d d l Z d d l Z e Z d d l m Z d d l m Z m
Z
d d l m Z d d l
m Z d Z y d d l Z WnY e e f k
rç y" d d l Z d d l Z d Z Wqè e k
rã e Z d Z qè Xn Xe d Z d
e f d YZ d e f d
YZ d e f d YZ d S( sÌ
This module provides GSS-API / SSPI authentication as defined in :rfc:`4462`.
.. note:: Credential delegation is not supported in server mode.
.. seealso:: :doc:`/api/kex_gss`
.. versionadded:: 1.15
iÿÿÿÿN( t ObjectIdentifier( t encodert decoder( t MSG_USERAUTH_REQUEST( t SSHExceptiont MITt SSPIc C sQ t d k r t | | St d k rA t j d k rA t | | St d d S( s©
Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
We delegate credentials by default.
:return: Either an `._SSH_GSSAPI` (Unix) object or an
`_SSH_SSPI` (Windows) object
:raises: ``ImportError`` -- If no GSS-API / SSPI module could be imported.
:see: `RFC 4462 <http://www.ietf.org/rfc/rfc4462.txt>`_
:note: Check for the available API and return either an `._SSH_GSSAPI`
(MIT GSSAPI) object or an `._SSH_SSPI` (MS SSPI) object. If you
get python-gssapi working on Windows, python-gssapi
will be used and a `._SSH_GSSAPI` object will be returned.
If there is no supported API available,
``None`` will be returned.
R R t nts) Unable to import a GSS-API / SSPI module!N( t _APIt _SSH_GSSAPIt ost namet _SSH_SSPIt ImportError( t auth_methodt gss_deleg_creds( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt GSSAuthA s
t _SSH_GSSAuthc B sP e Z d Z d Z d Z d Z d d Z d Z d Z d Z RS( s[
Contains the shared variables and methods of `._SSH_GSSAPI` and
`._SSH_SSPI`.
c C sp | | _ | | _ d | _ d | _ d | _ d | _ d | _ d | _ t | _
d | _ t | _ d | _
d S( sÝ
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not
s ssh-connections 1.2.840.113554.1.2.2N( t _auth_methodt _gss_deleg_credst Nonet _gss_hostt _usernamet _session_idt _servicet
_krb5_mecht _gss_ctxtt Falset _gss_ctxt_statust
_gss_srv_ctxtt _gss_srv_ctxt_statust cc_file( t selfR R ( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt __init__c s c C s | j d r | | _ n d S( sì
This is just a setter to use a non default service.
I added this method, because RFC 4462 doesn't specify "ssh-connection"
as the only service value.
:param str service: The desired SSH service
s ssh-N( t findR ( R t service( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt set_service~ s c C s
| | _ d S( sÔ
Setter for C{username}. If GSS-API Key Exchange is performed, the
username is not set by C{ssh_init_sec_context}.
:param str username: The name of the user who attempts to login
N( R ( R t username( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt set_username s t clientc C s\ | j d } t j t | j } | j t | } | d k rP | | S| | | S( sÄ
This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, the length of the OID and the actual OID encoded with
DER
:note: In server mode we just return the OID length and the DER encoded
OID.
i t server( t _make_uint32R t encodeR R t len( R t modet OIDst krb5_OIDt OID_len( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt ssh_gss_oids s c C s2 t j | \ } } | j | j k r. t St S( sè
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
( R t decodet __str__R R t True( R t desired_mecht mecht __( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt ssh_check_mech¥ s c C s t j d | S( sÇ
Create a 32 bit unsigned integer (The byte sequence of an integer).
:param int integer: The integer value to convert
:return: The byte sequence of an 32 bit integer
s !I( t structt pack( R t integer( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyR) ³ s c C s´ | j t | } | | 7} | t j d t 7} | | j t | 7} | | j 7} | | j t | 7} | | j 7} | | j t | 7} | | j 7} | S( sÎ
Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
:param str auth_method: The requested SSH authentication mechanism
:return: The MIC as defined in RFC 4462. The contents of the
MIC field are:
string session_identifier,
byte SSH_MSG_USERAUTH_REQUEST,
string user-name,
string service (ssh-connection),
string authentication-method
(gssapi-with-mic or gssapi-keyex)
t B( R) R+ R8 R9 R R* ( R t
session_idR% R# R t mic( ( sE /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/ssh_gss.pyt _ssh_build_mic¼ s
(
t __name__t
__module__t __doc__R! R$ R&