mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-01 12:32:12 +00:00
Add SENSOR type to installer with info to deploy from HIVE.
This commit is contained in:
parent
4f41b84103
commit
a4262e9aae
1 changed files with 107 additions and 66 deletions
173
install.sh
173
install.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#/usr/bin/env bash
|
||||||
|
|
||||||
myINSTALL_NOTIFICATION="### Now installing required packages ..."
|
myINSTALL_NOTIFICATION="### Now installing required packages ..."
|
||||||
myUSER=$(whoami)
|
myUSER=$(whoami)
|
||||||
|
@ -162,73 +162,113 @@ if [ ! $? -eq 0 ];
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Preparing web user for T-Pot
|
# Ask for T-Pot Installation Type
|
||||||
echo
|
echo
|
||||||
echo "### T-Pot User Configuration ..."
|
echo "### Choose your T-Pot type:"
|
||||||
echo
|
echo "### (H)ive - T-Pot Standard / HIVE installation."
|
||||||
# Asking for web user name
|
echo "### Includes also everything you need for a distributed setup with sensors."
|
||||||
myWEB_USER=""
|
echo "### (S)ensor - T-Pot Sensor installation."
|
||||||
while [ 1 != 2 ];
|
echo "### Optimized for a distributed installation, without WebUI, Elasticsearch and Kibana."
|
||||||
do
|
while true; do
|
||||||
myOK=""
|
read -p "### Install Type? (h/s) " myTPOT_TYPE
|
||||||
read -rp "### Enter your web user name: " myWEB_USER
|
case "${myTPOT_TYPE}" in
|
||||||
myWEB_USER=$(echo $myWEB_USER | tr -cd "[:alnum:]_.-")
|
h|H)
|
||||||
echo "### Your username is: ${myWEB_USER}"
|
echo
|
||||||
while [[ ! "${myOK}" =~ [YyNn] ]];
|
echo "### Installing T-Pot Standard / HIVE installation."
|
||||||
do
|
myTPOT_TYPE="HIVE"
|
||||||
read -rp "### Is this correct? (y/n) " myOK
|
break ;;
|
||||||
done
|
s|S)
|
||||||
if [[ "${myOK}" =~ [Yy] ]] && [ "$myWEB_USER" != "" ];
|
echo
|
||||||
then
|
echo "### Installing T-Pot Sensor installation."
|
||||||
break
|
myTPOT_TYPE="SENSOR"
|
||||||
else
|
break ;;
|
||||||
echo
|
esac
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# 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}" == "" ]
|
|
||||||
do
|
|
||||||
read -rsp "### Enter password for your web user: " myWEB_PW
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
read -rsp "### Repeat password you your web user: " myWEB_PW2
|
|
||||||
echo
|
|
||||||
if [ "${myWEB_PW}" != "${myWEB_PW2}" ];
|
|
||||||
then
|
|
||||||
echo "### Passwords do not match."
|
|
||||||
myWEB_PW="pass1"
|
|
||||||
myWEB_PW2="pass2"
|
|
||||||
fi
|
|
||||||
mySECURE=$(printf "%s" "$myWEB_PW" | /usr/sbin/cracklib-check | grep -c "OK")
|
|
||||||
if [ "$mySECURE" == "0" ] && [ "$myWEB_PW" == "$myWEB_PW2" ];
|
|
||||||
then
|
|
||||||
while [[ ! "${myOK}" =~ [YyNn] ]];
|
|
||||||
do
|
|
||||||
read -rp "### Keep insecure password? (y/n) " myOK
|
|
||||||
done
|
|
||||||
if [[ "${myOK}" =~ [Nn] ]] || [ "$myWEB_PW" == "" ];
|
|
||||||
then
|
|
||||||
myWEB_PW="pass1"
|
|
||||||
myWEB_PW2="pass2"
|
|
||||||
mySECURE=0
|
|
||||||
myOK=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Write username and password to T-Pot config file
|
if [ "${myTPOT_TYPE}" == "HIVE" ];
|
||||||
echo "### Creating htpasswd username and password for T-Pot config file: ${myTPOT_CONF_FILE}"
|
# Install T-Pot Type HIVE and ask for WebUI username and password
|
||||||
myWEB_USER_ENC=$(htpasswd -b -n "${myWEB_USER}" "${myWEB_PW}")
|
then
|
||||||
echo
|
# Preparing web user for T-Pot
|
||||||
sed -i "s|^WEB_USER=.*|WEB_USER='${myWEB_USER_ENC}'|" ${myTPOT_CONF_FILE}
|
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
|
||||||
|
myWEB_USER=$(echo $myWEB_USER | tr -cd "[:alnum:]_.-")
|
||||||
|
echo "### Your username is: ${myWEB_USER}"
|
||||||
|
while [[ ! "${myOK}" =~ [YyNn] ]];
|
||||||
|
do
|
||||||
|
read -rp "### Is this correct? (y/n) " myOK
|
||||||
|
done
|
||||||
|
if [[ "${myOK}" =~ [Yy] ]] && [ "$myWEB_USER" != "" ];
|
||||||
|
then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 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}" == "" ]
|
||||||
|
do
|
||||||
|
read -rsp "### Enter password for your web user: " myWEB_PW
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
read -rsp "### Repeat password you your web user: " myWEB_PW2
|
||||||
|
echo
|
||||||
|
if [ "${myWEB_PW}" != "${myWEB_PW2}" ];
|
||||||
|
then
|
||||||
|
echo "### Passwords do not match."
|
||||||
|
myWEB_PW="pass1"
|
||||||
|
myWEB_PW2="pass2"
|
||||||
|
fi
|
||||||
|
mySECURE=$(printf "%s" "$myWEB_PW" | /usr/sbin/cracklib-check | grep -c "OK")
|
||||||
|
if [ "$mySECURE" == "0" ] && [ "$myWEB_PW" == "$myWEB_PW2" ];
|
||||||
|
then
|
||||||
|
while [[ ! "${myOK}" =~ [YyNn] ]];
|
||||||
|
do
|
||||||
|
read -rp "### Keep insecure password? (y/n) " myOK
|
||||||
|
done
|
||||||
|
if [[ "${myOK}" =~ [Nn] ]] || [ "$myWEB_PW" == "" ];
|
||||||
|
then
|
||||||
|
myWEB_PW="pass1"
|
||||||
|
myWEB_PW2="pass2"
|
||||||
|
mySECURE=0
|
||||||
|
myOK=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
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}
|
||||||
|
|
||||||
|
# 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
|
# Pull docker images
|
||||||
echo "### Now pulling images ..."
|
echo "### Now pulling images ..."
|
||||||
|
@ -244,5 +284,6 @@ sudo grc netstat -tulpen
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Done
|
# 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
|
echo
|
||||||
|
|
Loading…
Reference in a new issue