Search for moduli in right place on MacosX

This commit is contained in:
Michel Oosterhof
2015-06-28 14:39:10 +04:00
parent e887724c5a
commit b778197403

View File

@@ -158,7 +158,7 @@ class HoneyPotSSHFactory(factory.SSHFactory):
@return: The built transport.
"""
_moduli = '/etc/ssh/moduli'
_modulis = '/etc/ssh/moduli', '/private/etc/moduli'
# FIXME: try to mimic something real 100%
t = HoneyPotTransport()
@@ -170,13 +170,15 @@ class HoneyPotSSHFactory(factory.SSHFactory):
t.supportedPublicKeys = self.privateKeys.keys()
try:
self.primes = primes.parseModuliFile(_moduli)
except IOError as err:
log.err(err)
for _moduli in _modulis:
try:
self.primes = primes.parseModuliFile(_moduli)
break
except IOError as err:
pass
if not self.primes:
log.msg("Disabling diffie-hellman-group-exchange-sha1")
log.msg("Moduli not found, disabling diffie-hellman-group-exchange-sha1")
ske = t.supportedKeyExchanges[:]
ske.remove('diffie-hellman-group-exchange-sha1')
t.supportedKeyExchanges = ske