-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·74 lines (61 loc) · 2.34 KB
/
start.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
67
68
69
70
71
72
73
74
#!/bin/bash
if [ "$EUID" == 0 ]; then
echo "Do not run as root"
exit 1
fi
if [ ! -f "./.env" ]; then
echo "Run ./setup.sh first"
exit 1
fi
#Get out of the scripts directory
if [ "$(basename "$(dirname "$PWD")")" = "scripts" ]; then
cd ..
fi
export COMPOSE_PROGRESS=plain
source ./.env
OLD_HOST_IP=$HOST_IP
# Honeypot Setup
echo -e "\nUpdating network settings"
NETWORK_INTERFACE=$(ip route | grep default | awk '{print $5}' | head -n 1)
HOST_IP=$(hostname -I | awk '{print $1}' | head -n 1)
GATEWAY=$(ip route | grep default | awk '{print $3}' | head -n 1)
NETWORK=$(echo "$GATEWAY" | cut -d '.' -f 1-3)
sed -i "s|^HOST_IP=.*|HOST_IP=$HOST_IP|" .env
sed -i "s|^NETWORK_INTERFACE=.*|NETWORK_INTERFACE=$NETWORK_INTERFACE|" .env
sed -i "s|^GATEWAY=.*|GATEWAY=$GATEWAY|" .env
sed -i "s|^NETWORK=.*|NETWORK=$NETWORK|" .env
#Update Grafana dashboard and default contact point
echo -e "\nUpdating Grafana dashboard"
cp ./config/grafana/dashboards/overview-dashboard.json.template ./config/grafana/dashboards/overview-dashboard.json
sed -i "s/\${NETWORK_INTERFACE}/${NETWORK_INTERFACE}/g" ./config/grafana/dashboards/overview-dashboard.json
sed -i "s/\${HOST_IP}/${HOST_IP}/g" ./config/grafana/dashboards/overview-dashboard.json
#Start
echo -e "\nStarting"
docker compose --profile apps up -d
#Generate home page
cp ./web/index.html.template ./web/index.html
# Check if plex claim token was set
if [ -n "$PLEX_CLAIM" ]; then
docker compose up plex -d
else
sed -i '/#video {/{N;s/display: block;/display: none;/}' ./web/index.html # Disable panel on homepage
fi
# Check if ./vpn.conf exists to run download managers
if [ "$ENABLE_DOWNLOADERS" = "1" ]; then
docker compose --profile downloaders up -d
else
sed -i '/#download_managers {/{N;s/display: block;/display: none;/}' ./web/index.html # Disable panel on homepage
fi
sed -i "s/\${INTERNAL_DOMAIN}/${INTERNAL_DOMAIN}/g" ./web/index.html
sed -i "s/\${EXTERNAL_DOMAIN}/${EXTERNAL_DOMAIN}/g" ./web/index.html
sed -i "s/\${HOST_IP}/${HOST_IP}/g" ./web/index.html
echo -e "\nIndex.html created"
if [ "$IN_SETUP" != "1" ]; then
# Show home page
echo -e "\nklack.cloud launched!"
if [ "$OLD_HOST_IP" != "$HOST_IP" ]; then
echo -e "\nCRITICAL: Host IP Changed. Change router port forwarding to ${HOST_IP}"
read -p "Press Enter to continue"
fi
echo -e "\nVisit your homepage at https://${EXTERNAL_DOMAIN}:4443"
fi