Skip to content

Commit

Permalink
update openssl rand password generation routines in 123.09beta01
Browse files Browse the repository at this point in the history
- correct the openssl rand syntax so it works with either openssl 1.0.x or 1.1.1 as previous syntax and positioning of arguments only worked with openssl 1.0.x and not openssl 1.1.1
  • Loading branch information
centminmod committed Dec 25, 2021
1 parent 0d24209 commit 134b253
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions addons/linfo.sh
Expand Up @@ -115,9 +115,9 @@ rm -rf ${LINFOPATH}/config.inc.php
###########################################
passp() {

CSALT=$(/usr/bin/openssl rand 6 -base64 | tr -dc 'a-zA-Z0-9')
CSALT=$(/usr/bin/openssl rand -base64 7 | tr -dc 'a-zA-Z0-9')
CUSER=$(echo "admin${CSALT}")
CPASS=$(/usr/bin/openssl rand 19 -base64 | tr -dc 'a-zA-Z0-9')
CPASS=$(/usr/bin/openssl rand -base64 21 | tr -dc 'a-zA-Z0-9')

if [[ "$(hostname -f 2>&1 | grep -w 'Unknown host')" || "$(hostname -f 2>&1 | grep -w 'service not known')" ]]; then
hname=$(hostname)
Expand Down
2 changes: 1 addition & 1 deletion centmin-cli.sh
Expand Up @@ -27,7 +27,7 @@ DT=$(date +"%d%m%y-%H%M%S")
branchname='123.09beta01'
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MINORVER='09'
SCRIPT_INCREMENTVER='773'
SCRIPT_INCREMENTVER='774'
SCRIPT_VERSIONSHORT="${branchname}"
SCRIPT_VERSION="${SCRIPT_VERSIONSHORT}.b${SCRIPT_INCREMENTVER}"
SCRIPT_DATE='24/12/2021'
Expand Down
2 changes: 1 addition & 1 deletion centmin.sh
Expand Up @@ -27,7 +27,7 @@ DT=$(date +"%d%m%y-%H%M%S")
branchname='123.09beta01'
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MINORVER='09'
SCRIPT_INCREMENTVER='773'
SCRIPT_INCREMENTVER='774'
SCRIPT_VERSIONSHORT="${branchname}"
SCRIPT_VERSION="${SCRIPT_VERSIONSHORT}.b${SCRIPT_INCREMENTVER}"
SCRIPT_DATE='24/12/2021'
Expand Down
2 changes: 1 addition & 1 deletion inc/mariadb_submenu.inc
Expand Up @@ -124,7 +124,7 @@ if [[ "$mysqlroot_reset" = [yY] ]]; then
mysqld --skip-grant-tables --skip-networking --user=mysql &
mysql -e "FLUSH PRIVILEGES;"
fi
NEWMYSQLROOTPASS=$(/usr/bin/openssl rand 21 -base64 | tr -dc 'a-zA-Z0-9')
NEWMYSQLROOTPASS=$(/usr/bin/openssl rand -base64 24 | tr -dc 'a-zA-Z0-9')
echo "mysqladmin -u root -p${OLDMYSQLROOTPASS} password $NEWMYSQLROOTPASS"
mysqladmin -u root -p${OLDMYSQLROOTPASS} password $NEWMYSQLROOTPASS
echo
Expand Down
4 changes: 2 additions & 2 deletions inc/memcacheadmin.inc
Expand Up @@ -54,9 +54,9 @@ sed -i "s/mymemcache-server2:11211/localhost:11212/g" /usr/local/nginx/html/memc

fi

CSALT=$(/usr/bin/openssl rand 8 -base64 | tr -dc 'a-zA-Z0-9')
CSALT=$(/usr/bin/openssl rand -base64 10 | tr -dc 'a-zA-Z0-9')
memcacheduser=$(echo "memadmin${CSALT}")
memcachedpassword=$(/usr/bin/openssl rand 19 -base64 | tr -dc 'a-zA-Z0-9')
memcachedpassword=$(/usr/bin/openssl rand -base64 21 | tr -dc 'a-zA-Z0-9')
echo ""

cecho "Setup Memcached Server Admin Login Details for /usr/local/nginx/html/memcache_${N}.php" $boldgreen
Expand Down
2 changes: 1 addition & 1 deletion inc/mysqlsecure.inc
@@ -1,5 +1,5 @@
securemysql() {
THEMYSQLPASS=$(/usr/bin/openssl rand 21 -base64 | tr -dc 'a-zA-Z0-9')
THEMYSQLPASS=$(/usr/bin/openssl rand -base64 24 | tr -dc 'a-zA-Z0-9')

# mysql -e "DELETE FROM mysql.user WHERE User=""; FLUSH PRIVILEGES;"
# mysqladmin -u root password $THEMYSQLPASS
Expand Down
4 changes: 2 additions & 2 deletions inc/phpinfo.inc
Expand Up @@ -3,9 +3,9 @@ phpiadmin() {
# Randomize phpi.php filename
NPHP=$(od -vAn -N4 -tx < /dev/urandom)
NPHP=$(echo ${NPHP} | sed -e 's/\s//')
PHPISALT=$(/usr/bin/openssl rand 11 -base64 | tr -dc 'a-zA-Z0-9')
PHPISALT=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
PHPIUSER=$(echo "phpiadmin${PHPISALT}")
PHPIPASS=$(/usr/bin/openssl rand 19 -base64 | tr -dc 'a-zA-Z0-9')
PHPIPASS=$(/usr/bin/openssl rand -base64 21 | tr -dc 'a-zA-Z0-9')
echo ""
mv /usr/local/nginx/html/phpi.php "/usr/local/nginx/html/${NPHP}_phpi.php"
# cecho "Insert Username/Password into /usr/local/nginx/html/${NPHP}_phpi.php file itself" $boldyellow
Expand Down
10 changes: 5 additions & 5 deletions inc/wpsetup-fastcgi-cache.inc
Expand Up @@ -146,7 +146,7 @@ fc_installredisserver() {
}

fc_dbsetup() {
SALT=$(/usr/bin/openssl rand 12 -base64 | tr -dc 'a-zA-Z0-9')
SALT=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
DBN=$RANDOM
DBNB=$RANDOM
DBNC=$RANDOM
Expand Down Expand Up @@ -445,8 +445,8 @@ elif [[ "$SECOND_IP" ]]; then
fi
fc_wpinstall
WPSALT=$(/usr/bin/openssl rand 19 -base64 | tr -dc 'a-zA-Z0-9')
WPSALTB=$(/usr/bin/openssl rand 11 -base64 | tr -dc 'a-zA-Z0-9')
WPSALT=$(/usr/bin/openssl rand -base64 21 | tr -dc 'a-zA-Z0-9')
WPSALTB=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
WPN=$RANDOM
WPNB=$RANDOM
WPADMINUSER="z${WPSALT}wp${WPNB}"
Expand Down Expand Up @@ -852,8 +852,8 @@ find "/home/nginx/domains/$vhostname" -type d -exec chmod g+s {} \;
if [[ "$disablepwdprotect" != [yY] ]]; then
# wp-login.php password protection
if [[ -f /usr/local/nginx/conf/htpasswd.sh && ! -f /home/nginx/domains/$vhostname/htpasswd_wplogin ]]; then
HTWPLOGINSALT=$(/usr/bin/openssl rand 14 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand 20 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALT=$(/usr/bin/openssl rand -base64 16 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')
HTWPLOGIN=$RANDOM
HTWPLOGINB=$RANDOM
HTUSER="u${HTWPLOGINSALT}x${HTWPLOGIN}"
Expand Down
10 changes: 5 additions & 5 deletions inc/wpsetup.inc
Expand Up @@ -53,7 +53,7 @@ installredisserver() {
}

dbsetup() {
SALT=$(/usr/bin/openssl rand 12 -base64 | tr -dc 'a-zA-Z0-9')
SALT=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
DBN=$RANDOM
DBNB=$RANDOM
DBNC=$RANDOM
Expand Down Expand Up @@ -352,8 +352,8 @@ elif [[ "$SECOND_IP" ]]; then
fi

wpinstall
WPSALT=$(/usr/bin/openssl rand 19 -base64 | tr -dc 'a-zA-Z0-9')
WPSALTB=$(/usr/bin/openssl rand 11 -base64 | tr -dc 'a-zA-Z0-9')
WPSALT=$(/usr/bin/openssl rand -base64 21 | tr -dc 'a-zA-Z0-9')
WPSALTB=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
WPN=$RANDOM
WPNB=$RANDOM
WPADMINUSER="z${WPSALT}wp${WPNB}"
Expand Down Expand Up @@ -753,8 +753,8 @@ find "/home/nginx/domains/$vhostname" -type d -exec chmod g+s {} \;
if [[ "$disablepwdprotect" != [yY] ]]; then
# wp-login.php password protection
if [[ -f /usr/local/nginx/conf/htpasswd.sh && ! -f /home/nginx/domains/$vhostname/htpasswd_wplogin ]]; then
HTWPLOGINSALT=$(/usr/bin/openssl rand 14 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand 20 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALT=$(/usr/bin/openssl rand -base64 16 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')
HTWPLOGIN=$RANDOM
HTWPLOGINB=$RANDOM
HTUSER="u${HTWPLOGINSALT}x${HTWPLOGIN}"
Expand Down
4 changes: 2 additions & 2 deletions inc/zendopcache_install.inc
Expand Up @@ -12,9 +12,9 @@ gethtpasswdsh
else
hname=$(hostname -f)
fi
OPSALT=$(/usr/bin/openssl rand 10 -base64 | tr -dc 'a-zA-Z0-9')
OPSALT=$(/usr/bin/openssl rand -base64 11 | tr -dc 'a-zA-Z0-9')
OPUSER=$(echo "opadmin${OPSALT}")
OPPASS=$(/usr/bin/openssl rand 22 -base64 | tr -dc 'a-zA-Z0-9')
OPPASS=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')

echo ""
cecho "Creating htpasswd_opcache user/pass..." $boldyellow
Expand Down
8 changes: 4 additions & 4 deletions inc/zendopcache_upgrade.inc
Expand Up @@ -12,9 +12,9 @@ gethtpasswdsh
else
hname=$(hostname -f)
fi
OPSALT=$(/usr/bin/openssl rand 10 -base64 | tr -dc 'a-zA-Z0-9')
OPSALT=$(/usr/bin/openssl rand -base64 11 | tr -dc 'a-zA-Z0-9')
OPUSER=$(echo "opadmin${OPSALT}")
OPPASS=$(/usr/bin/openssl rand 22 -base64 | tr -dc 'a-zA-Z0-9')
OPPASS=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')

echo ""
cecho "Creating htpasswd_opcache user/pass..." $boldyellow
Expand Down Expand Up @@ -177,9 +177,9 @@ gethtpasswdsh
else
hname=$(hostname -f)
fi
OPSALT=$(/usr/bin/openssl rand 10 -base64 | tr -dc 'a-zA-Z0-9')
OPSALT=$(/usr/bin/openssl rand -base64 11 | tr -dc 'a-zA-Z0-9')
OPUSER=$(echo "opadmin${OPSALT}")
OPPASS=$(/usr/bin/openssl rand 22 -base64 | tr -dc 'a-zA-Z0-9')
OPPASS=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')

N=$(od -vAn -N8 -tx < /dev/urandom | sed -e 's/\s//g')
if [[ -f /usr/local/nginx/html/opcache.php ]]; then
Expand Down
6 changes: 3 additions & 3 deletions tools/nvwp.sh
Expand Up @@ -306,7 +306,7 @@ cmchkconfig() {
}

dbsetup() {
SALT=$(/usr/bin/openssl rand 12 -base64 | tr -dc 'a-zA-Z0-9')
SALT=$(/usr/bin/openssl rand -base64 14 | tr -dc 'a-zA-Z0-9')
DBN=$RANDOM
DBNB=$RANDOM
DBNC=$RANDOM
Expand Down Expand Up @@ -746,8 +746,8 @@ find "/home/nginx/domains/$vhostname" -type d -exec chmod g+s {} \;

# wp-login.php password protection
if [[ -f /usr/local/nginx/conf/htpasswd.sh && ! -f /home/nginx/domains/$vhostname/htpasswd_wplogin ]]; then
HTWPLOGINSALT=$(/usr/bin/openssl rand 14 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand 20 -base64 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALT=$(/usr/bin/openssl rand -base64 16 | tr -dc 'a-zA-Z0-9')
HTWPLOGINSALTB=$(/usr/bin/openssl rand -base64 23 | tr -dc 'a-zA-Z0-9')
HTWPLOGIN=$RANDOM
HTWPLOGINB=$RANDOM
HTUSER="u${HTWPLOGINSALT}x${HTWPLOGIN}"
Expand Down

0 comments on commit 134b253

Please sign in to comment.