| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories. | |
| 2 # See LICENSE for details. | |
| 3 | |
| 4 # | |
| 5 # Twisted, the Framework of Your Internet | |
| 6 # Copyright (c) 2001-2004 Twisted Matrix Laboratories. | |
| 7 # See LICENSE for details. | |
| 8 | |
| 9 | |
| 10 """ | |
| 11 I am a support module for making SSH servers with mktap. | |
| 12 """ | |
| 13 | |
| 14 from twisted.conch import checkers, unix | |
| 15 from twisted.conch.openssh_compat import factory | |
| 16 from twisted.cred import portal | |
| 17 from twisted.python import usage | |
| 18 from twisted.application import strports | |
| 19 | |
| 20 | |
| 21 class Options(usage.Options): | |
| 22 synopsis = "Usage: mktap conch [-i <interface>] [-p <port>] [-d <dir>] " | |
| 23 longdesc = "Makes a Conch SSH server.." | |
| 24 optParameters = [ | |
| 25 ["interface", "i", "", "local interface to which we listen"], | |
| 26 ["port", "p", "22", "Port on which to listen"], | |
| 27 ["data", "d", "/etc", "directory to look for host keys in"], | |
| 28 ["moduli", "", None, "directory to look for moduli in " | |
| 29 "(if different from --data)"] | |
| 30 ] | |
| 31 zsh_actions = {"data" : "_dirs", "moduli" : "_dirs"} | |
| 32 | |
| 33 | |
| 34 def makeService(config): | |
| 35 t = factory.OpenSSHFactory() | |
| 36 t.portal = portal.Portal(unix.UnixSSHRealm()) | |
| 37 t.portal.registerChecker(checkers.UNIXPasswordDatabase()) | |
| 38 t.portal.registerChecker(checkers.SSHPublicKeyDatabase()) | |
| 39 if checkers.pamauth: | |
| 40 t.portal.registerChecker(checkers.PluggableAuthenticationModulesChecker(
)) | |
| 41 t.dataRoot = config['data'] | |
| 42 t.moduliRoot = config['moduli'] or config['data'] | |
| 43 port = config['port'] | |
| 44 if config['interface']: | |
| 45 # Add warning here | |
| 46 port += ':interface='+config['interface'] | |
| 47 return strports.service(port, t) | |
| OLD | NEW |