start.sh and requirements improvements & no moduli fail fix with key exchanges (#194)

* Extra arguments to start.sh and improved requirements doc

Added possibly to pass extra arguments to twistd in start.sh (e.g. `env XARGS=--nodaemon ./start.sh`). Fixed list of the dependencies based on the issue micheloosterhof/cowrie#132 and added example of dependencies in practice for alpine:3.4.

* Fixes no moduli fail with key exchanges

Tries to fix issue micheloosterhof/cowrie#193

* Missing requirement and fixed logging
This commit is contained in:
nkapu
2016-06-19 16:36:48 +03:00
committed by Michel Oosterhof
parent c8b7523569
commit d2eb56c0f5
3 changed files with 18 additions and 7 deletions

View File

@@ -29,12 +29,20 @@ Software required:
* An operating system (tested on Debian, CentOS, FreeBSD and Windows 7)
* Python 2.7+
* Twisted 8.0+
* python-crypto
* python-cryptography
* python-pyasn1
* python-gmpy2 (recommended)
* python-mysqldb (for MySQL output)
* Zope Interface 3.6.0+
### Example requirements in alpine 3.4
```
apk add python py-asn1 py-twisted py-zope-interface libffi-dev \
py-cryptography py-pip py-six py-cffi py-idna py-ipaddress py-openssl
pip install enum34
```
## Files of interest:
* `cowrie.cfg` - Cowrie's configuration file. Default values can be found in `cowrie.cfg.dist`

View File

@@ -143,9 +143,13 @@ class HoneyPotSSHFactory(factory.SSHFactory):
if not self.primes:
ske = t.supportedKeyExchanges[:]
ske.remove('diffie-hellman-group-exchange-sha1')
if 'diffie-hellman-group-exchange-sha1' in ske:
ske.remove('diffie-hellman-group-exchange-sha1')
log.msg("No moduli, no diffie-hellman-group-exchange-sha1")
if 'diffie-hellman-group-exchange-sha256' in ske:
ske.remove('diffie-hellman-group-exchange-sha256')
log.msg("No moduli, no diffie-hellman-group-exchange-sha256")
t.supportedKeyExchanges = ske
log.msg("No moduli, disabled diffie-hellman-group-exchange-sha1")
# Reorder supported ciphers to resemble current openssh more
t.supportedCiphers = ['aes128-ctr', 'aes192-ctr', 'aes256-ctr',
@@ -312,4 +316,3 @@ class HoneyPotTransport(transport.SSHServerTransport, TimeoutMixin):
log.msg('[SERVER] - Disconnecting with error, code %s\nreason: %s'
% (reason, desc))
self.transport.loseConnection()

View File

@@ -25,10 +25,10 @@ then
. $VENV/bin/activate
fi
echo "Starting cowrie in the background..."
echo "Starting cowrie with extra arguments [$XARGS] ..."
if [ $AUTHBIND_ENABLED = "no" ]
then
twistd -l log/cowrie.log --umask 0077 --pidfile cowrie.pid cowrie
twistd $XARGS -l log/cowrie.log --umask 0077 --pidfile cowrie.pid cowrie
else
authbind --deep twistd -l log/cowrie.log --umask 0077 --pidfile cowrie.pid cowrie
authbind --deep twistd $XARGS -l log/cowrie.log --umask 0077 --pidfile cowrie.pid cowrie
fi