Sshd: Remove plugin.
parent
472052f973
commit
dfe9b34cfa
|
@ -1,87 +0,0 @@
|
|||
Insert a description of your plugin here, with any notes, etc. about using it.
|
||||
Outline
|
||||
=======
|
||||
The plugin is able to run servers in on the same host as a running
|
||||
Supybot. These servers accept SSH connections, and authenticate against
|
||||
Supybot's user registry, and additionally a list of recognized RSA
|
||||
public keys. Users are then presented with an interface chosen by
|
||||
the protocol of the server they have connected to.
|
||||
|
||||
Using
|
||||
=====
|
||||
To start a server the L{start} command can be used. Alternatively if
|
||||
the registry option plugins.Sshd.<protocol>.autoSTart is set to True,
|
||||
the server will start automatically when the plugin is started.
|
||||
|
||||
Commands
|
||||
========
|
||||
Authenticated users may issue any command to the Supybot they have
|
||||
connected to. The hostmask that is generated for Ssh connected users
|
||||
is partly random, and its authentication is cleared when the user
|
||||
logs out.
|
||||
|
||||
When users issue commands, they are tagged with the fromSsh tag, an
|
||||
instance of the SshUser class, which is used for replying.
|
||||
|
||||
Replying
|
||||
========
|
||||
The OutFilter checks for messages that are replies to commands issued
|
||||
over Ssh, and if they are, it intercepts them, and uses the SshUser
|
||||
instance (that has been tagged) to redirect the reply.
|
||||
|
||||
Hostmasks
|
||||
=========
|
||||
Because Sshd connected users are not connected via IRC, the concept of
|
||||
a hostmask is not specifically relevant to them. On connection one is
|
||||
randomly generated, that is used for capability and user user-specific
|
||||
purposes by Suppybot for the duration of that Ssh session.
|
||||
|
||||
Walls
|
||||
=====
|
||||
Walls provide a way by which anyone can send messages to Sshd
|
||||
connected users. The 'wall' command is used (help wall). This
|
||||
functionality can be used similarly to the eggdrop partyline.
|
||||
|
||||
Protocols
|
||||
=========
|
||||
Currently the plugin supports the provision of 4 different protocols
|
||||
over SSH. The protocols may be run simultansously (on different ports)
|
||||
on the same running instance of Supybot. The protocols are are:
|
||||
|
||||
1. B{shell} - A standard line based shell protocol with line editing, and
|
||||
history. This is very much like a simple version of any
|
||||
UNIX-like shell, except commands issued are passed to Supybot,
|
||||
and replies are returned to the shell.
|
||||
|
||||
2 B{ui} - A user interface (still using the OpenSSH client) which is
|
||||
somewhat more friendly and pleasing to the eye.
|
||||
|
||||
3. B{plain} - A very simnple line based protocol with no echoing, or line
|
||||
editing features. The stream recognises commands on receipt of
|
||||
a '\\r' (character 13) and dispatches the buffered data as a
|
||||
command.
|
||||
|
||||
4. B{pyshell} - A Python interpreter shell. This is much like the Python
|
||||
Interactive Interpreter (which it uses). It is imagined that
|
||||
this will only be used for development/debugging purposes,
|
||||
and should certainly be confined to owner use.
|
||||
|
||||
RSA Keys
|
||||
========
|
||||
In order to run the Ssh server(s) you will need to provide an RSA
|
||||
public/private key pair (DSA is not currently supported). The server
|
||||
will use these keys to identify itself with clients.
|
||||
|
||||
Keys can be generated by issuing the command:
|
||||
|
||||
C{ssh-keygen -t rsa}
|
||||
|
||||
You will be prompted for the necessary information.
|
||||
|
||||
Public key authentication
|
||||
=========================
|
||||
Before attempting password authentication, the server will check the
|
||||
client's public key with a list of authorzed keys. These keys should
|
||||
be present in the keys/authorized data directory, and should be named
|
||||
as the users name.
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2005, Ali Afshar
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
"""
|
||||
Add a description of the plugin (to be presented to the user inside the wizard)
|
||||
here. This should describe *what* the plugin does.
|
||||
"""
|
||||
|
||||
import supybot
|
||||
import supybot.world as world
|
||||
|
||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||
# in here if you're keeping the plugin in CVS or some similar system.
|
||||
__version__ = "0.2.0"
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.authors.unknown
|
||||
|
||||
# This is a dictionary mapping supybot.Author instances to lists of
|
||||
# contributions.
|
||||
__contributors__ = {}
|
||||
|
||||
import config
|
||||
import plugin
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
||||
if world.testing:
|
||||
import test
|
||||
|
||||
Class = plugin.Class
|
||||
configure = config.configure
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
150
Sshd/config.py
150
Sshd/config.py
|
@ -1,150 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2005, Ali Afshar
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
import os
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified himself as an advanced
|
||||
# user or not. You should effect your configuration by manipulating the
|
||||
# registry as appropriate.
|
||||
from supybot.questions import expect, anything, something, yn
|
||||
conf.registerPlugin('Sshd', True)
|
||||
|
||||
# The root configuration group
|
||||
Sshd = conf.registerPlugin('Sshd')
|
||||
|
||||
conf.registerGlobalValue(Sshd, 'capability',
|
||||
registry.String('owner',
|
||||
"""The default capability to connect to the Ssh server and to use the
|
||||
Ssh commands."""))
|
||||
|
||||
conf.registerGlobalValue(Sshd, 'motd',
|
||||
registry.String('Welcome to the Supybot SSH Server',
|
||||
"""This is the message returned to clients on successful
|
||||
authorization."""))
|
||||
|
||||
#Group containing key information
|
||||
conf.registerGroup(Sshd, 'keys')
|
||||
|
||||
#Filename information
|
||||
conf.registerGlobalValue(Sshd.keys, 'rsaPrivateFile',
|
||||
registry.String('id_rsa',
|
||||
"""Filename of RSA private key file for use with Ssh. Unless a complete
|
||||
path is given, the location of the file is assumed to be inside the
|
||||
data%sGateway%skeys directory""" % (os.sep, os.sep)))
|
||||
|
||||
conf.registerGlobalValue(Sshd.keys, 'rsaPublicFile',
|
||||
registry.String('id_rsa.pub',
|
||||
"""Filename of RSA public key file for use with Ssh. Unless a complete
|
||||
path is given, the location of the file is assumed to be inside the
|
||||
data%sGateway%skeys directory""" % (os.sep, os.sep)))
|
||||
|
||||
conf.registerGlobalValue(Sshd.keys, 'rsaAuthorizedDir',
|
||||
registry.String('authorized_rsa',
|
||||
"""Name of the directory containing the authorized RSA public key files
|
||||
for use with Ssh. Unless a complete path is given, the location of the
|
||||
file is assumed to be inside the data%sGateway%skeys directory""" % \
|
||||
(os.sep, os.sep)))
|
||||
|
||||
shellGroup = conf.registerGroup(Sshd, 'shell')
|
||||
|
||||
conf.registerGlobalValue(shellGroup, 'defaultPort',
|
||||
registry.Integer(9022,
|
||||
"""The port that the Sshd Shell server will start on if started
|
||||
automatically, or without port argument."""))
|
||||
|
||||
conf.registerGlobalValue(shellGroup, 'autoStart',
|
||||
registry.Boolean(True,
|
||||
"""Determines whether the Sshd Shell server will start automatically when
|
||||
the Sshd plugin is loaded."""))
|
||||
|
||||
conf.registerGlobalValue(shellGroup, 'capability',
|
||||
registry.String('',
|
||||
"""Determines what capability users will require to connect to the protocol.
|
||||
If this value is an empty string, no capability will be checked."""))
|
||||
|
||||
conf.registerGlobalValue(shellGroup, 'ps1',
|
||||
registry.String('%(username)s@%(nick)s: @',
|
||||
"""The prompt format. Bug me to improve this."""))
|
||||
|
||||
pyGroup = conf.registerGroup(Sshd, 'pyshell')
|
||||
|
||||
conf.registerGlobalValue(pyGroup, 'defaultPort',
|
||||
registry.Integer(9044,
|
||||
"""The port that the Python Shell server will start on if started
|
||||
automatically, or without port argument."""))
|
||||
|
||||
conf.registerGlobalValue(pyGroup, 'autoStart',
|
||||
registry.Boolean(False,
|
||||
"""Determines whether the Python Shell server will start automatically when
|
||||
the Sshd plugin is loaded."""))
|
||||
|
||||
conf.registerGlobalValue(pyGroup, 'capability',
|
||||
registry.String('owner',
|
||||
"""Determines what capability users will require to connect to the
|
||||
protocol. If this value is an empty string, no capability will be checked."""))
|
||||
|
||||
uiGroup = conf.registerGroup(Sshd, 'ui')
|
||||
|
||||
conf.registerGlobalValue(uiGroup, 'defaultPort',
|
||||
registry.Integer(9066,
|
||||
"""The port that the User Interface Shell server will start on if
|
||||
started automatically, or without port argument."""))
|
||||
|
||||
conf.registerGlobalValue(uiGroup, 'autoStart',
|
||||
registry.Boolean(False,
|
||||
"""Determines whether the User Interface Shell server will start
|
||||
automatically when the Sshd plugin is loaded."""))
|
||||
|
||||
conf.registerGlobalValue(uiGroup, 'capability',
|
||||
registry.String('owner',
|
||||
"""Determines what capability users will require to connect to the protocol.
|
||||
If this value is an empty string, no capability will be checked."""))
|
||||
|
||||
plGroup = conf.registerGroup(Sshd, 'plain')
|
||||
|
||||
conf.registerGlobalValue(plGroup, 'defaultPort',
|
||||
registry.Integer(9088,
|
||||
"""The port that the Plain server will start on if started
|
||||
automatically, or without port argument."""))
|
||||
|
||||
conf.registerGlobalValue(plGroup, 'autoStart',
|
||||
registry.Boolean(False,
|
||||
"""Determines whether the Plain server will start automatically when
|
||||
the Sshd plugin is loaded."""))
|
||||
|
||||
conf.registerGlobalValue(plGroup, 'capability',
|
||||
registry.String('owner',
|
||||
"""Determines what capability users will require to connect to the protocol.
|
||||
If this value is an empty string, no capability will be checked."""))
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
2061
Sshd/plugin.py
2061
Sshd/plugin.py
File diff suppressed because it is too large
Load Diff
53
Sshd/test.py
53
Sshd/test.py
|
@ -1,53 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2005, Ali Afshar
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
class SshdTestCase(PluginTestCase):
|
||||
plugins = ('Sshd', 'Config', 'Misc', 'Admin')
|
||||
|
||||
def testStopAll(self):
|
||||
self.assertNotError('stop shell')
|
||||
self.assertNotError('stop pyshell')
|
||||
self.assertNotError('stop ui')
|
||||
self.assertNotError('stop plain')
|
||||
|
||||
def testStart(self):
|
||||
self.assertResponse('running', 'There are no running gateways.')
|
||||
self.assertResponse('start shell', 'The operation succeeded.')
|
||||
self.assertResponse('start ui', 'The operation succeeded.')
|
||||
self.assertResponse('start plain', 'The operation succeeded.')
|
||||
self.assertResponse('start pyshell', 'The operation succeeded.')
|
||||
|
||||
def testAvailable(self):
|
||||
self.assertResponse('protocols', 'plain, pyshell, shell, and ui')
|
||||
|
||||
def testLogout(self):
|
||||
self.assertError('logout')
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
Loading…
Reference in New Issue