-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·66 lines (52 loc) · 1.5 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# colored output helper functions
NC='\e[0m'
echoGreen() {
echo -n -e "\e[0;32m$1${NC}"
}
echoYellow() {
echo -n -e "\e[0;33m$1${NC}"
}
echoRed() {
echo -n -e "\e[0;31m$1${NC}"
}
getRmqPass() {
echoYellow "Create password for rabbitmq: "
read -s rmq_pass
echo ""
echoYellow "Confirm password for rabbitmq: "
read -s rmq_pass_confirm
echo ""
if [ "$rmq_pass" != "$rmq_pass_confirm" ]; then
echoRed "Passwords do not match, try again\n"
getRmqPass
fi
}
git_location="/home/hakan/parosReceiver"
# install rabbitmq server
echoGreen "Installing APT Prerequisites...\n"
apt-get update && apt-get -y upgrade
apt-get -y install erlang rabbitmq-server python3-pip
# enable and start rabbitmq server
echoGreen "Starting rabbitmq server...\n"
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
# enable rabbitmq management plugin
#rabbitmq-plugins enable rabbitmq_management
echoYellow "Pick a username for rabbitmq [paros]: "
read rmq_user
rmq_user=${rmq_user:-paros}
getRmqPass
rabbitmqctl add_user $rmq_user $rmq_pass
rabbitmqctl set_user_tags $rmq_user administrator
rabbitmqctl set_permissions -p / $rmq_user "." "." "."
echoGreen "Creating systemd files...\n"
cp $git_location/parosReceiver.service /etc/systemd/system/
systemctl daemon-reload
echoYellow "Should receiver be autostarted on boot (y/n)? "
read enable_logger
if [ "$enable_logger" = "y" ]; then
systemctl enable parosReceiver
else
systemctl disable parosReceiver
fi