From: Remi Gacogne Date: Mon, 21 Jun 2021 16:14:15 +0000 (+0200) Subject: auth: Allow hashing with a custom work factor X-Git-Tag: dnsdist-1.7.0-alpha1~12^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d1ebbc1c8c79b29c79a1fc39302580c2862dbe;p=thirdparty%2Fpdns.git auth: Allow hashing with a custom work factor --- diff --git a/docs/manpages/pdnsutil.1.rst b/docs/manpages/pdnsutil.1.rst index 12285832d0..e9dfa7f29e 100644 --- a/docs/manpages/pdnsutil.1.rst +++ b/docs/manpages/pdnsutil.1.rst @@ -189,9 +189,11 @@ edit-zone *ZONE* **EDITOR** is empty, *pdnsutil* falls back to using *editor*. get-meta *ZONE* [*ATTRIBUTE*]... Get zone metadata. If no *ATTRIBUTE* given, lists all known. -hash-password +hash-password [*WORK-FACTOR*] This convenience command asks for a password and returns a hashed and salted version, for use as a webserver password or api key. + An optional scrypt work factor can be specified, in power of two, + otherwise it defaults to 1024. hash-zone-record *ZONE* *RNAME* This convenience command hashes the name *RNAME* according to the NSEC3 settings of *ZONE*. Refuses to hash for zones with no NSEC3 diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ac32efc0e0..a4ed9a8195 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -2332,7 +2332,7 @@ try cout<<"generate-zone-key {zsk|ksk} [ALGORITHM] [BITS]"< 1) { + try { + workFactor = pdns_stou(cmds.at(1)); + } + catch (const std::exception& e) { + cerr<<"Unable to parse the supplied work factor: "<