#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "rec_channel.hh"
+
#include <iostream>
#include <fcntl.h>
+
#include "pdnsexception.hh"
#include "arguments.hh"
-
+#include "credentials.hh"
#include "namespaces.hh"
+#include "rec_channel.hh"
ArgvMap &arg()
{
};
try {
initArguments(argc, argv);
- RecursorControlChannel rccS;
string sockname="pdns_recursor";
if (arg()["config-name"] != "")
sockname.append(".controlsocket");
- rccS.connect(arg()["socket-dir"], sockname);
-
const vector<string>&commands=arg().getCommands();
string command;
+ string password;
int fd = -1;
unsigned int i = 0;
while (i < commands.size()) {
throw PDNSException("Command needs a file argument");
}
}
+ else if (commands.at(i) == "hash-password") {
+ if (commands.size() > (i + 1)) {
+ ++i;
+ password = commands.at(i);
+ }
+ else {
+ throw PDNSException("Command needs a password argument");
+ }
+ }
++i;
}
+ if (!password.empty()) {
+ cout << hashPassword(password) << endl;
+ return 0;
+ }
+
auto timeout = arg().asNum("timeout");
+ RecursorControlChannel rccS;
+ rccS.connect(arg()["socket-dir"], sockname);
rccS.send({0, command}, nullptr, timeout, fd);
auto receive = rccS.recv(0, timeout);
get-qtypelist
Retrieves QType statistics. Queries from cache aren't being counted yet.
+hash-password
+ Hash and salt the given password, to use as a webserver password or
+ API key. This command does not contact the recursor but does the
+ hashing inside rec_control.
+
help
Shows a list of supported commands understood by the running
:program:`pdns_recursor`