|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/lib/python2.7/site-packages/paramiko/ |
Upload File : |
�
x�\c @ sd d Z d d l Z d d l Z d d l Z e Z d Z d d l m Z d d l m
Z
m Z d Z y d d l
Z
e
j f Z Wnq e e f k
r� y: d d l Z d d l Z d d l Z d Z e j f Z Wq� e k
r� e Z d Z q� Xn Xd d l m Z d d l m Z e 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 decodert MITt SSPI( t MSG_USERAUTH_REQUEST( t SSHExceptionc 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( ( s4 /tmp/pip-install-A1qMVe/paramiko/paramiko/ssh_gss.pyt GSSAuthH 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 ( ( s4 /tmp/pip-install-A1qMVe/paramiko/paramiko/ssh_gss.pyt __init__k 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( ( s4 /tmp/pip-install-A1qMVe/paramiko/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( ( s4 /tmp/pip-install-A1qMVe/paramiko/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( ( s4 /tmp/pip-install-A1qMVe/paramiko/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 __( ( s4 /tmp/pip-install-A1qMVe/paramiko/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( ( s4 /tmp/pip-install-A1qMVe/paramiko/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( ( s4 /tmp/pip-install-A1qMVe/paramiko/paramiko/ssh_gss.pyt _ssh_build_mic� s
(
t __name__t
__module__t __doc__R! R$ R&