/usr/share/pyshared/twisted/conch/tap.py is in python-twisted-conch 1:11.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # -*- test-case-name: twisted.conch.test.test_tap -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Support module for making SSH servers with twistd.
"""
from twisted.conch import checkers, unix
from twisted.conch.openssh_compat import factory
from twisted.cred import portal
from twisted.python import usage
from twisted.application import strports
try:
from twisted.cred import pamauth
except ImportError:
pamauth = None
class Options(usage.Options):
synopsis = "[-i <interface>] [-p <port>] [-d <dir>] "
longdesc = "Makes a Conch SSH server."
optParameters = [
["interface", "i", "", "local interface to which we listen"],
["port", "p", "tcp:22", "Port on which to listen"],
["data", "d", "/etc", "directory to look for host keys in"],
["moduli", "", None, "directory to look for moduli in "
"(if different from --data)"]
]
compData = usage.Completions(
optActions={"data" : usage.CompleteDirs(descr="data directory"),
"moduli" : usage.CompleteDirs(descr="moduli directory"),
"interface" : usage.CompleteNetInterfaces()}
)
def makeService(config):
t = factory.OpenSSHFactory()
t.portal = portal.Portal(unix.UnixSSHRealm())
t.portal.registerChecker(checkers.UNIXPasswordDatabase())
t.portal.registerChecker(checkers.SSHPublicKeyDatabase())
if pamauth is not None:
from twisted.cred.checkers import PluggableAuthenticationModulesChecker
t.portal.registerChecker(PluggableAuthenticationModulesChecker())
t.dataRoot = config['data']
t.moduliRoot = config['moduli'] or config['data']
port = config['port']
if config['interface']:
# Add warning here
port += ':interface='+config['interface']
return strports.service(port, t)
|