honeynet / beeswarm

Honeypot deployment made easy
GNU General Public License v3.0
237 stars 64 forks source link

Generated key does not work for the SSH capability on some installations #204

Closed johnnykv closed 9 years ago

johnnykv commented 9 years ago

A user reported that on his setup, the generated SSH capability key did not work, log from Beeswarm drone:

2014-09-09 07:07:01,220 (beeswarm.drones.honeypot.capabilities.ssh) Unexpected end of ssh session: not a valid RSA private key file. (25ba15ad-1685-4bf1-bc3b-af6714061234)
cmsmith1977 commented 9 years ago

Thank you!

cmsmith1977 commented 9 years ago

Getting this error now on restart:

-bash-4.1$ beeswarm --server -v 2014-09-10 10:49:19,336 (root) Initializing BeeSwarm version 0.5.0 * Please answer a few configuration options ** 2014-09-10 10:49:19,337 (root) Beeswarm server will be configured using default ssl parameters and network configuration, this could be used to fingerprint the beeswarm server. If you want to customize these options please use the --customize options on first startup. 2014-09-10 10:49:19,337 (beeswarm.shared.helpers) Creating certificate and key. Traceback (most recent call last): File "/usr/bin/beeswarm", line 5, in pkg_resources.run_script('Beeswarm==0.5.0', 'beeswarm') File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 488, in run_script """ File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1354, in run_script (t&0xFFFF)>>11, (t>>5)&0x3F, (t&0x1F) \ 2, 0, 0, -1 # hms, etc. File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/EGG-INFO/scripts/beeswarm", line 141, in m = mode(args.workdir, config, customize=args.customize, clear_db=args.clearsessions, reset_password=args.resetpw) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/server/server.py", line 62, in init** Server.prepare_environment(work_dir, customize) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/server/server.py", line 297, in prepare_environment cert_cn) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/shared/helpers.py", line 73, in create_self_signed_cert rsa_key = RSA.generate(1024) TypeError: generate_c() takes at least 2 arguments (1 given)

cmsmith1977 commented 9 years ago

Tried this,

https://gist.github.com/lkdocs/6519378

but got this:

-bash-4.1$ beeswarm --server -v 2014-09-10 11:12:23,974 (root) Initializing BeeSwarm version 0.5.0 * Please answer a few configuration options ** 2014-09-10 11:12:23,974 (root) Beeswarm server will be configured using default ssl parameters and network configuration, this could be used to fingerprint the beeswarm server. If you want to customize these options please use the --customize options on first startup. 2014-09-10 11:12:23,974 (beeswarm.shared.helpers) Creating certificate and key. Traceback (most recent call last): File "/usr/bin/beeswarm", line 5, in pkg_resources.run_script('Beeswarm==0.5.0', 'beeswarm') File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 488, in run_script """ File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1354, in run_script (t&0xFFFF)>>11, (t>>5)&0x3F, (t&0x1F) \ 2, 0, 0, -1 # hms, etc. File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/EGG-INFO/scripts/beeswarm", line 141, in m = mode(args.workdir, config, customize=args.customize, clear_db=args.clearsessions, reset_password=args.resetpw) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/server/server.py", line 62, in init** Server.prepare_environment(work_dir, customize) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/server/server.py", line 297, in prepare_environment cert_cn) File "/usr/lib/python2.6/site-packages/Beeswarm-0.5.0-py2.6.egg/beeswarm/shared/helpers.py", line 73, in create_self_signed_cert rsa_key = RSA.generate(2048, e=65537) TypeError: generate_c() got an unexpected keyword argument 'e'

johnnykv commented 9 years ago

If you can provide instruction on how to install the dependencies on CentOS 6 i can try to reproduce. It does not install out of the box on CentOS with pip install beeswarm.

Could you give me the version of the installed PyCrypto? (using the commands below)

>>> from Crypto.PublicKey import RSA
>>> import Crypto
>>> print Crypto.__version__
cmsmith1977 commented 9 years ago

Install epel (instructions here: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x)

Then install your packages:

yum install libffi-devel python-devel python-pip openssl-devel libxml2-devel

cmsmith1977 commented 9 years ago

from Crypto.PublicKey import RSA import Crypto print Crypto.version 2.0.1

cmsmith1977 commented 9 years ago

I initially used the CentOS python-crypto which installed version 2.0. I uninstalled that (and paramiko) and re-installed paramiko using pip, and it's now working.

johnnykv commented 9 years ago

Good to hear!