|
@@ -237,6 +237,11 @@ EOF
|
237
|
237
|
echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
|
238
|
238
|
echo ' NEW_USER_PASSWORD=$(cat ~/login.txt)' >> $rootdir/root/.bashrc
|
239
|
239
|
echo ' else' >> $rootdir/root/.bashrc
|
|
240
|
+ echo ' ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc
|
|
241
|
+ echo ' if [ $ENTROPY -lt 500]; then' >> $rootdir/root/.bashrc
|
|
242
|
+ echo ' echo "WARNING: The entropy available on this system is too low to generate a password"' >> $rootdir/root/.bashrc
|
|
243
|
+ echo ' exit 5763' >> $rootdir/root/.bashrc
|
|
244
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
240
|
245
|
echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
|
241
|
246
|
echo ' fi' >> $rootdir/root/.bashrc
|
242
|
247
|
echo ' echo -n "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
|