From 3912ffb60345609e1373571fbc4f6d60f0d043c7 Mon Sep 17 00:00:00 2001 From: desaster Date: Mon, 21 Jan 2013 12:41:41 +0000 Subject: [PATCH] Remove connection limit support for now, since adding a protocol wrapper changes the logging in newer twisted versions, and breaks dblog. git-svn-id: https://kippo.googlecode.com/svn/trunk@232 951d7100-d841-11de-b865-b3884708a8e2 --- kippo.cfg.dist | 5 ----- kippo.tac | 4 +--- kippo/core/honeypot.py | 24 ------------------------ 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/kippo.cfg.dist b/kippo.cfg.dist index 576f647e..bdf4100f 100644 --- a/kippo.cfg.dist +++ b/kippo.cfg.dist @@ -20,11 +20,6 @@ ssh_port = 2222 # (default: sales) hostname = sales -# Maximum number of concurrent connections to the honeypot -# -# (default: 50) -#connection_limit = 50 - # Directory where to save log files in. # # (default: log) diff --git a/kippo.tac b/kippo.tac index 8a82eed9..bde5eb4e 100644 --- a/kippo.tac +++ b/kippo.tac @@ -33,8 +33,6 @@ factory.portal.registerChecker(honeypot.HoneypotPasswordChecker()) factory.publicKeys = {'ssh-rsa': keys.Key.fromString(data=pubKeyString)} factory.privateKeys = {'ssh-rsa': keys.Key.fromString(data=privKeyString)} -wrapper = honeypot.HoneypotLimitConnections(factory) - cfg = config() if cfg.has_option('honeypot', 'ssh_addr'): ssh_addr = cfg.get('honeypot', 'ssh_addr') @@ -44,7 +42,7 @@ else: application = service.Application('honeypot') for i in ssh_addr.split(): service = internet.TCPServer( - int(cfg.get('honeypot', 'ssh_port')), wrapper, + int(cfg.get('honeypot', 'ssh_port')), factory, interface=i) service.setServiceParent(application) diff --git a/kippo/core/honeypot.py b/kippo/core/honeypot.py index 88b4e2b7..1d9b026b 100644 --- a/kippo/core/honeypot.py +++ b/kippo/core/honeypot.py @@ -8,7 +8,6 @@ from twisted.conch.insults import insults from twisted.application import service, internet from twisted.internet import reactor, protocol, defer from twisted.python import failure, log -from twisted.protocols.policies import WrappingFactory from zope.interface import implements from copy import deepcopy, copy import sys, os, random, pickle, time, stat, shlex, anydbm @@ -652,29 +651,6 @@ class HoneyPotSSHFactory(factory.SSHFactory): t.factory = self return t -class HoneypotLimitConnections(WrappingFactory): - - connectionCount = 0 - connectionLimit = 50 - - def startFactory(self): - cfg = config() - if cfg.has_option('honeypot', 'connection_limit'): - self.connectionLimit = int(cfg.get( - 'honeypot', 'connection_limit')) - - def buildProtocol(self, addr): - if self.connectionLimit is None or \ - self.connectionCount < self.connectionLimit: - self.connectionCount += 1 - return WrappingFactory.buildProtocol(self, addr) - else: - print 'Connection limit reached (%s:%s)' % (addr.host, addr.port) - return None - - def unregisterProtocol(self, p): - self.connectionCount -= 1 - class HoneypotPasswordChecker: implements(checkers.ICredentialsChecker)