rename ssh_addr -> listen_addr

and ssh_port -> listen_port
old values still accepted for backwards compatibility
This commit is contained in:
Michel Oosterhof
2015-02-19 06:51:11 +00:00
parent 7b17bf06ce
commit 9e348e4c8d
4 changed files with 23 additions and 15 deletions

View File

@ -1,3 +1,6 @@
* 2015-02-19 Configuration directives have changed! ssh_addr has become listen_addr and ssh_port has become listen_port. The old keywords are still accepted for backwards compatibility
* default behaviour is changed to disable the exit jail * default behaviour is changed to disable the exit jail
* sftp support * sftp support
* exec support * exec support

View File

@ -16,12 +16,12 @@
# IP addresses to listen for incoming SSH connections. # IP addresses to listen for incoming SSH connections.
# #
# (default: 0.0.0.0) = any address # (default: 0.0.0.0) = any address
#ssh_addr = 0.0.0.0 #listen_addr = 0.0.0.0
# Port to listen for incoming SSH connections. # Port to listen for incoming SSH connections.
# #
# (default: 2222) # (default: 2222)
ssh_port = 2222 #listen_port = 2222
# Hostname for the honeypot. Displayed by the shell prompt of the virtual # Hostname for the honeypot. Displayed by the shell prompt of the virtual
# environment. # environment.

View File

@ -3,13 +3,11 @@
import sys, os import sys, os
if sys.platform == 'win32': if sys.platform == 'win32':
import os, inspect
# this is when just running on win32 # this is when just running on win32
sys.path.insert(0, os.path.abspath(os.getcwd())) sys.path.insert(0, os.path.abspath(os.getcwd()))
# and this is when running as a service # and this is when running as a service
#os.chdir(os.path.dirname(inspect.getfile(inspect.currentframe()))) #os.chdir(os.path.dirname(inspect.getfile(inspect.currentframe())))
from twisted.internet import reactor, defer
from twisted.application import internet, service from twisted.application import internet, service
from twisted.cred import portal from twisted.cred import portal
from twisted.conch.ssh import factory, keys from twisted.conch.ssh import factory, keys
@ -23,7 +21,6 @@ if not os.path.exists('kippo.cfg'):
sys.exit(1) sys.exit(1)
from kippo.core.config import config from kippo.core.config import config
import kippo.core.auth
import kippo.core.honeypot import kippo.core.honeypot
import kippo.core.ssh import kippo.core.ssh
from kippo import core from kippo import core
@ -42,16 +39,27 @@ factory.privateKeys = {'ssh-rsa': keys.Key.fromString(data=rsa_privKeyString),
'ssh-dss': keys.Key.fromString(data=dsa_privKeyString)} 'ssh-dss': keys.Key.fromString(data=dsa_privKeyString)}
cfg = config() cfg = config()
if cfg.has_option('honeypot', 'ssh_addr'):
ssh_addr = cfg.get('honeypot', 'ssh_addr') if cfg.has_option('honeypot', 'listen_addr'):
listen_addr = cfg.get('honeypot', 'listen_addr')
elif cfg.has_option('honeypot', 'ssh_addr'):
# ssh_addr for backwards compatibility
listen_addr = cfg.get('honeypot', 'ssh_addr')
else: else:
ssh_addr = '0.0.0.0' listen_addr = '0.0.0.0'
if cfg.has_option('honeypot', 'listen_port'):
listen_port = int(cfg.get('honeypot', 'listen_port'))
elif cfg.has_option('honeypot', 'ssh_port'):
# ssh_port for backwards compatibility
listen_port = int(cfg.get('honeypot', 'ssh_port'))
else:
listen_port = 2222
application = service.Application('honeypot') application = service.Application('honeypot')
for i in ssh_addr.split(): for i in listen_addr.split():
service = internet.TCPServer( service = internet.TCPServer( listen_port,
int(cfg.get('honeypot', 'ssh_port')), factory, factory, interface=i)
interface=i)
service.setServiceParent(application) service.setServiceParent(application)
if cfg.has_option('honeypot', 'interact_enabled') and \ if cfg.has_option('honeypot', 'interact_enabled') and \
@ -59,7 +67,6 @@ if cfg.has_option('honeypot', 'interact_enabled') and \
('yes', 'true', 'on'): ('yes', 'true', 'on'):
iport = int(cfg.get('honeypot', 'interact_port')) iport = int(cfg.get('honeypot', 'interact_port'))
from kippo.core import interact from kippo.core import interact
from twisted.internet import protocol
service = internet.TCPServer(iport, interact.makeInteractFactory(factory)) service = internet.TCPServer(iport, interact.makeInteractFactory(factory))
service.setServiceParent(application) service.setServiceParent(application)

View File

@ -24,7 +24,5 @@ then
. $VENV/bin/activate . $VENV/bin/activate
fi fi
twistd --version
echo "Starting kippo in the background..." echo "Starting kippo in the background..."
twistd -y kippo.tac -l log/kippo.log --pidfile kippo.pid twistd -y kippo.tac -l log/kippo.log --pidfile kippo.pid