Allow making the MKPASSWD command only usable by opers.

This commit is contained in:
Sadie Powell 2021-06-20 21:29:45 +01:00
parent 9f3b933371
commit 5c8b212a3c
2 changed files with 9 additions and 0 deletions

View File

@ -1748,6 +1748,9 @@
#
# Generate hashes using the /MKPASSWD command on the server.
# Don't run it on a server you don't trust with your password.
#
# You can also make the MKPASSWD command oper only by uncommenting this:
#<mkpasswd operonly="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# PBKDF2 module: Allows other modules to generate PBKDF2 hashes,

View File

@ -88,6 +88,12 @@ class ModulePasswordHash : public Module
{
}
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("mkpasswd");
cmd.flags_needed = tag->getBool("operonly") ? 'o' : 0;
}
ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) CXX11_OVERRIDE
{
if (!hashtype.compare(0, 5, "hmac-", 5))