tpotce/docker/tpotinit/dist/bin/updateip.sh
t3chn0m4g3 1da37b5f85 re-implement distributed feature, without ssh
add sensor compose file
add distributed option to tpot config
housekeeping / cleanup
2024-01-05 20:19:50 +01:00

49 lines
1.5 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Let's add the first local ip to the /tmp/etc/issue and external ip to ews.ip file
# If the external IP cannot be detected, the internal IP will be inherited.
myUUID=$(cat /data/uuid)
myLOCALIP=$(ip address show | awk '/inet .*brd/{split($2,a,"/"); print a[1]; exit}')
myEXTIP=$(/opt/tpot/bin/myip.sh)
if [ "$myEXTIP" = "" ];
then
myEXTIP=$myLOCALIP
fi
myBLACKHOLE_STATUS=$(ip r | grep "blackhole" -c)
if [ "$myBLACKHOLE_STATUS" -gt "500" ];
then
myBLACKHOLE_STATUS="| BLACKHOLE: [ ENABLED ]"
else
myBLACKHOLE_STATUS="| BLACKHOLE: [ DISABLED ]"
fi
# Build issue
echo "" > /tmp/etc/issue
echo "T-Pot 23.12" >> /tmp/etc/issue
echo >> /tmp/etc/issue
echo ",---- [ \n ] [ \d ] [ \t ]" >> /tmp/etc/issue
echo "|" >> /tmp/etc/issue
echo "| IP: $myLOCALIP ($myEXTIP)" >> /tmp/etc/issue
echo "| SSH: ssh -l tsec -p 64295 $myLOCALIP" >> /tmp/etc/issue
#if [ "$myCHECKIFSENSOR" == "0" ];
# then
echo "| WEB: https://$myLOCALIP:64297" >> /tmp/etc/issue
#fi
echo "| ADMIN: https://$myLOCALIP:64294" >> /tmp/etc/issue
echo "$myBLACKHOLE_STATUS" >> /tmp/etc/issue
echo "|" >> /tmp/etc/issue
echo "\`----" >> /tmp/etc/issue
echo >> /tmp/etc/issue
tee /data/ews/conf/ews.ip << EOF
[MAIN]
ip = $myEXTIP
EOF
tee /data/tpot/etc/compose/elk_environment << EOF
HONEY_UUID=$myUUID
MY_EXTIP=$myEXTIP
MY_INTIP=$myLOCALIP
MY_HOSTNAME=$HOSTNAME
EOF
chown tpot:tpot /data/ews/conf/ews.ip
chmod 770 /data/ews/conf/ews.ip