🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90074

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

#90074
From: Julien ÉLIE
Date: Sun, 05 Feb 2023 09:40
97 lines
5550 bytes
Hi all,

[Jesse]
> 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 for having raised the possible problem.  At least it permitted 
modernizing the documentation for ckpasswd.



[Russ]
> Minor Perl syntax nit to avoid the backslashes:
> 
> % perl -le 'print crypt("pass", q{$5$YourSalt$})' > $5$YourSalt$V5hqwFg1nhKb5as6md9KTe5b2NyavsMS6dBYVKfp5W7
Yes, it's more readable this way, thanks!


> It may be worth mentioning that the opaque "j9T" string in the
> yescrypt example is generated with crypt_gensalt(3), and what
> parameters generated it.  (I'm not sure if Perl has an easy interface
> to that.)
OK.  I also did not find in CPAN a module dealing with yescript or more 
generally with crypt options.



[Matija]
> For perl however, it is not really clear to beginners) what is the salt
> which must be changed/RANDOM, and what are the fixed elements, especially as
> one example users random string, and another human-readable version. (and
> yescript example having extra unexplained paramtered 'j9T')

OK, I'll see how to explain it better.


> I'd suggest:
> 
> - changing actual salt in *both* perl examples to "YourRandomSalt"

The subtlety is that yescript expects a salt whose length is multiple of 
4...  I'll keep "YourSalt" and mention your second point:

> - clarifiying in documentation that only "pass" (your password) and
>    "YourRandomSalt" (random string which should be different for EACH
>    user) parts of the commands should be changed, and all the rest be left
>    as-is.

New wording which I hope contains all the details :)


         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", q{$5$YourSalt$})'
             $5$YourSalt$V5hqwFg1nhKb5as6md9KTe5b2NyavsMS6dBYVKfp5W7

         As Perl makes use of crypt(3), you have access to all available
         hashing schemes on your systems.  For instance, if yescript is
         supported, you can generate an encrypted password with an argument
         like "$y$j9T$YourSalt$" to Perl crypt function, where "y" is the
         prefix for yescript, "j9T" the parameters passed to 
crypt_gensalt(3)
         to generate the hashed password (these parameters control the
         yescript configuration, and correspond in this example to
         "YESCRYPT_DEFAULTS" flag, the recommended flavor which has "j" 
value
         in 2023, with 4096 as block count and 32 as block size) and
         "YourSalt" a string which should be chosen at random and different
         for each user.  The syntax and optimal length of the salt 
depends of
         the hashing scheme (e.g. a length multiple of 4 for yescript) and
         cryptographic recommendations (e.g. at least 32 random bits in
         length, following NIST SP 800-63B recommendations in 2023).

         To put it in a nutshell, in the following command, you only have to
         change the password "pass" and the "YourSalt" random string,
         different for each user, and leave the rest of the command as-is:

             % perl -le 'print crypt("pass", q{$y$j9T$YourSalt$})'
             $y$j9T$YourSalt$X4tB48vKNDT6mK0vNOc7ppKPWvEsyMg5LwoQfO50r2A

         A random salt of 12 characters can be obtained with the following
         command (the result corresponds to 72 random bits as each character
         is selected in a 6-bit range of 64 possible characters):

             % perl -le 'print join("",
                   (".", "/", 0..9, A..Z, a..z)[map {rand 64} (1..12)])'
             k2W/17eJu58r


-- 
Julien ÉLIE

« Le rire est une chose sérieuse avec laquelle il ne faut pas
   plaisanter. » (Raymond Devos)
Technical Details
Message-ID: <trntj3$ltis$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
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <87sffutqdx.fsf@hope.eyrie.org> <tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com> <87k016tops.fsf@hope.eyrie.org> <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com> <trlb5t$k5qt$1@news.trigofacile.com> <slrnttsm2q.48k.mnalis-news@eagle102.home.lan>

Show Full Headers
Complete Article Headers
Message-ID: <trntj3$ltis$1@news.trigofacile.com>
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sun, 5 Feb 2023 10:40:51 +0100
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <87sffutqdx.fsf@hope.eyrie.org> <tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com> <87k016tops.fsf@hope.eyrie.org> <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com> <trlb5t$k5qt$1@news.trigofacile.com> <slrnttsm2q.48k.mnalis-news@eagle102.home.lan>
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: Groupes francophones par TrigoFACILE
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 5 Feb 2023 09:40:51 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="176.143-2-105.abo.bbox.fr:176.143.2.105"; logging-data="718428"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1
Cancel-Lock: sha1:8F6Cu9b0dTGuI0YeQ5GGz9dTfvs= sha256:iIY7r/q77v6KfrnG0Hbzoo+SQMDM/uxPZWpng0ainnE= sha1:cnurVn8qiEw0GLj1/P/F1z45g9o= sha256:h7lehX2j8mogui2ImFcsYFzrVRUyq4FGW1j6wISySNA=
In-Reply-To: <slrnttsm2q.48k.mnalis-news@eagle102.home.lan>