Commit Graph

1983 Commits

Author SHA1 Message Date
22405a61f1 Store execcmd in interact part of tty log so it gets a unique hash 2018-08-07 22:02:38 +04:00
9b70982fe0 fix input hash, was hashing wrong thing 1.4.1 2018-08-06 18:23:57 +00:00
53b49c501d Full docker support (#830)
* Full docker support

Currently Docker images are build by a second git repository.
Changes to installation or starting cowrie would need to be done on
both. Merging this into one repository prevents that those will be
forgotten and makes it easier to understand why changes happen.

The dockerfile is a different one then the one from the docker-cowrie
repository.
I chose to use a python2-alpine linux. In the end this image has 55%
smaller image size than the Debian image. The build process is split
into to parts. The first image has everything installed to compile the
python modules. The second one has only things installed which are
needed to run the daemon.
There is no need to install python-virtualenv because we are using
docker. We don't need that much layers.
Twisted can drop his privileges when starting the daemon when `--uid`
and `--gid` is passed. This works only with numerical id. The user
nobody is used for this. This is on Docker a good idea since there
should be only one service with this user running. In other systems
there might be several services using this daemon which is not a good
choise.

When building a new Docker image for cowrie Docker multistage build
images are created running flake8 and unittests to ensure that all
future releases are stable and matching our code guidelines.

Bonus effect is when using this as a git pre-push-hook a developer
doesn't need to wait for travis to fail on an error.

Based on the current project structure we need a lot of `COPY`
instructions inside the dockerfile which has negative sideeffects.
- bloading the dockerfile up
- longer buildtimes
- more layers are created
- more diskspace is used

We should find a way to reduce this. Best way for doing this is keeping
the static files like `honeyfs` and `share` right next to the source
code.

* Removing UID 0 check

Cowrie checked on startup if it was started with root privileges.
This conflicts with the option to let cowrie drop his privileges on
startup using the twisted option `--uid` and `--gid`.

I tested it a day ago without removing the code block and it run through
but now it is for some reasons blocking. My feeling is that the code for
droping privileges is also asynchron and sometimes the check is faster
then the dropping of the privileges. But I might be wrong here.

The solution is to remove the hole check.
Considering that the check is there for preventing new users to shoot
their feet we fixed this problem on different levels.
New users should the docker images which are far easier to control and
deploy then everything else because we take care.
If a user wants to deploy it from scratch onto their serves there is a
install instruction with detailed steps. This steps includes creating a
special system user for cowrie and starting it with this user.

* Fix missing directory, simplify path

I missed to create the TTY log path. That's now fixed.

Also the path for the trial command has been simplified.

* Revert "Removing UID 0 check"

This reverts commit f76329cd79.

* Introducint ENV var COWRIE_DOCKER

The variable is used inside the docker image to let cowrie know that it
is running inside docker and don't need to perform the "running as root"
check.
Inside the docker image cowrie is started with the `--uid` and `--gid`
option and will drop to a different user then root.

* Restructured Dockerfile, Added cowrie user

The image is now builded with a user and group for running in the later
image cowrie.

Also the build steps are re-aranged to save build time.
We assume that static files like `honeyfs` and `share` are less
frequently updated and can be build into the base image where every
other images is based on.

* Renamed directory src -> cowrie

The name cowrie should be more self-explaining then src.

* Update cowrie_plugin.py
2018-08-06 12:27:32 +04:00
abc6732229 Update install guide steps for updating Cowrie (#840)
Updated the order of operations for updating Cowrie for a more logical flow
2018-08-02 12:40:37 +04:00
6f36d93f09 more flake8 2018-07-28 22:10:52 +04:00
2128cc5b13 Flake8 2018-07-28 22:10:19 +04:00
0bc66d87cc flake8 2018-07-28 22:04:05 +04:00
da8170c4f0 no longer need subclass publickey for recent Twisted 2018-07-28 20:35:45 +04:00
2dfab176d1 extra comments 2018-07-28 20:20:44 +04:00
2e14981c1a Add head/tail to test suite 2018-07-28 20:19:58 +04:00
652d1c0128 fix head on py3 2018-07-28 20:13:26 +04:00
4c8eec5995 remove commented out code 2018-07-28 20:11:29 +04:00
4d0d3194d7 docs 2018-07-28 19:56:37 +04:00
482abffa3b clientVersion/getClientVersion is not used 2018-07-28 19:46:14 +04:00
7c1faaf256 load commands once, not for every user 2018-07-28 19:42:43 +04:00
8890bcd6f6 wording changes 2018-07-28 19:22:09 +04:00
8e311f1051 remove duplicate docker entries 2018-07-28 19:16:12 +04:00
e899d2984f py3 parse http headers 2018-07-28 11:44:15 +00:00
85035a419c remove cowrie.log.open 2018-07-28 10:21:05 +00:00
b9fb147d98 Save tty contents in file based on hash of input 2018-07-28 10:15:37 +00:00
aecd049dde string->bytes for wget and curl 2018-07-28 09:13:58 +00:00
f544f17adf error message is bytes in py3 2018-07-28 09:04:05 +00:00
11c19dc5b6 calculate hash of input part of ttylog only 2018-07-28 08:50:43 +00:00
6d25734744 extra warning if config file not found 2018-07-28 07:24:21 +00:00
c5c3d20b0c Update INSTALL.md (#809)
* Update INSTALL.md

Added updating requirements output dependencies.

* Update INSTALL.md

Updated text to include info about upgrading optional output plugin dependencies
2018-07-25 13:32:36 +04:00
af2efaad7a Fixed bug in ifconfig.py #827 (#829) 2018-07-24 00:48:55 +04:00
6a3bc41c30 fix import v1.4.0 2018-07-23 15:32:18 +04:00
ad1c349c85 accept more options for scp 2018-07-23 12:25:13 +04:00
4fe530d792 import from right file. switch order of imports 2018-07-23 12:20:23 +04:00
8f9403d59a wrap verson in wrapper, we can get random bytes this way 2018-07-22 14:21:21 +04:00
2b44f7f0e0 Merge branch 'master' of http://www.github.com/micheloosterhof/cowrie 2018-07-22 14:02:50 +04:00
7c204a8164 do moduli check/version string only once 2018-07-22 14:02:12 +04:00
fc93c14845 code to delete old compiled code 2018-07-21 10:14:50 +00:00
6e974a68de update with instructiosn to delete compiled code 2018-07-21 10:09:15 +00:00
7756f4d987 move cowrie and twisted to src subdirectory (#825) 2018-07-21 14:04:44 +04:00
ec1fb606f3 create command du (#824)
* create command du

* activate command du
2018-07-21 11:53:02 +04:00
935dfeb0a6 ifconfig dynamic (#823)
* inet6 addr dynamic

* inet6 addr dynamic

* Packets dynamic in ifconfig
2018-07-21 11:52:23 +04:00
990640e280 remove isError from log.msg 2018-07-20 22:39:03 +04:00
9e242fed5d picture 2018-07-20 22:21:38 +04:00
56190902f7 readme 2018-07-20 22:16:57 +04:00
e0839a63df splunk docs are for the new one, not the legacy 2018-07-20 22:14:56 +04:00
48adc3160a doc/ -> docs/ 2018-07-20 22:12:30 +04:00
c6a4bc361e add SUPPORT 2018-07-20 22:01:38 +04:00
9a6cda0fa1 flake fix 2018-07-20 15:12:37 +04:00
bf2eff0b51 remove expected results json 2018-07-20 15:09:38 +04:00
b584287e3a .dist file goes to etc/ 2018-07-20 14:39:49 +04:00
369497005f use cowrie.client.kex for KEX 2018-07-20 14:29:59 +04:00
fb642455c6 HWaddr dynamic (#819)
* HWaddr dynamic

* Update ifconfig.py
2018-07-19 14:28:44 +04:00
3a918fd971 Fixed random.choice() for version (#818) 2018-07-19 14:27:33 +04:00
d18cc00033 more output 2018-07-15 15:26:02 +04:00