Add SENSOR type to installer with info to deploy from HIVE.

This commit is contained in:
Marco Ochse 2024-02-21 16:20:18 +01:00
parent 4f41b84103
commit a4262e9aae

View file

@ -1,4 +1,4 @@
#!/bin/bash
#/usr/bin/env bash
myINSTALL_NOTIFICATION="### Now installing required packages ..."
myUSER=$(whoami)
@ -162,13 +162,39 @@ if [ ! $? -eq 0 ];
echo
fi
# Preparing web user for T-Pot
# Ask for T-Pot Installation Type
echo
echo "### T-Pot User Configuration ..."
echo
# Asking for web user name
myWEB_USER=""
while [ 1 != 2 ];
echo "### Choose your T-Pot type:"
echo "### (H)ive - T-Pot Standard / HIVE installation."
echo "### Includes also everything you need for a distributed setup with sensors."
echo "### (S)ensor - T-Pot Sensor installation."
echo "### Optimized for a distributed installation, without WebUI, Elasticsearch and Kibana."
while true; do
read -p "### Install Type? (h/s) " myTPOT_TYPE
case "${myTPOT_TYPE}" in
h|H)
echo
echo "### Installing T-Pot Standard / HIVE installation."
myTPOT_TYPE="HIVE"
break ;;
s|S)
echo
echo "### Installing T-Pot Sensor installation."
myTPOT_TYPE="SENSOR"
break ;;
esac
done
if [ "${myTPOT_TYPE}" == "HIVE" ];
# Install T-Pot Type HIVE and ask for WebUI username and password
then
# Preparing web user for T-Pot
echo
echo "### T-Pot User Configuration ..."
echo
# Asking for web user name
myWEB_USER=""
while [ 1 != 2 ];
do
myOK=""
read -rp "### Enter your web user name: " myWEB_USER
@ -186,12 +212,12 @@ while [ 1 != 2 ];
fi
done
# Asking for web user password
myWEB_PW="pass1"
myWEB_PW2="pass2"
mySECURE=0
myOK=""
while [ "${myWEB_PW}" != "${myWEB_PW2}" ] && [ "${mySECURE}" == "0" ]
# Asking for web user password
myWEB_PW="pass1"
myWEB_PW2="pass2"
mySECURE=0
myOK=""
while [ "${myWEB_PW}" != "${myWEB_PW2}" ] && [ "${mySECURE}" == "0" ]
do
echo
while [ "${myWEB_PW}" == "pass1" ] || [ "${myWEB_PW}" == "" ]
@ -222,13 +248,27 @@ while [ "${myWEB_PW}" != "${myWEB_PW2}" ] && [ "${mySECURE}" == "0" ]
myOK=""
fi
fi
done
done
# Write username and password to T-Pot config file
echo "### Creating htpasswd username and password for T-Pot config file: ${myTPOT_CONF_FILE}"
myWEB_USER_ENC=$(htpasswd -b -n "${myWEB_USER}" "${myWEB_PW}")
echo
sed -i "s|^WEB_USER=.*|WEB_USER='${myWEB_USER_ENC}'|" ${myTPOT_CONF_FILE}
# Write username and password to T-Pot config file
echo "### Creating htpasswd username and password for T-Pot config file: ${myTPOT_CONF_FILE}"
myWEB_USER_ENC=$(htpasswd -b -n "${myWEB_USER}" "${myWEB_PW}")
echo
sed -i "s|^WEB_USER=.*|WEB_USER='${myWEB_USER_ENC}'|" ${myTPOT_CONF_FILE}
# Install T-Pot Type HIVE and use standard.yml for installation
cp ${HOME}/tpotce/compose/standard.yml ${HOME}/tpotce/docker-compose.yml
myINFO=""
fi
if [ "${myTPOT_TYPE}" == "SENSOR" ];
# Install T-Pot Type SENSOR and use sensor.yml for installation
then
cp ${HOME}/tpotce/compose/sensor.yml ${HOME}/tpotce/docker-compose.yml
myINFO="### Make sure to deploy SSH keys to this sensor and disable SSH password authentication.
### On hive run the tpotce/tools/deploy.sh script to join this sensor to the hive."
fi
# Pull docker images
echo "### Now pulling images ..."
@ -244,5 +284,6 @@ sudo grc netstat -tulpen
echo
# Done
echo "Done. Please reboot and re-connect via SSH on tcp/64295."
echo "### Done. Please reboot and re-connect via SSH on tcp/64295."
echo "${myINFO}"
echo