πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90070

Re: Modern encryption for INN's ckpasswd or equivalent options?

#90070
From: Jesse Rehmer
Date: Sat, 04 Feb 2023 16:31
63 lines
4227 bytes
On Feb 4, 2023 at 4:14:21 AM CST, "Julien Γ‰LIE"
<iulius@nom-de-mon-site.com.invalid> wrote:

> Hi Jesse and Russ,
> 
> Thanks for this discussion, it was pretty interesting.
> 
> I'll remove the mention of htpasswd from the ckpasswd man page, and modernize
> the wording.
> Here is what I came up with. I hope it will be of help for other people
> looking at how to generate passwords.
> 
>      -f filename
>          Read passwords from the given file rather than using getpwnam(3).
>          Each line of the file should look something like:
> 
>              username:$5$Hlb2yXPd$2nOO/QR9P1mnRFr/i6L9ybxbgSDXd4UlatKqbcY4eoB
>              joe:FCjOJnpOo50IE:Old weak hash algorithm used for Joe
> 
>          Each line has at least two fields separated by a colon.  The first
>          field contains the username; the second field contains a password
>          hashed with the crypt(3) function.  Additional colons and data may
>          appear after the encrypted password; that data will be ignored by
>          ckpasswd.  Lines starting with a number sign ("#") are ignored.
> 
>          INN does not come with a utility to create the encrypted passwords,
>          but OpenSSL can do so and it's also a quick job with Perl (see the
>          one-line example script below).
> 
>          A line in *filename* for the user "user" with the password "pass"
>          would be "user:" followed with the output of the following command
>          using SHA-256 as hashing scheme:
> 
>              % openssl passwd -5 pass
>              $5$UIhtJSBOaC0Ap3Vk$nbKgmykshoQ2HmvA3s/nI.X4uhhNHBKTYhBS3pYLjJ6
> 
>          See the openssl-passwd(1) man page for the list of hashing schemes
>          it can generate.  You must take one that your system crypt(3)
>          function handles (type "man 3 crypt" or "man 5 crypt" to find the
>          supported hashing schemes).
> 
>          In case OpenSSL is not installed on your server, you can also use
>          the following Perl command which does the same job:
> 
>              % perl -le "print crypt('pass', '\$5\$UIhtJSBOaC0Ap3Vk\$');"
>              $5$UIhtJSBOaC0Ap3Vk$nbKgmykshoQ2HmvA3s/nI.X4uhhNHBKTYhBS3pYLjJ6
> 
>          As Perl makes use of crypt(3), you have access to all available
>          hashing schemes on your systems (like yescript, if supported).  Make
>          sure to use a random salt.
> 
>              % perl -le "print crypt('pass', '\$y\$j9T\$YourSalt\$');"
>              $y$j9T$YourSalt$X4tB48vKNDT6mK0vNOc7ppKPWvEsyMg5LwoQfO50r2A

This is a great explanation, maybe also take Matija's response into
consideration for completeness.

Where I got tripped up was using "htpasswd -m", which according to its man
page produces MD5 hashes so I assumed it would work, but the output wasn't
working with nnrpd, so I thought it had to be a deeper issue with crypto
libraries/support.

Thanks everyone!
Technical Details
Message-ID: <trm19l$1l8g$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <87k016tops.fsf@hope.eyrie.org> <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com> <trlb5t$k5qt$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <trm19l$1l8g$1@nnrp.usenet.blueworldhosting.com>
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 04 Feb 2023 16:31:49 +0000
From: Jesse Rehmer <jesse.rehmer@blueworldhosting.com>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <87k016tops.fsf@hope.eyrie.org> <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com> <trlb5t$k5qt$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 4 Feb 2023 16:31:49 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com; logging-data="54544"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:u/elfMs30Zfpn9s2X9zt2niT3M8= sha256:Z5Jq+I3DY/SPmqwleYvqc8rDbPDGdE2d+yILj7Rebew= sha1:Rce9XNPeEPxR41/5g6qhNCwAs58= sha256:R4SNLd45Ow638mzYjwHFl2k7K8bGR1AvBzvitCXYf2w=
X-Usenapp: v1.26.1/d - Full License