]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
tools: cobbler-access password gen update 789/head
authorDavid Galloway <david.galloway@ibm.com>
Mon, 22 Sep 2025 20:49:10 +0000 (16:49 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Mon, 22 Sep 2025 20:49:10 +0000 (16:49 -0400)
- Work on Mac
- Make a letter/number the first character

Signed-off-by: David Galloway <david.galloway@ibm.com>
tools/cobbler-access.sh

index da48ebe576813b482bd834c3c818e8c575a871ce..d01e043921e1b582c015a9f43957176d4c5c02b3 100755 (executable)
@@ -4,7 +4,11 @@
 tmpfile=$(mktemp)
 
 # Basically `mkpasswd` but uses a small subset of special characters
-password=$(head /dev/urandom | tr -dc 'A-Za-z0-9!@#$%&' | head -c 12 && echo)
+password="$(
+  { head -c 64 /dev/urandom | LC_ALL=C tr -dc '[:alnum:]' | head -c 1;
+    head -c 256 /dev/urandom | LC_ALL=C tr -dc '[:alnum:]!@#$%&-' | head -c 11;
+  } && echo
+)"
 
 if [ $# -eq 0 ]; then
   printf "Enter username: "