Skip to content

Commit

Permalink
Merge pull request graphite-project#950 from deniszh/deniszh/fix-manhole
Browse files Browse the repository at this point in the history
Fix manhole for new Twisted (fixes graphite-project#948)
  • Loading branch information
deniszh authored Aug 27, 2023
2 parents 3951f98 + fc66d33 commit 798bf76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/carbon/manhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from twisted.conch.openssh_compat.factory import OpenSSHFactory
from twisted.internet import reactor
from twisted.application.internet import TCPServer
import twisted
from twisted.python import versions

from carbon.protocols import CarbonServerProtocol
from carbon.conf import settings
Expand All @@ -32,7 +34,8 @@ def createManholeListener():
sshRealm = TerminalRealm()
sshRealm.chainedProtocolFactory.protocolFactory = lambda _: Manhole(namespace)

if settings.MANHOLE_PUBLIC_KEY == 'None':
if (settings.MANHOLE_PUBLIC_KEY == 'None' or
twisted.version >= versions.Version('twisted', 16, 1, 0)):
credChecker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
credChecker.addUser(settings.MANHOLE_USER.encode('utf-8'),
''.encode('utf-8'))
Expand Down

0 comments on commit 798bf76

Please sign in to comment.