From cb8933cddb70bee5a1f6b2ea0e63b12dbb22caf9 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:31:18 -0400 Subject: [PATCH 01/14] update update.sh, discriminate whether it is SENSOR or HIVE --- update.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/update.sh b/update.sh index f8fa4304..e8217cf5 100755 --- a/update.sh +++ b/update.sh @@ -53,6 +53,7 @@ function fuCHECKINET () { function fuSELFUPDATE () { echo echo "### Now checking for newer files in repository ..." + echo "### fuSELFUPDATE T-Pot (2)... TPOT_TYPE is set to: $myTPOT_TYPE" git fetch --all myREMOTESTAT=$(git status | grep -c "up-to-date") if [ "$myREMOTESTAT" != "0" ]; @@ -67,13 +68,24 @@ function fuSELFUPDATE () { echo "###### $myBLUE""Found newer version, will be pulling updates and restart myself.""$myWHITE" git reset --hard git pull --force - exec ./update.sh -y - exit 1 - else + # check if myTPOT_TYPE is set + if [ -z "$myTPOT_TYPE" ]; then + myTPOT_TYPE="HIVE" + exec ./update.sh -y $myTPOT_TYPE + else + exec ./update.sh -y $myTPOT_TYPE + fi + else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard git pull --force fi + if [! -z "$myTPOT_TYPE" ]; then + echo "### Setting T-Pot type to: $myTPOT_TYPE in .env" + grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env + fi + exit 1 + echo } @@ -194,6 +206,25 @@ function fuRESTORE () { sed -i "s/^TPOT_VERSION=.*/TPOT_VERSION=${newVERSION}/" $HOME/tpotce/.env } + +function fuREADTPOT_TYPE () { + if [ -f .env ]; then + # reads the TPOT_TYPE from the .env file + myTPOT_TYPE=$(grep -E '^TPOT_TYPE=' .env | cut -d '=' -f2) + # Verify if TPOT_TYPE is set + if [ -z "$myTPOT_TYPE" ]; then + echo "### TPOT_TYPE not set in .env file. Defaulting to HIVE." + myTPOT_TYPE="HIVE" + fi + echo "### T-Pot type is set to: $myTPOT_TYPE" + else + echo "### No .env file found. Unable to determine T-Pot type." + echo "### Please ensure you are running this script from the tpotce directory." + echo "### Defaulting to HIVE." + myTPOT_TYPE="HIVE" + fi +} + ################ # Main section # ################ @@ -211,13 +242,28 @@ if [ "$1" != "-y" ]; then exit fi +# if exists second argument, use it as T-Pot type, only if SENSOR or HIVE +if [ -n "$2" ]; then + if [[ "$2" == "SENSOR" || "$2" == "HIVE" ]]; then + echo "### Setting T-Pot type to: $2" + # Set the T-Pot type + myTPOT_TYPE="$2" + else + echo "Invalid T-Pot type specified. Please use 'SENSOR' or 'HIVE'." + exit 1 + fi +else + myTPOT_TYPE="HIVE" +fi + +fuREADTPOT_TYPE fuCHECK_VERSION fuCHECKINET "https://index.docker.io https://github.com" -fuSTOP_TPOT -fuBACKUP -fuSELFUPDATE "$0" "$@" -fuUPDATER -fuRESTORE +#fuSTOP_TPOT +#fuBACKUP +fuSELFUPDATE "$0" "$@" "$myTPOT_TYPE" +#fuUPDATER +#fuRESTORE echo echo "### Done. You can now start T-Pot using 'systemctl start tpot' or 'docker compose up -d'." From d94207e56e900f9877e2af0ba4607cb5857d2e48 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:33:09 -0400 Subject: [PATCH 02/14] update update.sh, discriminate whether it is SENSOR or HIVE --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index e8217cf5..9e4069fa 100755 --- a/update.sh +++ b/update.sh @@ -81,7 +81,7 @@ function fuSELFUPDATE () { git pull --force fi if [! -z "$myTPOT_TYPE" ]; then - echo "### Setting T-Pot type to: $myTPOT_TYPE in .env" + echo "### Setting T-Pot type to: $myTPOT_TYPE" grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env fi exit 1 From c2748f9904b2494f64c1921bf7cc45b52062878e Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:37:00 -0400 Subject: [PATCH 03/14] momentarily changes the fork branch --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 9e4069fa..328cf65a 100755 --- a/update.sh +++ b/update.sh @@ -78,7 +78,7 @@ function fuSELFUPDATE () { else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard - git pull --force + git pull origin update --force fi if [! -z "$myTPOT_TYPE" ]; then echo "### Setting T-Pot type to: $myTPOT_TYPE" From 5e333eba5911fdf76d48a8edc7c89933b1267183 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:39:02 -0400 Subject: [PATCH 04/14] momentarily changes the fork branch --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 328cf65a..411e8583 100755 --- a/update.sh +++ b/update.sh @@ -62,7 +62,7 @@ function fuSELFUPDATE () { return fi ### DEV - myRESULT=$(git diff --name-only origin/master | grep "^update.sh") + myRESULT=$(git diff --name-only origin/update | grep "^update.sh") if [ "$myRESULT" == "update.sh" ]; then echo "###### $myBLUE""Found newer version, will be pulling updates and restart myself.""$myWHITE" From a7af16f69a1d9f4998b2fd13bb79561611f716f1 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:41:20 -0400 Subject: [PATCH 05/14] momentarily changes the fork branch --- update.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/update.sh b/update.sh index 411e8583..fd6a5f29 100755 --- a/update.sh +++ b/update.sh @@ -70,20 +70,17 @@ function fuSELFUPDATE () { git pull --force # check if myTPOT_TYPE is set if [ -z "$myTPOT_TYPE" ]; then - myTPOT_TYPE="HIVE" - exec ./update.sh -y $myTPOT_TYPE + exec ./update.sh else exec ./update.sh -y $myTPOT_TYPE + grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env + echo "### T-Pot type set to: $myTPOT_TYPE in .env" fi else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard git pull origin update --force fi - if [! -z "$myTPOT_TYPE" ]; then - echo "### Setting T-Pot type to: $myTPOT_TYPE" - grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env - fi exit 1 echo From 82147ba4bd39189a2f633f6156bd81e9b9abf8d7 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:44:57 -0400 Subject: [PATCH 06/14] update --- update.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/update.sh b/update.sh index fd6a5f29..4bf8cddc 100755 --- a/update.sh +++ b/update.sh @@ -210,14 +210,9 @@ function fuREADTPOT_TYPE () { myTPOT_TYPE=$(grep -E '^TPOT_TYPE=' .env | cut -d '=' -f2) # Verify if TPOT_TYPE is set if [ -z "$myTPOT_TYPE" ]; then - echo "### TPOT_TYPE not set in .env file. Defaulting to HIVE." myTPOT_TYPE="HIVE" fi - echo "### T-Pot type is set to: $myTPOT_TYPE" else - echo "### No .env file found. Unable to determine T-Pot type." - echo "### Please ensure you are running this script from the tpotce directory." - echo "### Defaulting to HIVE." myTPOT_TYPE="HIVE" fi } @@ -242,12 +237,9 @@ fi # if exists second argument, use it as T-Pot type, only if SENSOR or HIVE if [ -n "$2" ]; then if [[ "$2" == "SENSOR" || "$2" == "HIVE" ]]; then - echo "### Setting T-Pot type to: $2" - # Set the T-Pot type myTPOT_TYPE="$2" else - echo "Invalid T-Pot type specified. Please use 'SENSOR' or 'HIVE'." - exit 1 + myTPOT_TYPE="HIVE" fi else myTPOT_TYPE="HIVE" From 99abefe98ee635a13ead1e7490ae32b7a19aee0a Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:51:47 -0400 Subject: [PATCH 07/14] update --- update.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index 4bf8cddc..44b1be17 100755 --- a/update.sh +++ b/update.sh @@ -73,14 +73,21 @@ function fuSELFUPDATE () { exec ./update.sh else exec ./update.sh -y $myTPOT_TYPE - grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env - echo "### T-Pot type set to: $myTPOT_TYPE in .env" fi else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard git pull origin update --force fi + + if [ -z "$myTPOT_TYPE" ]; then + echo "### TPOT_TYPE not set in .env file. Defaulting to HIVE." + else + grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env + echo "### T-Pot type set to: $myTPOT_TYPE in .env" + fi + + exit 1 echo @@ -203,7 +210,6 @@ function fuRESTORE () { sed -i "s/^TPOT_VERSION=.*/TPOT_VERSION=${newVERSION}/" $HOME/tpotce/.env } - function fuREADTPOT_TYPE () { if [ -f .env ]; then # reads the TPOT_TYPE from the .env file From 78acb5f5c0606b50353569bafc84d097c3460257 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:52:11 -0400 Subject: [PATCH 08/14] update --- update.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 44b1be17..64d0011c 100755 --- a/update.sh +++ b/update.sh @@ -79,15 +79,12 @@ function fuSELFUPDATE () { git reset --hard git pull origin update --force fi - if [ -z "$myTPOT_TYPE" ]; then - echo "### TPOT_TYPE not set in .env file. Defaulting to HIVE." + echo else grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env echo "### T-Pot type set to: $myTPOT_TYPE in .env" fi - - exit 1 echo From f609e20567931e2c343be7cbf2d131cde0aa4069 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 20:58:46 -0400 Subject: [PATCH 09/14] update --- .env | 2 +- update.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env b/.env index fd39580d..f6cecc99 100644 --- a/.env +++ b/.env @@ -60,7 +60,7 @@ TPOT_PERSISTENCE_CYCLES=30 # 4. On SENSOR: Provide username / password from (3) for TPOT_HIVE_USER as base64 encoded string: # "echo -n 'username:password' | base64 -w0" # MOBILE: This will set the correct type for T-Pot Mobile (https://github.com/telekom-security/tpotmobile) -TPOT_TYPE=HIVE +TPOT_TYPE=SENSOR # T-Pot Hive User (only relevant for SENSOR deployment) # : This is empty by default. diff --git a/update.sh b/update.sh index 64d0011c..91a3186f 100755 --- a/update.sh +++ b/update.sh @@ -53,7 +53,7 @@ function fuCHECKINET () { function fuSELFUPDATE () { echo echo "### Now checking for newer files in repository ..." - echo "### fuSELFUPDATE T-Pot (2)... TPOT_TYPE is set to: $myTPOT_TYPE" + echo "### fuSELFUPDATE T-Pot... TPOT_TYPE is set to: $myTPOT_TYPE" git fetch --all myREMOTESTAT=$(git status | grep -c "up-to-date") if [ "$myREMOTESTAT" != "0" ]; @@ -84,6 +84,12 @@ function fuSELFUPDATE () { else grep -q "^TPOT_TYPE=" .env && sed -i "s/^TPOT_TYPE=.*/TPOT_TYPE=${myTPOT_TYPE}/" .env echo "### T-Pot type set to: $myTPOT_TYPE in .env" + if [ "$myTPOT_TYPE" == "SENSOR" ]; then + echo "### Copying compose/sensor.yml to docker-compose.yml" + cp compose/sensor.yml docker-compose.yml + else + echo "### No docker-compose-sensor.yml found, using default docker-compose.yml" + fi fi exit 1 From 87733c6b65205ace6ca04049fa497cb4e6c961f1 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 21:00:06 -0400 Subject: [PATCH 10/14] update --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index f6cecc99..fd39580d 100644 --- a/.env +++ b/.env @@ -60,7 +60,7 @@ TPOT_PERSISTENCE_CYCLES=30 # 4. On SENSOR: Provide username / password from (3) for TPOT_HIVE_USER as base64 encoded string: # "echo -n 'username:password' | base64 -w0" # MOBILE: This will set the correct type for T-Pot Mobile (https://github.com/telekom-security/tpotmobile) -TPOT_TYPE=SENSOR +TPOT_TYPE=HIVE # T-Pot Hive User (only relevant for SENSOR deployment) # : This is empty by default. From 59c6672df74d10d2237856dae89ec6258653b37a Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 21:03:48 -0400 Subject: [PATCH 11/14] update, refactory to master --- update.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/update.sh b/update.sh index 91a3186f..5ede62ea 100755 --- a/update.sh +++ b/update.sh @@ -53,7 +53,7 @@ function fuCHECKINET () { function fuSELFUPDATE () { echo echo "### Now checking for newer files in repository ..." - echo "### fuSELFUPDATE T-Pot... TPOT_TYPE is set to: $myTPOT_TYPE" + echo "### T-Pot... TPOT_TYPE is set to: $myTPOT_TYPE" git fetch --all myREMOTESTAT=$(git status | grep -c "up-to-date") if [ "$myREMOTESTAT" != "0" ]; @@ -62,7 +62,7 @@ function fuSELFUPDATE () { return fi ### DEV - myRESULT=$(git diff --name-only origin/update | grep "^update.sh") + myRESULT=$(git diff --name-only origin/master | grep "^update.sh") if [ "$myRESULT" == "update.sh" ]; then echo "###### $myBLUE""Found newer version, will be pulling updates and restart myself.""$myWHITE" @@ -77,7 +77,7 @@ function fuSELFUPDATE () { else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard - git pull origin update --force + git pull origin --force fi if [ -z "$myTPOT_TYPE" ]; then echo @@ -88,7 +88,7 @@ function fuSELFUPDATE () { echo "### Copying compose/sensor.yml to docker-compose.yml" cp compose/sensor.yml docker-compose.yml else - echo "### No docker-compose-sensor.yml found, using default docker-compose.yml" + echo fi fi exit 1 @@ -257,11 +257,11 @@ fi fuREADTPOT_TYPE fuCHECK_VERSION fuCHECKINET "https://index.docker.io https://github.com" -#fuSTOP_TPOT -#fuBACKUP +fuSTOP_TPOT +fuBACKUP fuSELFUPDATE "$0" "$@" "$myTPOT_TYPE" -#fuUPDATER -#fuRESTORE +fuUPDATER +fuRESTORE echo echo "### Done. You can now start T-Pot using 'systemctl start tpot' or 'docker compose up -d'." From 444b181075d4c353d8983ac21d216ba6f9452e6c Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 21:21:44 -0400 Subject: [PATCH 12/14] update, refactory to master --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 5ede62ea..904d148d 100755 --- a/update.sh +++ b/update.sh @@ -77,7 +77,7 @@ function fuSELFUPDATE () { else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" git reset --hard - git pull origin --force + git pull --force fi if [ -z "$myTPOT_TYPE" ]; then echo From c38fab7670b4a73e76289917909a1c7e0573032c Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 21:22:27 -0400 Subject: [PATCH 13/14] update, refactory to master --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 904d148d..1323ef18 100755 --- a/update.sh +++ b/update.sh @@ -72,7 +72,7 @@ function fuSELFUPDATE () { if [ -z "$myTPOT_TYPE" ]; then exec ./update.sh else - exec ./update.sh -y $myTPOT_TYPE + exec ./update.sh -y $myTPOT_TYPE fi else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" From cbcf7871ec7c18940b9274c40408970e16f30eb2 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Sat, 12 Jul 2025 21:23:12 -0400 Subject: [PATCH 14/14] update, refactory to master --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 1323ef18..20787740 100755 --- a/update.sh +++ b/update.sh @@ -72,7 +72,7 @@ function fuSELFUPDATE () { if [ -z "$myTPOT_TYPE" ]; then exec ./update.sh else - exec ./update.sh -y $myTPOT_TYPE + exec ./update.sh -y $myTPOT_TYPE fi else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE"