Several more SSO/OIDC related fixes, and bump version to 1.8.9.

This commit is contained in:
Adam Ierymenko 2022-04-19 21:29:11 -04:00
parent ef08346a74
commit ee0a194b25
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3
8 changed files with 27 additions and 21 deletions

View File

@ -5,6 +5,8 @@ ZeroTier Release Notes
* Fixed a long-standing and strange bug that was causing sporadic "phantom" packet authentication failures. Not a security problem but could be behind spordaic reports of link failures under some conditions. * Fixed a long-standing and strange bug that was causing sporadic "phantom" packet authentication failures. Not a security problem but could be behind spordaic reports of link failures under some conditions.
* Fized a memory leak in SSO/OIDC support. * Fized a memory leak in SSO/OIDC support.
* Fixed a network certificate P2P distribution bug that affected SSO/OIDC support.
* Fixed SSO/OIDC display error on CLI.
# 2022-04-11 -- Version 1.8.8 # 2022-04-11 -- Version 1.8.8

View File

@ -530,14 +530,9 @@
#define ZT_PUSH_DIRECT_PATHS_MAX_PER_SCOPE_AND_FAMILY 8 #define ZT_PUSH_DIRECT_PATHS_MAX_PER_SCOPE_AND_FAMILY 8
/** /**
* Time horizon for VERB_NETWORK_CREDENTIALS cutoff * Rate limit for network credential pushes from peer.
*/ */
#define ZT_PEER_CREDENTIALS_CUTOFF_TIME 60000 #define ZT_PEER_CREDENTIALS_RATE_LIMIT 1000
/**
* Maximum number of VERB_NETWORK_CREDENTIALS within cutoff time
*/
#define ZT_PEER_CREDENTIALS_CUTOFF_LIMIT 15
/** /**
* Rate limit for responding to peer credential requests * Rate limit for responding to peer credential requests

View File

@ -1057,10 +1057,8 @@ bool IncomingPacket::_doNETWORK_CONFIG(const RuntimeEnvironment *RR,void *tPtr,c
{ {
const SharedPtr<Network> network(RR->node->network(at<uint64_t>(ZT_PACKET_IDX_PAYLOAD))); const SharedPtr<Network> network(RR->node->network(at<uint64_t>(ZT_PACKET_IDX_PAYLOAD)));
if (network) { if (network) {
//fprintf(stderr, "IncomingPacket::_doNETWORK_CONFIG %.16llx\n", network->id());
const uint64_t configUpdateId = network->handleConfigChunk(tPtr,packetId(),source(),*this,ZT_PACKET_IDX_PAYLOAD); const uint64_t configUpdateId = network->handleConfigChunk(tPtr,packetId(),source(),*this,ZT_PACKET_IDX_PAYLOAD);
if (configUpdateId) { if (configUpdateId) {
//fprintf(stderr, "Have config update ID: %llu\n", configUpdateId);
Packet outp(peer->address(), RR->identity.address(), Packet::VERB_OK); Packet outp(peer->address(), RR->identity.address(), Packet::VERB_OK);
outp.append((uint8_t)Packet::VERB_ECHO); outp.append((uint8_t)Packet::VERB_ECHO);
outp.append((uint64_t)packetId()); outp.append((uint64_t)packetId());
@ -1069,9 +1067,7 @@ bool IncomingPacket::_doNETWORK_CONFIG(const RuntimeEnvironment *RR,void *tPtr,c
const int64_t now = RR->node->now(); const int64_t now = RR->node->now();
outp.armor(peer->key(),true,peer->aesKeysIfSupported()); outp.armor(peer->key(),true,peer->aesKeysIfSupported());
peer->recordOutgoingPacket(_path,outp.packetId(),outp.payloadLength(),outp.verb(),ZT_QOS_NO_FLOW,now); peer->recordOutgoingPacket(_path,outp.packetId(),outp.payloadLength(),outp.verb(),ZT_QOS_NO_FLOW,now);
if (!_path->send(RR,tPtr,outp.data(),outp.size(),RR->node->now())) { _path->send(RR,tPtr,outp.data(),outp.size(),RR->node->now());
//fprintf(stderr, "Error sending VERB_OK after NETWORK_CONFIG packet for %.16llx\n", network->id());
}
} }
} }

View File

@ -65,6 +65,8 @@ public:
void pushCredentials(const RuntimeEnvironment *RR,void *tPtr,const int64_t now,const Address &peerAddress,const NetworkConfig &nconf); void pushCredentials(const RuntimeEnvironment *RR,void *tPtr,const int64_t now,const Address &peerAddress,const NetworkConfig &nconf);
inline int64_t lastPushedCredentials() { return _lastPushedCredentials; } inline int64_t lastPushedCredentials() { return _lastPushedCredentials; }
inline int64_t comTimestamp() { return _com.timestamp(); }
inline int64_t comRevocationThreshold() { return _comRevocationThreshold; }
/** /**
* Check whether we should push MULTICAST_LIKEs to this peer, and update last sent time if true * Check whether we should push MULTICAST_LIKEs to this peer, and update last sent time if true

View File

@ -1223,10 +1223,16 @@ void Network::requestConfiguration(void *tPtr)
bool Network::gate(void *tPtr,const SharedPtr<Peer> &peer) bool Network::gate(void *tPtr,const SharedPtr<Peer> &peer)
{ {
const int64_t now = RR->node->now(); const int64_t now = RR->node->now();
//int64_t comTimestamp = 0;
//int64_t comRevocationThreshold = 0;
Mutex::Lock _l(_lock); Mutex::Lock _l(_lock);
try { try {
if (_config) { if (_config) {
Membership *m = _memberships.get(peer->address()); Membership *m = _memberships.get(peer->address());
//if (m) {
// comTimestamp = m->comTimestamp();
// comRevocationThreshold = m->comRevocationThreshold();
//}
if ( (_config.isPublic()) || ((m)&&(m->isAllowedOnNetwork(_config, peer->identity()))) ) { if ( (_config.isPublic()) || ((m)&&(m->isAllowedOnNetwork(_config, peer->identity()))) ) {
if (!m) if (!m)
m = &(_membership(peer->address())); m = &(_membership(peer->address()));
@ -1237,7 +1243,8 @@ bool Network::gate(void *tPtr,const SharedPtr<Peer> &peer)
} }
} }
} catch ( ... ) {} } catch ( ... ) {}
//printf("%.16llx %.10llx not allowed\n", _id, peer->address().toInt()); fflush(stdout); //printf("%.16llx %.10llx not allowed, COM ts %lld revocation %lld\n", _id, peer->address().toInt(), comTimestamp, comRevocationThreshold); fflush(stdout);
return false; return false;
} }

View File

@ -390,11 +390,11 @@ public:
*/ */
inline bool rateGateCredentialsReceived(const int64_t now) inline bool rateGateCredentialsReceived(const int64_t now)
{ {
if ((now - _lastCredentialsReceived) <= ZT_PEER_CREDENTIALS_CUTOFF_TIME) if ((now - _lastCredentialsReceived) >= ZT_PEER_CREDENTIALS_RATE_LIMIT) {
++_credentialsCutoffCount; _lastCredentialsReceived = now;
else _credentialsCutoffCount = 0; return true;
_lastCredentialsReceived = now; }
return (_credentialsCutoffCount < ZT_PEER_CREDENTIALS_CUTOFF_LIMIT); return false;
} }
/** /**
@ -563,7 +563,6 @@ private:
Identity _id; Identity _id;
unsigned int _directPathPushCutoffCount; unsigned int _directPathPushCutoffCount;
unsigned int _credentialsCutoffCount;
unsigned int _echoRequestCutoffCount; unsigned int _echoRequestCutoffCount;
AtomicCounter __refCount; AtomicCounter __refCount;

View File

@ -775,7 +775,12 @@ static int cli(int argc,char **argv)
if (status == "AUTHENTICATION_REQUIRED") { if (status == "AUTHENTICATION_REQUIRED") {
printf(" AUTH EXPIRED, URL: %s" ZT_EOL_S, OSUtils::jsonString(n["authenticationURL"], "(null)").c_str()); printf(" AUTH EXPIRED, URL: %s" ZT_EOL_S, OSUtils::jsonString(n["authenticationURL"], "(null)").c_str());
} else if (status == "OK") { } else if (status == "OK") {
printf(" AUTH OK, expires in: %lld seconds" ZT_EOL_S, ((int64_t)authenticationExpiryTime - OSUtils::now()) / 1000LL); int64_t expiresIn = ((int64_t)authenticationExpiryTime - OSUtils::now()) / 1000LL;
if (expiresIn >= 0) {
printf(" AUTH OK, expires in: %lld seconds" ZT_EOL_S, expiresIn);
} else {
printf(" AUTH OK, refreshing..." ZT_EOL_S);
}
} }
} }
} }

View File

@ -27,7 +27,7 @@
/** /**
* Revision * Revision
*/ */
#define ZEROTIER_ONE_VERSION_REVISION 8 #define ZEROTIER_ONE_VERSION_REVISION 9
/** /**
* Build version * Build version