Skip to content

Instantly share code, notes, and snippets.

@saladinjake
Forked from clcollins/chnserver_deploy.sh
Created May 15, 2019 15:16
Show Gist options
  • Save saladinjake/562fc0964549e7cb29b5787d1fdd3b2c to your computer and use it in GitHub Desktop.
Save saladinjake/562fc0964549e7cb29b5787d1fdd3b2c to your computer and use it in GitHub Desktop.
CHN-Server Docker Compose file
#!/bin/bash
set -o errexit
set -o nounset
main () {
local mongo_repo="https://github.com/CommunityHoneyNetwork/mongodb.git"
local mongo_commit="c95ab34ba961b4e29b9973a7eec2d0133f15be5c"
local redis_repo="https://github.com/CommunityHoneyNetwork/redis.git"
local redis_commit="b7ad930a8d7a0296fb2fadf955e2a58c3aee73e4"
local hpfeeds_repo="https://github.com/CommunityHoneyNetwork/hpfeeds.git "
local hpfeeds_commit="e5841855e1a0bb67b4bab99d0541d2a5d188db13"
#local chnserver_repo="https://github.com/CommunityHoneyNetwork/CHN-Server.git"
#local chnserver_commit="93e6fe59d2e0fa3f16cbb4d07afb2faf9c179159"
# CHN-Server has commits in my fork not yet in staging
local chnserver_repo="https://github.com/clcollins/CHN-Server.git"
local chnserver_commit="c4952b8096bf81c2f57d613f2d42e0daf4e73305"
local docker_compose="https://gist.githubusercontent.com/clcollins/87c954704917a3830fa646466a11fa60/raw/92dd39e44d001ea7fe414a3aebcaf9cde84711c1/docker-compose.yml"
if [[ -e communityhoneynetwork ]]
then
echo "communityhoneynetwork already exists!"
exit 1
fi
mkdir communityhoneynetwork
pushd communityhoneynetwork
git clone $mongo_repo
pushd mongodb
git checkout $mongo_commit
popd
git clone $redis_repo
pushd redis
git checkout $redis_commit
popd
git clone $hpfeeds_repo
pushd hpfeeds
git checkout $hpfeeds_commit
popd
# Clone into a friendlier name
git clone $chnserver_repo chnserver
pushd chnserver
git checkout $chnserver_commit
popd
curl -sSL $docker_compose -o docker-compose.yml
if ! docker-compose -v
then
echo "docker-compose doesn't appear to be installed"
exit 1
fi
if ! docker info
then
echo "docker doesn't appear to be installed"
exit 1
fi
echo 'Running: docker-compose build'
docker-compose build
echo '--------------'
echo 'Images built; next steps:'
echo ' 1. start the stack'
echo ' 2. reset the admin@localhost password'
echo ' 3. retrieve the deploy key'
echo ''
echo ' cd communityhoneynetwork'
echo ' docker-compose up -d'
echo ' docker-compose exec chnserver python /opt/manual_password_reset.py'
echo ' docker-compose exec chnserver awk "/DEPLOY_KEY/ {print $3}" /opt/config.py'
echo ''
echo 'After the password is reset, visit 'http://localhost' and login with those credentials'
echo 'Save the deploy key for deploying honeypots'
}
main "$@"
#!/bin/bash
set -o errexit
set -o nounset
cowrie="https://github.com/CommunityHoneyNetwork/cowrie.git"
cowrie_commit="5e842fee56e0e3cfd9cc110d1bd8c3ae0ff2d63b"
if [[ ! -d cowrie ]]
then
git clone $cowrie
pushd cowrie
git checkout $cowrie_commit
else
pushd cowrie
git status
git checkout $cowrie_commit
fi
docker-compose build centos
echo "---------"
echo "Build complete"
echo "Next steps:"
echo " 1. cd cowrie"
echo " 2. edit cowrie.sysconfig:"
echo " 2a. enter your deploy key"
echo " 2b. change the FEEDS_SERVER to the public IP or hostname of your chnserver"
echo " 3. docker-compose up centos"
version: '2'
services:
mongodb:
build:
dockerfile: ./Dockerfile-centos
context: ./mongodb
image: mongodb:centos
ports:
- "127.0.0.1:27017:27017"
volumes:
- /srv/chn/db/centos:/var/lib/mongo:z
redis:
build:
dockerfile: ./Dockerfile-centos
context: ./redis
image: redis:centos
ports:
- "127.0.0.1:6379:6379"
volumes:
- /srv/chn/redis/centos:/var/lib/redis:z
hpfeeds:
build:
dockerfile: ./Dockerfile-centos
context: ./hpfeeds
image: hpfeeds:centos
links:
- mongodb:mongodb
ports:
- "10000:10000"
chnserver:
build:
dockerfile: ./Dockerfile-centos
context: ./chnserver
image: chnserver:centos
links:
- mongodb:mongodb
- redis:redis
- hpfeeds:hpfeeds
ports:
- "80:80"
- "127.0.0.1:443:443"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment