From: Kees Monshouwer Date: Tue, 18 May 2021 19:02:49 +0000 (+0200) Subject: auth: use primary/seconday in pdnsutil X-Git-Tag: auth-4.5.0-alpha1~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6716691abd69f62dff49b92e20604217ff91d05;p=thirdparty%2Fpdns.git auth: use primary/seconday in pdnsutil --- diff --git a/docs/manpages/pdnsutil.1.rst b/docs/manpages/pdnsutil.1.rst index 8b66220360..24aed66179 100644 --- a/docs/manpages/pdnsutil.1.rst +++ b/docs/manpages/pdnsutil.1.rst @@ -139,11 +139,11 @@ commands require an *ALGORITHM*, the following are available: - hmac-sha384 - hmac-sha512 -activate-tsig-key *ZONE* *NAME* {**master**,\ **slave**} +activate-tsig-key *ZONE* *NAME* {**primary**,\ **secondary**} Enable TSIG authenticated AXFR using the key *NAME* for zone *ZONE*. - This sets the ``TSIG-ALLOW-AXFR`` (master) or ``AXFR-MASTER-TSIG`` - (slave) zone metadata. -deactivate-tsig-key *ZONE* *NAME* {**master**,\ **slave**} + This sets the ``TSIG-ALLOW-AXFR`` (primary) or ``AXFR-MASTER-TSIG`` + (secondary) zone metadata. +deactivate-tsig-key *ZONE* *NAME* {**primary**,\ **secondary**} Disable TSIG authenticated AXFR using the key *NAME* for zone *ZONE*. delete-tsig-key *NAME* @@ -162,22 +162,22 @@ ZONE MANIPULATION COMMANDS add-record *ZONE* *NAME* *TYPE* [*TTL*] *CONTENT* Add one or more records of *NAME* and *TYPE* to *ZONE* with *CONTENT* and optional *TTL*. If *TTL* is not set, default will be used. -add-supermaster *IP* *NAMESERVER* [*ACCOUNT*] - Add a supermaster entry into the backend. This enables receiving zone updates from other servers. +add-autoprimary *IP* *NAMESERVER* [*ACCOUNT*] + Add a autoprimary entry into the backend. This enables receiving zone updates from other servers. create-zone *ZONE* Create an empty zone named *ZONE*. -create-slave-zone *ZONE* *MASTER* [*MASTER*].. - Create a new slave zone *ZONE* with masters *MASTER*. All *MASTER*\ s +create-secondary-zone *ZONE* *PRIMARY* [*PRIMARY*].. + Create a new secondary zone *ZONE* with primaries *PRIMARY*. All *PRIMARY*\ s need to to be space-separated IP addresses with an optional port. -change-slave-zone-master *ZONE* *MASTER* [*MASTER*].. - Change the masters for slave zone *ZONE* to new masters *MASTER*. All - *MASTER*\ s need to to be space-separated IP addresses with an optional port. +change-secondary-zone-primary *ZONE* *PRIMARY* [*PRIMARY*].. + Change the primaries for secondary zone *ZONE* to new primaries *PRIMARY*. All + *PRIMARY*\ s need to to be space-separated IP addresses with an optional port. check-all-zones Check all zones for correctness. check-zone *ZONE* Check zone *ZONE* for correctness. clear-zone *ZONE* - Clear the records in zone *ZONE*, but leave actual domain and + Clear the records in zone *ZONE*, but leave actual zone and settings unchanged delete-rrset *ZONE* *NAME* *TYPE* Delete named RRSET from zone. @@ -226,7 +226,7 @@ secure-all-zones [**increase-serial**] serial of those zones too. You should manually run 'pdnsutil rectify-all-zones' afterwards. set-kind *ZONE* *KIND* - Change the kind of *ZONE* to *KIND* (master, slave, native). + Change the kind of *ZONE* to *KIND* (primary, secondary, native). set-account *ZONE* *ACCOUNT* Change the account (owner) of *ZONE* to *ACCOUNT*. add-meta *ZONE* *ATTRIBUTE* *VALUE* [*VALUE*]... @@ -234,7 +234,7 @@ add-meta *ZONE* *ATTRIBUTE* *VALUE* [*VALUE*]... Will return an error if *ATTRIBUTE* does not support multiple values, use **set-meta** for these values. set-meta *ZONE* *ATTRIBUTE* [*VALUE*]... - Set domainmetadata *ATTRIBUTE* for *ZONE* to *VALUE*. An empty value + Set zonemetadata *ATTRIBUTE* for *ZONE* to *VALUE*. An empty value clears it. set-presigned *ZONE* Switches *ZONE* to presigned operation, utilizing in-zone RRSIGs. @@ -256,7 +256,7 @@ backend-cmd *BACKEND* *CMD* [*CMD..*] careful! bench-db [*FILE*] Perform a benchmark of the backend-database. - *FILE* can be a file with a list, one per line, of domain names to use for this. + *FILE* can be a file with a list, one per line, of zone names to use for this. If *FILE* is not specified, powerdns.com is used. OTHER TOOLS diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index ee9ddca5e9..0c632507c1 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -80,9 +80,9 @@ struct DomainInfo static DomainKind stringToKind(const string& kind) { - if(pdns_iequals(kind,"SLAVE")) + if (pdns_iequals(kind, "SECONDARY") || pdns_iequals(kind, "SLAVE")) return DomainInfo::Slave; - else if(pdns_iequals(kind,"MASTER")) + else if (pdns_iequals(kind, "PRIMARY") || pdns_iequals(kind, "MASTER")) return DomainInfo::Master; else return DomainInfo::Native; diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 29428acd94..d3433d4e62 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -256,7 +256,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con } } catch(const PDNSException &e) { if (di.kind == DomainInfo::Slave) { - cout<<"[Error] non-IP address for masters: "<& cmds) { for (unsigned i=2; i < cmds.size(); i++) { masters.emplace_back(cmds.at(i), 53); } - cerr<<"Creating slave zone '"<& cmds) { for (unsigned i=2; i < cmds.size(); i++) { masters.emplace_back(cmds.at(i), 53); } - cerr<<"Updating slave zone '"<setMasters(zone, masters); return EXIT_SUCCESS; } catch (PDNSException& e) { - cerr<<"Setting master for zone '"<& cmds) { return EXIT_SUCCESS; } -// addSuperMaster add anew super master +// addSuperMaster add anew super primary static int addSuperMaster(const std::string &IP, const std::string &nameserver, const std::string &account) { UeberBackend B("default"); @@ -1603,14 +1603,14 @@ static int listAllZones(const string &type="") { int kindFilter = -1; if (type.size()) { - if (toUpper(type) == "MASTER") + if (toUpper(type) == "PRIMARY" || toUpper(type) == "MASTER") kindFilter = 0; - else if (toUpper(type) == "SLAVE") + else if (toUpper(type) == "SECONDARY" || toUpper(type) == "SLAVE") kindFilter = 1; else if (toUpper(type) == "NATIVE") kindFilter = 2; else { - cerr<<"Syntax: pdnsutil list-all-zones [master|slave|native]"<createSlaveDomain("127.0.0.1", zone, "", "_testschema"); - cout << "Slave zone created" << endl; + cout << "Secondary zone created" << endl; DomainInfo di; if(!B.getDomainInfo(zone, di) || !di.backend) { // di.backend and B are mostly identical @@ -2269,13 +2269,13 @@ try if (cmds.empty() || g_vm.count("help") || cmds.at(0) == "help") { cout<<"Usage: \npdnsutil [options] [params ..]\n"< 2) { - cerr << "Syntax: pdnsutil list-all-zones [master|slave|native]"< 2 ? DNSName(cmds.at(2)) : DNSName()); } - else if (cmds.at(0) == "create-slave-zone") { + else if (cmds.at(0) == "create-secondary-zone" || cmds.at(0) == "create-slave-zone") { if(cmds.size() < 3 ) { - cerr<<"Syntax: pdnsutil create-slave-zone ZONE master-ip [master-ip..]"< 3 ? cmds.at(3) : "")); @@ -3351,17 +3351,17 @@ try else if (cmds.at(0) == "activate-tsig-key") { string metaKey; if (cmds.size() < 4) { - cerr << "Syntax: " << cmds.at(0) << " ZONE NAME {primary|secondary|master|slave}" << endl; + cerr << "Syntax: " << cmds.at(0) << " ZONE NAME {primary|secondary}" << endl; return 0; } DNSName zname(cmds.at(1)); string name = cmds.at(2); - if (cmds.at(3) == "master" || cmds.at(3) == "primary") + if (cmds.at(3) == "primary" || cmds.at(3) == "master") metaKey = "TSIG-ALLOW-AXFR"; - else if (cmds.at(3) == "slave" || cmds.at(3) == "secondary") + else if (cmds.at(3) == "secondary" || cmds.at(3) == "slave") metaKey = "AXFR-MASTER-TSIG"; else { - cerr << "Invalid parameter '" << cmds.at(3) << "', expected master or slave" << endl; + cerr << "Invalid parameter '" << cmds.at(3) << "', expected primary or secondary" << endl; return 1; } UeberBackend B("default"); @@ -3396,17 +3396,17 @@ try else if (cmds.at(0) == "deactivate-tsig-key") { string metaKey; if (cmds.size() < 4) { - cerr << "Syntax: " << cmds.at(0) << " ZONE NAME {master|slave}" << endl; + cerr << "Syntax: " << cmds.at(0) << " ZONE NAME {primary|secondary}" << endl; return 0; } DNSName zname(cmds.at(1)); string name = cmds.at(2); - if (cmds.at(3) == "master" || cmds.at(3) == "primary") + if (cmds.at(3) == "primary" || cmds.at(3) == "master") metaKey = "TSIG-ALLOW-AXFR"; - else if (cmds.at(3) == "slave" || cmds.at(3) == "secondary") + else if (cmds.at(3) == "secondary" || cmds.at(3) == "slave") metaKey = "AXFR-MASTER-TSIG"; else { - cerr << "Invalid parameter '" << cmds.at(3) << "', expected master or slave" << endl; + cerr << "Invalid parameter '" << cmds.at(3) << "', expected primary or secondary" << endl; return 1; }