| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/MySQL/MySQL Workbench 6.3 CE/python/site-packages/paramiko/ |
Upload File : |
rKXc @ s d Z d d l Z d d l m Z d d l m Z m Z m Z m Z m Z d d l
m Z d e f d YZ
d e f d YZ d
e j f d YZ d S( sD
`.ServerInterface` is an interface to override for server support.
iN( t util( t DEBUGt ERRORt' OPEN_FAILED_ADMINISTRATIVELY_PROHIBITEDt AUTH_FAILEDt AUTH_SUCCESSFUL( t string_typest ServerInterfacec B s e Z d Z d Z d Z d Z d Z d Z d Z d Z e
d d Z e
d d Z
d
Z d Z d Z d
Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( s
This class defines an interface for controlling the behavior of Paramiko
in server mode.
Methods on this class are called from Paramiko's primary thread, so you
shouldn't do too much work in them. (Certainly nothing that blocks or
sleeps.)
c C s t S( s6
Determine if a channel request of a given type will be granted, and
return ``OPEN_SUCCEEDED`` or an error code. This method is
called in server mode when the client requests a channel, after
authentication is complete.
If you allow channel requests (and an ssh server that didn't would be
useless), you should also override some of the channel request methods
below, which are used to determine which services will be allowed on
a given channel:
- `check_channel_pty_request`
- `check_channel_shell_request`
- `check_channel_subsystem_request`
- `check_channel_window_change_request`
- `check_channel_x11_request`
- `check_channel_forward_agent_request`
The ``chanid`` parameter is a small number that uniquely identifies the
channel within a `.Transport`. A `.Channel` object is not created
unless this method returns ``OPEN_SUCCEEDED`` -- once a
`.Channel` object is created, you can call `.Channel.get_id` to
retrieve the channel ID.
The return value should either be ``OPEN_SUCCEEDED`` (or
``0``) to allow the channel request, or one of the following error
codes to reject it:
- ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``
- ``OPEN_FAILED_CONNECT_FAILED``
- ``OPEN_FAILED_UNKNOWN_CHANNEL_TYPE``
- ``OPEN_FAILED_RESOURCE_SHORTAGE``
The default implementation always returns
``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``.
:param str kind:
the kind of channel the client would like to open (usually
``"session"``).
:param int chanid: ID of the channel
:return: an `int` success or failure code (listed above)
( R ( t selft kindt chanid( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_request' s +c C s d S( s\
Return a list of authentication methods supported by the server.
This list is sent to clients attempting to authenticate, to inform them
of authentication methods that might be successful.
The "list" is actually a string of comma-separated names of types of
authentication. Possible values are ``"password"``, ``"publickey"``,
and ``"none"``.
The default implementation always returns ``"password"``.
:param str username: the username requesting authentication.
:return: a comma-separated `str` of authentication types
t password( ( R t username( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt get_allowed_authsT s c C s t S( s
Determine if a client may open channels with no (further)
authentication.
Return `.AUTH_FAILED` if the client must authenticate, or
`.AUTH_SUCCESSFUL` if it's okay for the client to not
authenticate.
The default implementation always returns `.AUTH_FAILED`.
:param str username: the username of the client.
:return:
`.AUTH_FAILED` if the authentication fails; `.AUTH_SUCCESSFUL` if
it succeeds.
:rtype: int
( R ( R R
( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_nonee s c C s t S( s+
Determine if a given username and password supplied by the client is
acceptable for use in authentication.
Return `.AUTH_FAILED` if the password is not accepted,
`.AUTH_SUCCESSFUL` if the password is accepted and completes
the authentication, or `.AUTH_PARTIALLY_SUCCESSFUL` if your
authentication is stateful, and this key is accepted for
authentication, but more authentication is required. (In this latter
case, `get_allowed_auths` will be called to report to the client what
options it has for continuing the authentication.)
The default implementation always returns `.AUTH_FAILED`.
:param str username: the username of the authenticating client.
:param str password: the password given by the client.
:return:
`.AUTH_FAILED` if the authentication fails; `.AUTH_SUCCESSFUL` if
it succeeds; `.AUTH_PARTIALLY_SUCCESSFUL` if the password auth is
successful, but authentication must continue.
:rtype: int
( R ( R R
R ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_passwordx s c C s t S( s
Determine if a given key supplied by the client is acceptable for use
in authentication. You should override this method in server mode to
check the username and key and decide if you would accept a signature
made using this key.
Return `.AUTH_FAILED` if the key is not accepted,
`.AUTH_SUCCESSFUL` if the key is accepted and completes the
authentication, or `.AUTH_PARTIALLY_SUCCESSFUL` if your
authentication is stateful, and this password is accepted for
authentication, but more authentication is required. (In this latter
case, `get_allowed_auths` will be called to report to the client what
options it has for continuing the authentication.)
Note that you don't have to actually verify any key signtature here.
If you're willing to accept the key, Paramiko will do the work of
verifying the client's signature.
The default implementation always returns `.AUTH_FAILED`.
:param str username: the username of the authenticating client
:param .PKey key: the key object provided by the client
:return:
`.AUTH_FAILED` if the client can't authenticate with this key;
`.AUTH_SUCCESSFUL` if it can; `.AUTH_PARTIALLY_SUCCESSFUL` if it
can authenticate with this key but must continue with
authentication
:rtype: int
( R ( R R
t key( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_publickey s c C s t S( s
Begin an interactive authentication challenge, if supported. You
should override this method in server mode if you want to support the
``"keyboard-interactive"`` auth type, which requires you to send a
series of questions for the client to answer.
Return `.AUTH_FAILED` if this auth method isn't supported. Otherwise,
you should return an `.InteractiveQuery` object containing the prompts
and instructions for the user. The response will be sent via a call
to `check_auth_interactive_response`.
The default implementation always returns `.AUTH_FAILED`.
:param str username: the username of the authenticating client
:param str submethods:
a comma-separated list of methods preferred by the client (usually
empty)
:return:
`.AUTH_FAILED` if this auth method isn't supported; otherwise an
object containing queries for the user
:rtype: int or `.InteractiveQuery`
( R ( R R
t
submethods( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_interactive s c C s t S( s
Continue or finish an interactive authentication challenge, if
supported. You should override this method in server mode if you want
to support the ``"keyboard-interactive"`` auth type.
Return `.AUTH_FAILED` if the responses are not accepted,
`.AUTH_SUCCESSFUL` if the responses are accepted and complete
the authentication, or `.AUTH_PARTIALLY_SUCCESSFUL` if your
authentication is stateful, and this set of responses is accepted for
authentication, but more authentication is required. (In this latter
case, `get_allowed_auths` will be called to report to the client what
options it has for continuing the authentication.)
If you wish to continue interactive authentication with more questions,
you may return an `.InteractiveQuery` object, which should cause the
client to respond with more answers, calling this method again. This
cycle can continue indefinitely.
The default implementation always returns `.AUTH_FAILED`.
:param list responses: list of `str` responses from the client
:return:
`.AUTH_FAILED` if the authentication fails; `.AUTH_SUCCESSFUL` if
it succeeds; `.AUTH_PARTIALLY_SUCCESSFUL` if the interactive auth
is successful, but authentication must continue; otherwise an
object containing queries for the user
:rtype: int or `.InteractiveQuery`
( R ( R t responses( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_interactive_response s c C s | t k r t St S( s
Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: The result of the krb5 authentication
:param str cc_filename: The krb5 client credentials cache filename
:return: `.AUTH_FAILED` if the user is not authenticated otherwise
`.AUTH_SUCCESSFUL`
:rtype: int
:note: Kerberos credential delegation is not supported.
:see: `.ssh_gss`
:note: : We are just checking in L{AuthHandler} that the given user is
a valid krb5 principal!
We don't check if the krb5 principal is allowed to log in on
the server, because there is no way to do that in python. So
if you develop your own SSH server with paramiko for a cetain
plattform like Linux, you should call C{krb5_kuserok()} in your
local kerberos library to make sure that the krb5_principal has
an account on the server and is allowed to log in as a user.
:see: `http://www.unix.com/man-page/all/3/krb5_kuserok/`
( R R ( R R
t gss_authenticatedt cc_file( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_gssapi_with_mic s c C s | t k r t St S( sP
Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication method
won't be available.
:param str username: The username of the authenticating client
:param int gss_authenticated: The result of the krb5 authentication
:param str cc_filename: The krb5 client credentials cache filename
:return: `.AUTH_FAILED` if the user is not authenticated otherwise
`.AUTH_SUCCESSFUL`
:rtype: int
:note: Kerberos credential delegation is not supported.
:see: `.ssh_gss` `.kex_gss`
:note: : We are just checking in L{AuthHandler} that the given user is
a valid krb5 principal!
We don't check if the krb5 principal is allowed to log in on
the server, because there is no way to do that in python. So
if you develop your own SSH server with paramiko for a cetain
plattform like Linux, you should call C{krb5_kuserok()} in your
local kerberos library to make sure that the krb5_principal has
an account on the server and is allowed to log in as a user.
:see: `http://www.unix.com/man-page/all/3/krb5_kuserok/`
( R R ( R R
R R ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_auth_gssapi_keyex s c C s t } t } | S( s
Overwrite this function in your SSH server to enable GSSAPI
authentication.
The default implementation always returns false.
:return: True if GSSAPI authentication is enabled otherwise false
:rtype: Boolean
:see: : `.ssh_gss`
( t False( R t UseGSSAPIt GSSAPICleanupCredentials( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt enable_auth_gssapi% s
c C s t S( sA
Handle a request for port forwarding. The client is asking that
connections to the given address and port be forwarded back across
this ssh connection. An address of ``"0.0.0.0"`` indicates a global
address (any address associated with this server) and a port of ``0``
indicates that no specific port is requested (usually the OS will pick
a port).
The default implementation always returns ``False``, rejecting the
port forwarding request. If the request is accepted, you should return
the port opened for listening.
:param str address: the requested address
:param int port: the requested port
:return:
the port number (`int`) that was opened for listening, or ``False``
to reject
( R ( R t addresst port( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_port_forward_request3 s c C s d S( s4
The client would like to cancel a previous port-forwarding request.
If the given address and port is being forwarded across this ssh
connection, the port should be closed.
:param str address: the forwarded address
:param int port: the forwarded port
N( ( R R R ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt cancel_port_forward_requestH s c C s t S( s
Handle a global request of the given ``kind``. This method is called
in server mode and client mode, whenever the remote host makes a global
request. If there are any arguments to the request, they will be in
``msg``.
There aren't any useful global requests defined, aside from port
forwarding, so usually this type of request is an extension to the
protocol.
If the request was successful and you would like to return contextual
data to the remote host, return a tuple. Items in the tuple will be
sent back with the successful result. (Note that the items in the
tuple can only be strings, ints, longs, or bools.)
The default implementation always returns ``False``, indicating that it
does not support any global requests.
.. note:: Port forwarding requests are handled separately, in
`check_port_forward_request`.
:param str kind: the kind of global request being made.
:param .Message msg: any extra arguments to the request.
:return:
``True`` or a `tuple` of data if the request was granted; ``False``
otherwise.
( R ( R R t msg( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_global_requestS s c C s t S( s2
Determine if a pseudo-terminal of the given dimensions (usually
requested for shell access) can be provided on the given channel.
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the pty request arrived on.
:param str term: type of terminal requested (for example, ``"vt100"``).
:param int width: width of screen in characters.
:param int height: height of screen in characters.
:param int pixelwidth:
width of screen in pixels, if known (may be ``0`` if unknown).
:param int pixelheight:
height of screen in pixels, if known (may be ``0`` if unknown).
:return:
``True`` if the psuedo-terminal has been allocated; ``False``
otherwise.
( R ( R t channelt termt widtht heightt
pixelwidtht pixelheightt modes( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_pty_requests s c C s t S( s
Determine if a shell will be provided to the client on the given
channel. If this method returns ``True``, the channel should be
connected to the stdin/stdout of a shell (or something that acts like
a shell).
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the request arrived on.
:return:
``True`` if this channel is now hooked up to a shell; ``False`` if
a shell can't or won't be provided.
( R ( R R% ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_shell_request s c C s t S( s
Determine if a shell command will be executed for the client. If this
method returns ``True``, the channel should be connected to the stdin,
stdout, and stderr of the shell command.
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the request arrived on.
:param str command: the command to execute.
:return:
``True`` if this channel is now hooked up to the stdin, stdout, and
stderr of the executing command; ``False`` if the command will not
be executed.
.. versionadded:: 1.1
( R ( R R% t command( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_exec_request s c C sT | j j | \ } } } | d k r. t S| | | | | | } | j t S( s
Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. An example of a subsystem is ``sftp``.
The default implementation checks for a subsystem handler assigned via
`.Transport.set_subsystem_handler`.
If one has been set, the handler is invoked and this method returns
``True``. Otherwise it returns ``False``.
.. note:: Because the default implementation uses the `.Transport` to
identify valid subsystems, you probably won't need to override this
method.
:param .Channel channel: the `.Channel` the pty request arrived on.
:param str name: name of the requested subsystem.
:return:
``True`` if this channel is now hooked up to the requested
subsystem; ``False`` if that subsystem can't or won't be provided.
N( t
get_transportt _get_subsystem_handlert NoneR t startt True( R R% t namet
handler_classt largt kwargt handler( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_subsystem_request s
c C s t S( s
Determine if the pseudo-terminal on the given channel can be resized.
This only makes sense if a pty was previously allocated on it.
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the pty request arrived on.
:param int width: width of screen in characters.
:param int height: height of screen in characters.
:param int pixelwidth:
width of screen in pixels, if known (may be ``0`` if unknown).
:param int pixelheight:
height of screen in pixels, if known (may be ``0`` if unknown).
:return: ``True`` if the terminal was resized; ``False`` if not.
( R ( R R% R' R( R) R* ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt# check_channel_window_change_request s c C s t S( s,
Determine if the client will be provided with an X11 session. If this
method returns ``True``, X11 applications should be routed through new
SSH channels, using `.Transport.open_x11_channel`.
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the X11 request arrived on
:param bool single_connection:
``True`` if only a single X11 channel should be opened, else
``False``.
:param str auth_protocol: the protocol used for X11 authentication
:param str auth_cookie: the cookie used to authenticate to X11
:param int screen_number: the number of the X11 screen to connect to
:return: ``True`` if the X11 session was opened; ``False`` if not
( R ( R R% t single_connectiont
auth_protocolt auth_cookiet
screen_number( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt check_channel_x11_request s c C s t S( s
Determine if the client will be provided with an forward agent session.
If this method returns ``True``, the server will allow SSH Agent
forwarding.
The default implementation always returns ``False``.
:param .Channel channel: the `.Channel` the request arrived on
:return: ``True`` if the AgentForward was loaded; ``False`` if not
( R ( R R% ( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt# check_channel_forward_agent_request s c C s t S( sK
Determine if a local port forwarding channel will be granted, and
return ``OPEN_SUCCEEDED`` or an error code. This method is
called in server mode when the client requests a channel, after
authentication is complete.
The ``chanid`` parameter is a small number that uniquely identifies the
channel within a `.Transport`. A `.Channel` object is not created
unless this method returns ``OPEN_SUCCEEDED`` -- once a
`.Channel` object is created, you can call `.Channel.get_id` to
retrieve the channel ID.
The origin and destination parameters are (ip_address, port) tuples
that correspond to both ends of the TCP connection in the forwarding
tunnel.
The return value should either be ``OPEN_SUCCEEDED`` (or
``0``) to allow the channel request, or one of the following error
codes to reject it:
- ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``
- ``OPEN_FAILED_CONNECT_FAILED``
- ``OPEN_FAILED_UNKNOWN_CHANNEL_TYPE``
- ``OPEN_FAILED_RESOURCE_SHORTAGE``
The default implementation always returns
``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``.
:param int chanid: ID of the channel
:param tuple origin:
2-tuple containing the IP address and port of the originator
(client side)
:param tuple destination:
2-tuple containing the IP address and port of the destination
(server side)
:return: an `int` success or failure code (listed above)
( R ( R R
t origint destination( ( sU C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\server.pyt"