From e8fd022ce5efd2c1cf8c7b6ba0dfdc6b889b88b0 Mon Sep 17 00:00:00 2001 From: Raine Date: Wed, 6 Dec 2023 22:16:46 +0100 Subject: [PATCH] feat: changed skel check to use a sum of the structure! --- skel/etc/ixvd/skel-sum.txt | 1 + tools/repo/check.d/40-skel-sum.sh | 12 ++++++++++++ tools/repo/skel-sum-update.sh | 6 ++++++ tools/server-update.sh | 5 +++-- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 skel/etc/ixvd/skel-sum.txt create mode 100755 tools/repo/check.d/40-skel-sum.sh create mode 100755 tools/repo/skel-sum-update.sh diff --git a/skel/etc/ixvd/skel-sum.txt b/skel/etc/ixvd/skel-sum.txt new file mode 100644 index 0000000..47dacea --- /dev/null +++ b/skel/etc/ixvd/skel-sum.txt @@ -0,0 +1 @@ +059c7c3eb87d4a9bd30b70ba9016b875783b9206cbd44b4c2dc1bb8f59787127 - diff --git a/tools/repo/check.d/40-skel-sum.sh b/tools/repo/check.d/40-skel-sum.sh new file mode 100755 index 0000000..30e0842 --- /dev/null +++ b/tools/repo/check.d/40-skel-sum.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if ! [ -f "skel/etc/ixvd/skel-sum.txt" ]; then + echo "no skel sum!" + exit 1 +fi + +sum=$(find skel | sha256sum) +if ! [ "$(cat skel/etc/ixvd/skel-sum.txt)" = "$sum" ]; then + echo "skel sum does not match!" + exit 1 +fi \ No newline at end of file diff --git a/tools/repo/skel-sum-update.sh b/tools/repo/skel-sum-update.sh new file mode 100755 index 0000000..87b3369 --- /dev/null +++ b/tools/repo/skel-sum-update.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# creates sum of the directory STRUCTURE!! + +[ -f "skel/etc/ixvd/skel-sum.txt" ] || echo "none" > skel/etc/ixvd/skel-sum.txt +find skel | sha256sum > skel/etc/ixvd/skel-sum.txt diff --git a/tools/server-update.sh b/tools/server-update.sh index 1684ad0..ad569ee 100755 --- a/tools/server-update.sh +++ b/tools/server-update.sh @@ -13,8 +13,9 @@ fi git pull -[ -f "/etc/ixvd/version" ] && if ! [ "$(cat ./skel/etc/ixvd/version)" = "$(cat /etc/ixvd/version)" ]; then - echo "WARNING: IXVD SKELETON VERSION CHANGED!" +skelsum=$(find skel | sha256sum) +if ! [ "$(cat /etc/ixvd/skel-sum.txt)" = "$skelsum" ]; then + echo "WARNING: IXVD SERVER SKELETON CHANGED!" echo "WARNING: Manual intervention is required." exit 1 fi