From 57aea7ef77ee6334dfeaa851e24534b4de283f0a Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 24 May 2023 22:22:11 +0400 Subject: [PATCH] Added gen-salt.sh to generate and get a SetCredentialEncrypted= to put in a systemd service. --- tools/gen-salt.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 tools/gen-salt.sh diff --git a/tools/gen-salt.sh b/tools/gen-salt.sh new file mode 100755 index 0000000..17e749e --- /dev/null +++ b/tools/gen-salt.sh @@ -0,0 +1,12 @@ +#!/usr/bin/sh + +if [[ $1 ]]; then + char_num=$1; +else + char_num=64; +fi + +cat /dev/urandom | tr -dc 'a-zA-Z0-9!@#$%^&*' | fold -w $char_num | head -n 1 | systemd-creds encrypt -p - /tmp/salt + +cat /tmp/salt +rm /tmp/salt \ No newline at end of file