From f75c1078052ba575256b98481e3f2be95e359de1 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 24 Jun 2019 15:28:46 +0200 Subject: [PATCH 1/5] Clarified updated from pulling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98c50dc..3e2f413 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Traceback (most recent call last): with open(dst, 'wb') as fdst: OSError: [Errno 26] Text file busy: '/home/steve/code/misp-dashboard/DASHENV/bin/python3' ``` -- Restart the System: `./zmq_subscriber.py &`, `./zmq_dispatcher.py &` and `./server.py &` +- Restart the System: `./start_all.sh` **OR** `./start_zmq.sh` and `./server.py &` # Starting the System :warning: You should not run it as root. Normal privileges are fine. From 1ccf8334285876e433edd3f21d07a552a7c93ff8 Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Mon, 1 Jul 2019 15:15:00 +0900 Subject: [PATCH 2/5] fix: [installer] Make it work on RHEL/CentOS --- install_dependencies.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 2b55dc6..ac79f47 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -6,13 +6,34 @@ ## Debug mode #set -x +# Functions + +get_distribution() { + lsb_dist="" + # Every system that we officially support has /etc/os-release + if [ -r /etc/os-release ]; then + lsb_dist="$(. /etc/os-release && echo "$ID")" + fi + # Returning an empty string here should be alright since the + # case statements don't act unless you provide an actual value + echo "$lsb_dist" | tr '[:upper:]' '[:lower:]' +} + sudo chmod -R g+w . if ! id zmqs >/dev/null 2>&1; then - # Create zmq user - sudo useradd -U -G www-data -m -s /bin/bash zmqs - # Adds right to www-data to run ./start-zmq as zmq - sudo echo "www-data ALL=(zmqs) NOPASSWD:/bin/bash /var/www/misp-dashboard/start_zmq.sh" > /etc/sudoers.d/www-data + + if [ "$(get_distribution)" == "rhel" ]; then + # Create zmq user + sudo useradd -U -G apache -m -s /usr/bin/bash zmqs + # Adds right to www-data to run ./start-zmq as zmq + echo "apache ALL=(zmqs) NOPASSWD:/bin/bash /var/www/misp-dashboard/start_zmq.sh" |sudo tee /etc/sudoers.d/apache + else + # Create zmq user + sudo useradd -U -G www-data -m -s /bin/bash zmqs + # Adds right to www-data to run ./start-zmq as zmq + echo "www-data ALL=(zmqs) NOPASSWD:/bin/bash /var/www/misp-dashboard/start_zmq.sh" |sudo tee /etc/sudoers.d/www-data + fi fi sudo apt-get install python3-virtualenv virtualenv screen redis-server unzip -y From 4715f0ec29c325af35b64f6056e567d2ccd2804e Mon Sep 17 00:00:00 2001 From: Kortho Date: Tue, 2 Jul 2019 08:43:18 +0200 Subject: [PATCH 3/5] removed hard-coded zmq startup It was hard coded to run as a specific user and a hard coded location of script --- start_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start_all.sh b/start_all.sh index 66b5a36..7d6d255 100755 --- a/start_all.sh +++ b/start_all.sh @@ -69,4 +69,4 @@ else fi sleep 0.1 -sudo -u zmqs /bin/bash /var/www/misp-dashboard/start_zmq.sh & +/bin/bash ./start_zmq.sh & From 71fc511c61f46a712b951dfec125349ccdbbb7da Mon Sep 17 00:00:00 2001 From: Kortho Date: Tue, 2 Jul 2019 09:14:35 +0200 Subject: [PATCH 4/5] added net-tools to debian-based install command needed to run the netstat command --- install_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index ac79f47..77742a2 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -36,7 +36,7 @@ if ! id zmqs >/dev/null 2>&1; then fi fi -sudo apt-get install python3-virtualenv virtualenv screen redis-server unzip -y +sudo apt-get install python3-virtualenv virtualenv screen redis-server unzip net-tools -y if [ -z "$VIRTUAL_ENV" ]; then virtualenv -p python3 DASHENV ; DASH_VENV=$? From 9d1b488399ba2ee9d56608f9b0bda1a863ee1a9c Mon Sep 17 00:00:00 2001 From: Kortho Date: Tue, 2 Jul 2019 11:57:46 +0200 Subject: [PATCH 5/5] added user zmqs back --- start_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start_all.sh b/start_all.sh index 7d6d255..a9b7c89 100755 --- a/start_all.sh +++ b/start_all.sh @@ -69,4 +69,4 @@ else fi sleep 0.1 -/bin/bash ./start_zmq.sh & +sudo -u zmqs /bin/bash ${DIR}/start_zmq.sh &