From 84fc3f8b0504a294d107034bedbbcf7ddec920d3 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 21 May 2015 22:31:31 +0300 Subject: [PATCH] Add support for AXFR using GSS-TSIG --- pdns/tcpreceiver.cc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index e6710b797d..4ccf309c61 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -418,7 +418,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr q) if(q->d_havetsig) { // if you have one, it must be good TSIGRecordContent trc; string keyname, secret; - if(!checkForCorrectTSIG(q.get(), s_P->getBackend(), &keyname, &secret, &trc)) + if(!checkForCorrectTSIG(q.get(), s_P->getBackend(), &keyname, &secret, &trc)) { return false; } else { getTSIGHashEnum(trc.d_algoName, q->d_tsig_algo); @@ -432,15 +432,25 @@ bool TCPNameserver::canDoAXFR(shared_ptr q) DNSSECKeeper dk; - string algorithm=toLowerCanonic(trc.d_algoName); - if (algorithm == "hmac-md5.sig-alg.reg.int") - algorithm = "hmac-md5"; + if (q->d_tsig_algo == TSIG_GSS) { + vector princs; + s_P->getBackend()->getDomainMetadata(q->qdomain, "GSS-ALLOW-AXFR-PRINCIPAL", princs); + BOOST_FOREACH(const std::string& princ, princs) { + if (q->d_peer_principal == princ) { + L<qdomain<<"' allowed: TSIG signed request with authorized principal '"<d_peer_principal<<"' and algorithm 'gss-tsig'"<qdomain<<"' denied: TSIG signed request with principal '"<d_peer_principal<<"' and algorithm 'gss-tsig' is not permitted"<qdomain, keyname)) { - L<qdomain<<"' denied: key with name '"<qdomain<<"' denied: key with name '"<d_tsig_algo)<<"' does not grant access to zone"<qdomain<<"' allowed: TSIG signed request with authorized key '"<qdomain<<"' allowed: TSIG signed request with authorized key '"<d_tsig_algo)<<"'"< q, int out string algorithm=toLowerCanonic(trc.d_algoName); if (algorithm == "hmac-md5.sig-alg.reg.int") algorithm = "hmac-md5"; - Lock l(&s_plock); - s_P->getBackend()->getTSIGKey(tsigkeyname, &algorithm, &tsig64); - B64Decode(tsig64, tsigsecret); + if (algorithm != "gss-tsig") { + Lock l(&s_plock); + s_P->getBackend()->getTSIGKey(tsigkeyname, &algorithm, &tsig64); + B64Decode(tsig64, tsigsecret); + } } -- 2.47.3