diff --git a/Makefile b/Makefile index 0c6ffdd63d51638bf74cd41cb4517248ba764319..531e1920080526a46ba3a33e675714a02f34c621 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Normally it would be just twistd but it runs always with Python 2 in this moment. TWISTD_CMD=-c "from twisted.scripts.twistd import run; run()" -TWISTD_RUN_ARGS=-l haas.log --pidfile haas.pid haas_proxy -p 2220 -d 42 +TWISTD_RUN_ARGS=-l haas.log --pidfile haas.pid haas_proxy -d 42 FPM_CMD=fpm -f -d sshpass -m 'haas@nic.cz' -s python FPM_CMD_PY2=${FPM_CMD} --python-bin /usr/bin/python2 --python-package-name-prefix python @@ -37,10 +37,12 @@ test: lint: python3 -m pylint --rcfile=pylintrc haas_proxy twisted/plugins/haas_proxy_plugin.py -run-py2: +run-py2: run-kill sudo python2 ${TWISTD_CMD} ${TWISTD_RUN_ARGS} -run-py3: +run-py3: run-kill sudo python3 ${TWISTD_CMD} ${TWISTD_RUN_ARGS} +run-kill: + kill `cat haas.pid` >/dev/null || true build: # Debian packages diff --git a/haas_proxy/proxy.py b/haas_proxy/proxy.py index fc7b983c352c587742cd8f18bcf96748c28362f7..2909ea65578f446bbc0b99f0bd8c6a30c546ad63 100644 --- a/haas_proxy/proxy.py +++ b/haas_proxy/proxy.py @@ -139,6 +139,8 @@ class ProxySSHSession(SSHSessionForUnixConchUser): 'sshpass', '-p', self.mangled_password, 'ssh', + '-o', 'UserKnownHostsFile=/dev/null', + '-o', 'StrictHostKeyChecking=no', '-p', str(self.cmd_args.honeypot_port), '{}@{}'.format(force_text(self.avatar.username), self.cmd_args.honeypot_host), ] diff --git a/test_haas_proxy.py b/test_haas_proxy.py index 4135b5f4c59239cf23f07143529a40a57bf2b922..0715c4d7028c6e53a48581a951e41a098b2e5a9f 100644 --- a/test_haas_proxy.py +++ b/test_haas_proxy.py @@ -52,7 +52,13 @@ def test_force_text(value, expected): def test_honeypot_ssh_arguments(proxy_ssh_session): - assert proxy_ssh_session.honeypot_ssh_arguments[3:] == ['ssh', '-p', '2222', 'user@localhost'] + assert proxy_ssh_session.honeypot_ssh_arguments[3:] == [ + 'ssh', + '-o', 'UserKnownHostsFile=/dev/null', + '-o', 'StrictHostKeyChecking=no', + '-p', '2222', + 'user@localhost', + ] def test_mangle_password(proxy_ssh_session):