From: Remi Gacogne Date: Tue, 3 Sep 2024 13:18:40 +0000 (+0200) Subject: dnsdist: Add an example of how to use `hashPassword()` X-Git-Tag: rec-5.2.0-alpha1~98^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0fff935345ef249d482a56b981d443fbdb8bed64;p=thirdparty%2Fpdns.git dnsdist: Add an example of how to use `hashPassword()` --- diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index 06e1c009bc..94d3de533d 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -390,9 +390,23 @@ Webserver configuration .. versionadded:: 1.7.0 Hash the supplied password using a random salt, and returns a string that can be used with :func:`setWebserverConfig`. + For example, to get a hashed version of the ``test`` password: - :param string - password: The password to hash - :param int - workFactor: The work factor to use for the hash function (currently scrypt), as a power of two. Default is 1024. + .. code-block:: sh + + > hashPassword('test') + $scrypt$ln=10,p=1,r=8$RSYJ2QDmdlkNYMyqZF/FWw==$JQTftQCvAXR4Qtrg0lQmvrzgYEo3/PjEeuV4/2Oq1Vg= + + The full string can then be used with :func:`setWebserverConfig`: + + .. code-block:: lua + + setWebserverConfig({password="$scrypt$ln=10,p=1,r=8$RSYJ2QDmdlkNYMyqZF/FWw==$JQTftQCvAXR4Qtrg0lQmvrzgYEo3/PjEeuV4/2Oq1Vg=", + apiKey="$scrypt$ln=10,p=1,r=8$RSYJ2QDmdlkNYMyqZF/FWw==$JQTftQCvAXR4Qtrg0lQmvrzgYEo3/PjEeuV4/2Oq1Vg=", + acl="127.0.0.1/32"}) + + :param string password: The password to hash + :param int workFactor: The work factor to use for the hash function (currently scrypt), as a power of two. Default is 1024. .. function:: webserver(listen_address [, password[, apikey[, customHeaders[, acl]]]])