mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-02 07:20:51 +00:00
Fix cert verification check for self signed signatures
This commit is contained in:
parent
57c7992c78
commit
8a68624dae
@ -286,18 +286,28 @@ void Network::addMembershipCertificate(const CertificateOfMembership &cert,bool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPtr<Peer> signer(RR->topology->getPeer(cert.signedBy()));
|
if (cert.signedBy() == RR->identity.address()) {
|
||||||
|
// We are the controller: RR->identity.address() == controller() == cert.signedBy()
|
||||||
|
// So, verify that we signed th cert ourself
|
||||||
|
if (!cert.verify(RR->identity)) {
|
||||||
|
TRACE("rejected network membership certificate for %.16llx self signed by %s: signature check failed",(unsigned long long)_id,cert.signedBy().toString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
if (!signer) {
|
SharedPtr<Peer> signer(RR->topology->getPeer(cert.signedBy()));
|
||||||
// This would be rather odd, since this is our controller... could happen
|
|
||||||
// if we get packets before we've gotten config.
|
|
||||||
RR->sw->requestWhois(cert.signedBy());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cert.verify(signer->identity())) {
|
if (!signer) {
|
||||||
TRACE("rejected network membership certificate for %.16llx signed by %s: signature check failed",(unsigned long long)_id,cert.signedBy().toString().c_str());
|
// This would be rather odd, since this is our controller... could happen
|
||||||
return;
|
// if we get packets before we've gotten config.
|
||||||
|
RR->sw->requestWhois(cert.signedBy());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cert.verify(signer->identity())) {
|
||||||
|
TRACE("rejected network membership certificate for %.16llx signed by %s: signature check failed",(unsigned long long)_id,cert.signedBy().toString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user