Skip to content

server config FEATURE public API for hashing a password - #639

Merged
michalvasko merged 1 commit into
CESNET:develfrom
niklas-moser:export-password-hashing
Sep 15, 2026
Merged

michalvasko merged 1 commit into
CESNET:develfrom
niklas-moser:export-password-hashing

Conversation

@niklas-moser

@niklas-moser niklas-moser commented Sep 7, 2026

Copy link
Copy Markdown

Splits the salt generation and the crypt(3) call out of nc_server_config_add_ssh_user_password() into a public nc_server_config_hash_password(). No behaviour change.

Today the logic is only reachable through a function that builds an entire ietf-netconf-server subtree around the result. A caller that wants just the digest has to duplicate the crypt code and take on a libcrypt dependency of its own — which is what CESNET/Netopeer2# would otherwise have to do.

Motivation is: O-RAN WG11 R004, and 3GPP TS 33.117 clause 4.2.3.4.3.1 behind it, don't let a deployment ship clear-text credentials in a datastore, so Netopeer2 has to hash a "$0$" password at commit time

Comment thread src/server_config.h Outdated
Split the salt generation and the crypt(3) call out of
nc_server_config_add_ssh_user_password() into a static helper and expose
nc_server_config_hash_password() on top of it. No behaviour change.

The public function takes a whole iana-crypt-hash 'crypt-hash' value and
hashes only "$0$<clear-text>", returning NULL for a value that is
already a digest. That keeps the "$0$" rule in one place, next to the
auth path that relies on it as well, instead of in every caller.

Lets a caller get just the digest, without building an
ietf-netconf-server subtree around it or duplicating the crypt code and
its libcrypt dependency.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@niklas-moser
niklas-moser force-pushed the export-password-hashing branch from 6f4adf3 to 31659d8 Compare September 15, 2026 10:04
@michalvasko
michalvasko merged commit 241d381 into CESNET:devel Sep 15, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants