[Semibug] Generate random passwords?

Nick Holland nick at holland-consulting.net
Sun Jul 25 12:43:07 EDT 2021


On 7/17/21 1:09 PM, Thomas Levine wrote:
> Mike Wayne wrote:
>> I rather despise having to install a package (or, much worse,
>> multiple packages) for something so simple.
> 
> openssl is in base.

sorry, bit late in catching up on stuff...

One thing I did for random PWs at work was basically the openssl trick
(ok, no -- I piped random through a base64 encoder, but the openssl
trick is much better), but then have a little fun with it...

Sometimes PWs have to be handled in ways other than cutting and pasting,
and when that's the case, sometimes you want to remove certain ambiguous
characters, like 1 and l, or 0 and O, etc.  Sometimes it is just better
for a temp pw to be all upper or lower case, again for easier transmission
to another person.  "tr" is great for this.

tr -d "char set" removes all characters that are in the char set parameter.
tr -dc "char set" removes all characters that AREN'T in the char set parameter
typeset -l or typeset -u creates a variable that is only lower or upper case,
respectively.

So ... I generate a much longer string of random characters than desired,
prune out the annoying characters with "tr -d", and do whatever I want
about case, then chop a desired number of characters out of the middle
of the string.

Our PW generator at work has a few modes -- an easy mode (lower case, no
ambiguous characters, a normal mode (pure random data).  For giggles, we
put in a "mindf**k" mode, which does ONLY ambiguous characters and similar
punctuation marks (i.e., ";:.,").  There was a "insert name of favorite
employee who doesn't get it sometimes" mode, where it just returned
"welcome1" as the pw, but we removed that when we implemented formal
change control for our maintenance scripts.


pwgen is really nice in that it creates semi-memorable passwords., not
just totally random gibberish you will never be able to remember. It
is a good tool for PWs that you have to use regularly and without a pw
manager. That does cost you a certain degree of randomness, obviously.
Still, I found it useful enough I put it on-line:

   https://holland-consulting.net/cgi-bin/pwsug

However, do note the warning at the top of the page.  I absolutely don't
trust other people's PW generators, so I reinvented that wheel very
deliberately for my own use, but you are welcome to use it. :)

Nick.



More information about the Semibug mailing list