Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Mathematicians practice absolute freedom. -- Henry Adams


computers / news.software.nntp / Re: Modern encryption for INN's ckpasswd or equivalent options?

SubjectAuthor
* Modern encryption for INN's ckpasswd or equivalent options?Jesse Rehmer
`* Re: Modern encryption for INN's ckpasswd or equivalent options?Russ Allbery
 `* Re: Modern encryption for INN's ckpasswd or equivalent options?Jesse Rehmer
  `* Re: Modern encryption for INN's ckpasswd or equivalent options?Russ Allbery
   +- Re: Modern encryption for INN's ckpasswd or equivalent options?Jesse Rehmer
   `* Re: Modern encryption for INN's ckpasswd or equivalent options?Jesse Rehmer
    +- Re: Modern encryption for INN's ckpasswd or equivalent options?Garrett Wollman
    `* Re: Modern encryption for INN's ckpasswd or equivalent options?Julien ÉLIE
     +* Re: Modern encryption for INN's ckpasswd or equivalent options?Matija Nalis
     |`- Re: Modern encryption for INN's ckpasswd or equivalent options?Julien ÉLIE
     +- Re: Modern encryption for INN's ckpasswd or equivalent options?Jesse Rehmer
     `- Re: Modern encryption for INN's ckpasswd or equivalent options?Russ Allbery

1
Modern encryption for INN's ckpasswd or equivalent options?

<tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1347&group=news.software.nntp#1347

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: jesse.re...@blueworldhosting.com (Jesse Rehmer)
Newsgroups: news.software.nntp
Subject: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 28 Jan 2023 19:11:59 -0000 (UTC)
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 28 Jan 2023 19:11:59 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="26059"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:l/kFbMnaQlBBsc3hxMRPZYEqQH8= sha256:kNclGZTSOxlEwc3hmgnjwhMPP5mDqa+8ptlPW6S8Vi8=
sha1:rsc1igeB/v6HFiWP+vPft/L/6yE= sha256:SVD7jJApQvBspDJ3t4bc6bdHPdSbWP2iemdqUQh7Nzs=
X-Usenapp: v1.26/d - Full License
 by: Jesse Rehmer - Sat, 28 Jan 2023 19:11 UTC

Does anyone have an example perl_auth program I could reference that supports
more modern encrypted storage of passwords?

I have a small set of users and do not want to use PAM or system auth. The
crypt implementation used by ckpasswd -f, is, well, extremely old.

Cheers,

Jesse Rehmer

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

<87sffutqdx.fsf@hope.eyrie.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1348&group=news.software.nntp#1348

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.killfile.org!news.eyrie.org!.POSTED!not-for-mail
From: eag...@eyrie.org (Russ Allbery)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 28 Jan 2023 11:23:22 -0800
Organization: The Eyrie
Message-ID: <87sffutqdx.fsf@hope.eyrie.org>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: hope.eyrie.org;
logging-data="18855"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:CeHwDTOvUvIv07J5/vLUJyKc0gY=
 by: Russ Allbery - Sat, 28 Jan 2023 19:23 UTC

Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:

> Does anyone have an example perl_auth program I could reference that
> supports more modern encrypted storage of passwords?

> I have a small set of users and do not want to use PAM or system
> auth. The crypt implementation used by ckpasswd -f, is, well, extremely
> old.

ckpasswd -f just uses crypt, so it will use as modern of a password
hashing algorithm as your libc or libcrypt supports. Generally this is
configured by the prefix of the hashed password. For example, on Linux,
you can use hashes starting with $y$ to use yescrypt, which is about as
modern as you could possibly want.

This is therefore entirely up to how you set the passwords in the file
that you're pointing to with ckpasswd -f, which is a bit outside what INN
deals with. It's quite possible that htpasswd, for example, won't
generate one of the newer hash types.

--
Russ Allbery (eagle@eyrie.org) <https://www.eyrie.org/~eagle/>

Please post questions rather than mailing me directly.
<https://www.eyrie.org/~eagle/faqs/questions.html> explains why.

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

<tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1349&group=news.software.nntp#1349

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: jesse.re...@blueworldhosting.com (Jesse Rehmer)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 28 Jan 2023 19:40:44 -0000 (UTC)
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <87sffutqdx.fsf@hope.eyrie.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 28 Jan 2023 19:40:44 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="27139"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:O/NnGQ+zu24xnSTDigMQXkbVltk= sha256:GDhy7aFir8rmAqbSPXQDtYF1FKDY98ipxdmLxx1Kp2U=
sha1:Db/l3X4WAPuKgsC5aj08JFif58M= sha256:kbzy5x2hoKDZ7dbgL+1rWl9Dzah2nvegHazY0v1pVdk=
X-Usenapp: v1.26/d - Full License
 by: Jesse Rehmer - Sat, 28 Jan 2023 19:40 UTC

On Jan 28, 2023 at 1:23:22 PM CST, "Russ Allbery" <eagle@eyrie.org> wrote:

> Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:
>
>> Does anyone have an example perl_auth program I could reference that
>> supports more modern encrypted storage of passwords?
>
>> I have a small set of users and do not want to use PAM or system
>> auth. The crypt implementation used by ckpasswd -f, is, well, extremely
>> old.
>
> ckpasswd -f just uses crypt, so it will use as modern of a password
> hashing algorithm as your libc or libcrypt supports. Generally this is
> configured by the prefix of the hashed password. For example, on Linux,
> you can use hashes starting with $y$ to use yescrypt, which is about as
> modern as you could possibly want.
>
> This is therefore entirely up to how you set the passwords in the file
> that you're pointing to with ckpasswd -f, which is a bit outside what INN
> deals with. It's quite possible that htpasswd, for example, won't
> generate one of the newer hash types.

How can I tell what algorithms my library supports? I'm on FreeBSD 13 and in
the past was on Linux. I could never get ckpasswd to accept anything more than
"htpasswd -d" outputs, which on all of the operating sytems I've used outputs
the weakest possible encryption:

-d Use crypt() encryption for passwords. This is not supported by
the httpd server on Windows and Netware. This algorithm limits
the password length to 8 characters. This algorithm is insecure
by today's standards. It used to be the default algorithm until
version 2.2.17.

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

<87k016tops.fsf@hope.eyrie.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1350&group=news.software.nntp#1350

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.killfile.org!news.eyrie.org!.POSTED!not-for-mail
From: eag...@eyrie.org (Russ Allbery)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 28 Jan 2023 11:59:27 -0800
Organization: The Eyrie
Message-ID: <87k016tops.fsf@hope.eyrie.org>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com>
<87sffutqdx.fsf@hope.eyrie.org>
<tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: hope.eyrie.org;
logging-data="18855"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:B2Lt30aM/Zk7PlNF+hbJFDfkIEI=
 by: Russ Allbery - Sat, 28 Jan 2023 19:59 UTC

Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:

> How can I tell what algorithms my library supports?

man 3 crypt should hopefully tell you what the available hash algorithms
are. You'll need something that writes the password file, though (or use
passwd to set a password for a system user and then copy and paste the
hash from /etc/shadow, which I've done in a pinch).

https://man.freebsd.org/cgi/man.cgi?crypt(3) seems to imply nothing better
than SHA-512 is supported, which is a bit surprising.

--
Russ Allbery (eagle@eyrie.org) <https://www.eyrie.org/~eagle/>

Please post questions rather than mailing me directly.
<https://www.eyrie.org/~eagle/faqs/questions.html> explains why.

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

<tr40gd$2dl9$1@nnrp.usenet.blueworldhosting.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1351&group=news.software.nntp#1351

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: jesse.re...@blueworldhosting.com (Jesse Rehmer)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 28 Jan 2023 20:27:57 -0000 (UTC)
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <tr40gd$2dl9$1@nnrp.usenet.blueworldhosting.com>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 28 Jan 2023 20:27:57 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="79529"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:qDAwwoJJIC/ujmUw6wD9QbVWlaA= sha256:wH66Z291AgF6DI6t5BsBDkm38YqWD3EyhkEPwbalj88=
sha1:oxPSpftihNIofDMyrHREANOYwCA= sha256:GLoSf4DNO2ep/RewGnnunj6F1an6TUjXM7KBQaxugO0=
X-Usenapp: v1.26/d - Full License
 by: Jesse Rehmer - Sat, 28 Jan 2023 20:27 UTC

On Jan 28, 2023 at 1:59:27 PM CST, "Russ Allbery" <eagle@eyrie.org> wrote:

> Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:
>
>> How can I tell what algorithms my library supports?
>
> man 3 crypt should hopefully tell you what the available hash algorithms
> are. You'll need something that writes the password file, though (or use
> passwd to set a password for a system user and then copy and paste the
> hash from /etc/shadow, which I've done in a pinch).
>
> https://man.freebsd.org/cgi/man.cgi?crypt(3) seems to imply nothing better
> than SHA-512 is supported, which is a bit surprising.

It also says it supports MD5, but that's what I was trying to use without
success. I'll bang away and a few different ways to generate different hashes
and give it another stab.

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

<tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1352&group=news.software.nntp#1352

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: jesse.re...@blueworldhosting.com (Jesse Rehmer)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sun, 29 Jan 2023 04:46:19 -0000 (UTC)
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 29 Jan 2023 04:46:19 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="67727"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:ofB7BD8zYXx5bfh0yqxD6kAzF3w= sha256:1T0OC9XYqm0H/tGkH/SCASWw4s912CnxIcqyRIUgiAw=
sha1:8l5OVcTodCc8uABOggfXAUuUHGg= sha256:VhOJG97ujqcIOcEAOXBEX0X2zlhvMV0rQ8drK5n6cEU=
X-Usenapp: v1.26/d - Full License
 by: Jesse Rehmer - Sun, 29 Jan 2023 04:46 UTC

On Jan 28, 2023 at 1:59:27 PM CST, "Russ Allbery" <eagle@eyrie.org> wrote:

> Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:
>
>> How can I tell what algorithms my library supports?
>
> man 3 crypt should hopefully tell you what the available hash algorithms
> are. You'll need something that writes the password file, though (or use
> passwd to set a password for a system user and then copy and paste the
> hash from /etc/shadow, which I've done in a pinch).
>
> https://man.freebsd.org/cgi/man.cgi?crypt(3) seems to imply nothing better
> than SHA-512 is supported, which is a bit surprising.

Auth works if I use the following for MD5:

openssl passwd -1 -salt xyz somepassword

Or the following for SHA512:

openssl passwd -6 -salt xyz somepassword

The hashes from "htpasswd -B" work as well. I suppose the MD5 implementation
for htpasswd has some oddities as I cannot get that to work, but using openssl
is just fine.

Cheers,

Jesse

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

<tr6j0u$2ufq$1@usenet.csail.mit.edu>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1353&group=news.software.nntp#1353

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!usenet.csail.mit.edu!.POSTED.hergotha.csail.mit.edu!not-for-mail
From: woll...@bimajority.org (Garrett Wollman)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sun, 29 Jan 2023 19:56:14 -0000 (UTC)
Organization: none
Message-ID: <tr6j0u$2ufq$1@usenet.csail.mit.edu>
References: <tr3s1v$peb$1@nnrp.usenet.blueworldhosting.com> <tr3tns$qg3$1@nnrp.usenet.blueworldhosting.com> <87k016tops.fsf@hope.eyrie.org> <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com>
Injection-Date: Sun, 29 Jan 2023 19:56:14 -0000 (UTC)
Injection-Info: usenet.csail.mit.edu; posting-host="hergotha.csail.mit.edu:207.180.169.34";
logging-data="96762"; mail-complaints-to="security@csail.mit.edu"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: wollman@bimajority.org (Garrett Wollman)
 by: Garrett Wollman - Sun, 29 Jan 2023 19:56 UTC

In article <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com>,
Jesse Rehmer <jesse.rehmer@blueworldhosting.com> wrote:
>Auth works if I use the following for MD5:
>
> openssl passwd -1 -salt xyz somepassword
>
>Or the following for SHA512:
>
> openssl passwd -6 -salt xyz somepassword

Note that the salt, to serve its function, should be randomly generated
and unique for each user. The openssl passwd command will do that for
you if you simply leave out the `-salt` option. The `-salt` option
should only be used when you are *verifying* a password.

-GAWollman

--
Garrett A. Wollman | "Act to avoid constraining the future; if you can,
wollman@bimajority.org| act to remove constraint from the future. This is
Opinions not shared by| a thing you can do, are able to do, to do together."
my employers. | - Graydon Saunders, _A Succession of Bad Days_ (2015)

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

<trlb5t$k5qt$1@news.trigofacile.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1392&group=news.software.nntp#1392

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.trigofacile.com!.POSTED.176-143-2-105.abo.bbox.fr!not-for-mail
From: iul...@nom-de-mon-site.com.invalid (Julien ÉLIE)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 4 Feb 2023 11:14:21 +0100
Organization: Groupes francophones par TrigoFACILE
Message-ID: <trlb5t$k5qt$1@news.trigofacile.com>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 4 Feb 2023 10:14:21 -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="661341"; 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:TE/Ubhlt8OnpSN+PDt5PKYQ/9rY= sha256:h73xq6lpq/3BhfY0JkHz9w9bdVBUwym+w1aNIDG3VVE=
sha1:0toYQeAtesJ7ue7/XVoiJVisXRk= sha256:28F4ntGJjvlCrdHU0uX9MHQmB3rP97PCs1OkaqtwFSk=
In-Reply-To: <tr4tmr$224f$1@nnrp.usenet.blueworldhosting.com>
 by: Julien ÉLIE - Sat, 4 Feb 2023 10:14 UTC

Hi Jesse and Russ,

Thanks for this discussion, it was pretty interesting.

>>> How can I tell what algorithms my library supports?
>>
>> man 3 crypt should hopefully tell you what the available hash algorithms
>> are.

"man 3 crypt" does not indicate the available hash schemes on my system (Debian bullseye).
Looking at the libcrypt-dev package which provides it, I see it installs both crypt.3 and crypt.5 man pages. The source package is libxcrypt even though it is libcrypt-dev (and not libxcrypt-dev).
Available hash schemes are found in "man 5 crypt" in Debian (but "man 3 crypt" in FreeBSD).

>> https://man.freebsd.org/cgi/man.cgi?crypt(3) seems to imply nothing better
>> than SHA-512 is supported, which is a bit surprising.

I confirm that on FreeBSD 13, the Perl crypt() function which uses the system crypt(3) one does not recognize yescript.

> Auth works if I use the following for MD5:
>
> openssl passwd -1 -salt xyz somepassword
>
> Or the following for SHA512:
>
> openssl passwd -6 -salt xyz somepassword

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

--
Julien ÉLIE

« Le sel de l'existence est essentiellement dans le poivre qu'on y
met. » (Alphonse Allais)

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

<slrnttsm2q.48k.mnalis-news@eagle102.home.lan>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1394&group=news.software.nntp#1394

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsfeed.CARNet.hr!.POSTED.2a05:4f46:327:2700:51e6:ac:9dda:4c3a!not-for-mail
From: mnalis-n...@voyager.hr (Matija Nalis)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 4 Feb 2023 14:06:34 +0100
Organization: CARNet, Croatia
Sender: mnalis@public.hr
Message-ID: <slrnttsm2q.48k.mnalis-news@eagle102.home.lan>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: news1.carnet.hr; posting-host="2a05:4f46:327:2700:51e6:ac:9dda:4c3a";
logging-data="839153"; mail-complaints-to="abuse@CARNet.hr"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:qQLB/gAiN5yOZrE/KeEeoWZoeZU=
 by: Matija Nalis - Sat, 4 Feb 2023 13:06 UTC

On Sat, 4 Feb 2023 11:14:21 +0100, Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> wrote:
> 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
>

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')

I'd suggest:

- changing actual salt in *both* perl examples to "YourRandomSalt"
- 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.

--
Opinions above are GNU-copylefted.

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

<trm19l$1l8g$1@nnrp.usenet.blueworldhosting.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1395&group=news.software.nntp#1395

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: jesse.re...@blueworldhosting.com (Jesse Rehmer)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 4 Feb 2023 16:31:49 -0000 (UTC)
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <trm19l$1l8g$1@nnrp.usenet.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>
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
 by: Jesse Rehmer - Sat, 4 Feb 2023 16:31 UTC

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!

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

<87h6w12vpx.fsf@hope.eyrie.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1397&group=news.software.nntp#1397

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.killfile.org!news.eyrie.org!.POSTED!not-for-mail
From: eag...@eyrie.org (Russ Allbery)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sat, 04 Feb 2023 09:20:42 -0800
Organization: The Eyrie
Message-ID: <87h6w12vpx.fsf@hope.eyrie.org>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: hope.eyrie.org;
logging-data="32718"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:5v8Z3x8F75AMd7DnveVHsMIbNlI=
 by: Russ Allbery - Sat, 4 Feb 2023 17:20 UTC

Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> 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

Minor Perl syntax nit to avoid the backslashes:

% perl -le 'print crypt("pass", q{$5$YourSalt$})'
$5$YourSalt$V5hqwFg1nhKb5as6md9KTe5b2NyavsMS6dBYVKfp5W7

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

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.)

--
Russ Allbery (eagle@eyrie.org) <https://www.eyrie.org/~eagle/>

Please post questions rather than mailing me directly.
<https://www.eyrie.org/~eagle/faqs/questions.html> explains why.

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

<trntj3$ltis$1@news.trigofacile.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1399&group=news.software.nntp#1399

  copy link   Newsgroups: news.software.nntp
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.trigofacile.com!.POSTED.176.143-2-105.abo.bbox.fr!not-for-mail
From: iul...@nom-de-mon-site.com.invalid (Julien ÉLIE)
Newsgroups: news.software.nntp
Subject: Re: Modern encryption for INN's ckpasswd or equivalent options?
Date: Sun, 5 Feb 2023 10:40:51 +0100
Organization: Groupes francophones par TrigoFACILE
Message-ID: <trntj3$ltis$1@news.trigofacile.com>
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>
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>
 by: Julien ÉLIE - Sun, 5 Feb 2023 09:40 UTC

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)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor