-
Notifications
You must be signed in to change notification settings - Fork 786
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from guardicore/hotfix/deb-mongodb-req
Hotfix/deb mongodb req
- Loading branch information
Showing
12 changed files
with
117 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
MONKEY_FOLDER=/var/monkey | ||
INSTALLATION_FOLDER=/var/monkey/monkey_island/installation | ||
PYTHON_FOLDER=/var/monkey/monkey_island/bin/python | ||
|
||
# Prepare python virtualenv | ||
pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER | ||
virtualenv -p python2.7 ${PYTHON_FOLDER} | ||
|
||
# install pip requirements | ||
${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER | ||
|
||
# remove installation folder and unnecessary files | ||
rm -rf ${INSTALLATION_FOLDER} | ||
rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt | ||
|
||
${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb | ||
|
||
if [ -d "/etc/systemd/network" ]; then | ||
cp ${MONKEY_FOLDER}/monkey_island/service/systemd/*.service /lib/systemd/system/ | ||
chmod +x ${MONKEY_FOLDER}/monkey_island/service/systemd/start_server.sh | ||
systemctl daemon-reload | ||
systemctl enable monkey-mongo | ||
systemctl enable monkey-island | ||
fi | ||
|
||
${MONKEY_FOLDER}/monkey_island/create_certificate.sh | ||
|
||
service monkey-island start | ||
service monkey-mongo start | ||
|
||
echo Monkey Island installation ended | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
service monkey-island stop || true | ||
service monkey-mongo stop || true | ||
|
||
[ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service | ||
[ -f "/lib/systemd/system/monkey-mongo.service" ] && rm -f /lib/systemd/system/monkey-mongo.service | ||
|
||
rm -r -f /var/monkey | ||
|
||
exit 0 |
19 changes: 0 additions & 19 deletions
19
monkey/monkey_island/deb-package/monkey_island_pip_requirements.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
monkey/monkey_island/deb-package/service_mongo/systemd/monkey-island.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Monkey Island Service | ||
Wants=monkey-mongo.service | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/var/monkey/monkey_island/service/systemd/start_server.sh | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
12 changes: 12 additions & 0 deletions
12
monkey/monkey_island/deb-package/service_mongo/systemd/monkey-mongo.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Monkey Island Mongo Service | ||
After=network.target | ||
|
||
[Service] | ||
ExecStart=/var/monkey/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey/monkey_island/db | ||
KillMode=process | ||
Restart=always | ||
ExecStop=/var/monkey/monkey_island/bin/mongodb/bin/mongod --shutdown | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
export os_version_monkey=$(cat /etc/issue) | ||
MONGODB_DIR=$1 # If using deb, this should be: /var/monkey/monkey_island/bin/mongodb | ||
|
||
if [[ $os_version_monkey == "Ubuntu 16.04"* ]] ; | ||
then | ||
echo Detected Ubuntu 16.04 | ||
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.6.12.tgz" | ||
elif [[ $os_version_monkey == "Ubuntu 18.04"* ]] ; | ||
then | ||
echo Detected Ubuntu 18.04 | ||
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.8.tgz" | ||
elif [[ $os_version_monkey == "Debian GNU/Linux 8"* ]] ; | ||
then | ||
echo Detected Debian 8 | ||
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.12.tgz" | ||
elif [[ $os_version_monkey == "Debian GNU/Linux 9"* ]] ; | ||
then | ||
echo Detected Debian 9 | ||
export tgz_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-3.6.12.tgz" | ||
else | ||
echo Unsupported OS | ||
exit -1 | ||
fi | ||
|
||
TEMP_MONGO=$(mktemp -d) | ||
pushd $TEMP_MONGO | ||
wget $tgz_url -O mongodb.tgz | ||
tar -xf mongodb.tgz | ||
popd | ||
|
||
mkdir -p $MONGODB_DIR/bin | ||
cp $TEMP_MONGO/mongodb-*/bin/mongod $MONGODB_DIR/bin/mongod | ||
cp $TEMP_MONGO/mongodb-*/LICENSE-Community.txt $MONGODB_DIR/ | ||
chmod a+x $MONGODB_DIR/bin/mongod | ||
rm -r $TEMP_MONGO | ||
|
||
exit 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,6 @@ pycryptodome | |
boto3 | ||
awscli | ||
cffi | ||
PyInstaller | ||
PyInstaller | ||
virtualenv | ||
wheel |