Update dapostinstall.sh

This commit is contained in:
Marek Miklewicz
2023-11-18 12:40:06 +01:00
parent 05a495e9b9
commit c49bd6ebd9
+8 -6
View File
@@ -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