LinuxGSM: Random generation of Rcon password can fail
Using Ansible to provision a machine under CentOS 7.0 with LinuxGSM and CS:GO in particular (here is the used playbook).
I found out that auto-install will hang even when it has finished downloading the serverfiles.
Whereas, when typing the very same command over SSH manually, the auto-install completes immediately.
After long session of strace-ing the bash script, the culprit was the following line of install_config.sh (L54).
It seemed that execution of these processes was so fast, that it would break the pipe and cause the grep command to fail with grep: write error, eventually hanging the bash process.
An easy fix is to, just, plainly remove the random generation, and put a dummy string.
After that, Ansible is able to complete the playbook and the provisioning.
I think that random generation of Rcon password must be rewritten, or, that auto-install offer more choice to the configuration (I’d prefer, if possible, to handle the Rcon password myself rather than getting an elegant choice for your everyone user.)
As a workaround, what I do: run auto-install sufficiently long for install_config.sh to appear.
Monkey-patch it with sed and re-run auto-install normally.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 22 (16 by maintainers)
Commits related to this issue
- fixes #1308 as per @cedarlugs suggestion — committed to GameServerManagers/LinuxGSM by dgibbs64 7 years ago
Piping to
md5sumwon’t change the randomness of the resulting string as long as it is deterministic. Also, piping too many commands may cause again the broken pipe problem 😕.Related Related #2 - Apparently ansible doesn’t like to
cat /dev/urandom.The processes in a pipe succession cannot ‘execute too fast’, they are serially scheduled and their 3 streams are bound or conjoined before being scheduled.
I’d like to see the raw strace. grep shouldn’t give a write error unless /dev/urandom isn’t available, isn’t readable, or other more tangible error is present.
Personally, I’ve used this for random password generation which omits strings:
invoked as
genpasswdoutputs a 16-character password. Or invoked asgenpasswd 8to produce an 8-character password, etc.One issue with cropping md5sum is that you’ll never get upper-case nor underscore in the output.
uptime would be better, since load usage into it is almost impossible to track We can mix stuff in it just for the fun.
echo "$(uptime) $(date) $(whoami)" | md5sum | cut -c1-8(echo is required otherwise commands mess up)
Edit: Mixing @dgibbs64 's trick:
echo "$(uptime) $(date +"%T.%N") $(whoami)" | md5sum | cut -c1-8Yeah as @UltimateByte says you would need to know the exact second the command was run which is pretty unlikely. This might work well as it adds nanoseconds in to the command
date +"%T.%N" | md5sum | cut -c3-8I think the date option is quite clever however we only need a few characters…
Is this random enough?
date | md5sum | md5sum | md5sum | cut -c3-8