Browse Source

refactor: improve random password generation in install_config.sh

The code change refactors the random password generation in the `install_config.sh` file. Instead of using `tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs`, it now uses `tr -dc 'A-Za-z0-9_' < /dev/urandom 2>/dev/null | head -c 8 | xargs`. This change improves the reliability and security of generating random passwords.
pull/4298/head
Daniel Gibbs 2 years ago
parent
commit
8a35f649a5
  1. 2
      lgsm/modules/install_config.sh

2
lgsm/modules/install_config.sh

@ -64,7 +64,7 @@ fn_default_config_local() {
# PASSWORD to random password # PASSWORD to random password
fn_set_config_vars() { fn_set_config_vars() {
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs) random=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2>/dev/null | head -c 8 | xargs)
servername="LinuxGSM" servername="LinuxGSM"
rconpass="admin${random}" rconpass="admin${random}"
echo -e "changing hostname." echo -e "changing hostname."

Loading…
Cancel
Save