From c49bd6ebd986acebf03b4ce80052da0a5406b193 Mon Sep 17 00:00:00 2001 From: Marek Miklewicz Date: Sat, 18 Nov 2023 12:40:06 +0100 Subject: [PATCH] Update dapostinstall.sh --- dapostinstall.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dapostinstall.sh b/dapostinstall.sh index ce6b936..5f4934f 100755 --- a/dapostinstall.sh +++ b/dapostinstall.sh @@ -22,7 +22,7 @@ sed -i '/PermitRootLogin yes/s/^#//g' /etc/ssh/sshd_config sed -i "s/PermitRootLogin yes/PermitRootLogin without-password/g" /etc/ssh/sshd_config echo "Poprawa locale" -dnf install -y glibc-all-langpacks langpacks-pl glibc-langpack-pl +dnf install -y glibc-all-langpacks langpacks-pl glibc-langpack-pl shuf localectl set-locale LANG=pl_PL.utf8 echo "Tworzenie domyslnego pakietu" @@ -348,21 +348,23 @@ chmod 755 da_cli.sh echo "Generowanie hasla DirectAdmin" -min_length=12 +echo "Generowanie hasla DirectAdmin" + +min_length=1 max_length=24 +special_chars='-._' DA_ADMINPASS=$( while true; do base_part=$(tr -dc '[:alnum:]' < /dev/urandom | fold -w "$((RANDOM % (max_length - min_length - 1) + min_length - 1))" | head -n 1) - special_chars=$(tr -dc '-.,_' < /dev/urandom | fold -w "$((RANDOM % 3 + 1))" | head -n 1) - password="${base_part:0:1}${special_chars}${base_part:1}" + special_part=$(echo $special_chars | fold -w1 | shuf | head -n "$((RANDOM % 3 + 1))" | tr -d '\n') + password="${base_part:0:1}${special_part}${base_part:1}" if echo "$password" | grep -qE '[[:digit:]]' && echo "$password" | grep -qE '[[:upper:]]' && echo "$password" | grep -qE '[-.,_]'; then + echo "$password" break fi done - - echo $password ) DA_OPTIONSCONF=$CBDIR/options.conf