Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monclient: avoid key renew storm on clock skew #8258

Merged
merged 1 commit into from Mar 31, 2016

Conversation

asheplyakov
Copy link

Refreshing rotating keys too often is a symptom of a clock skew, try to
detect it and don't cause extra problems:

  • MonClient::_check_auth_rotating:
    • detect and report premature keys expiration due to a time skew
    • rate limit refreshing the keys to avoid excessive RAM and CPU usage
      (both by OSD in question and monitors which have to process a lot
      of auth messages)
  • MonClient::wait_auth_rotating: wait for valid (not expired) keys
  • OSD::init(): bail out after 10 attempts to obtain the rotating keys

Fixes: #12065

Signed-off-by: Alexey Sheplyakov asheplyakov@mirantis.com

Refreshing rotating keys too often is a symptom of a clock skew, try to
detect it and don't cause extra problems:

* MonClient::_check_auth_rotating:
  - detect and report premature keys expiration due to a time skew
  - rate limit refreshing the keys to avoid excessive RAM and CPU usage
    (both by OSD in question and monitors which have to process a lot
    of auth messages)
* MonClient::wait_auth_rotating: wait for valid (not expired) keys
* OSD::init(): bail out after 10 attempts to obtain the rotating keys

Fixes: ceph#12065

Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
@@ -840,9 +844,22 @@ int MonClient::_check_auth_rotating()
}

ldout(cct, 10) << "_check_auth_rotating renewing rotating keys (they expired before " << cutoff << ")" << dendl;
if (!rotating_secrets->need_new_secrets() &&
rotating_secrets->need_new_secrets(issued_at_lower_bound)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need_new_secrets is

bool need_new_secrets(utime_t now) const {
return secrets.size() < KEY_ROTATE_NUM || current().expiration <= now;
}

and issued_at_lower_bound is before now.. when will this ever be true?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the client (OSD) system clock is off by a few hours (in the future) with respect to monitor.

@liewegas liewegas added this to the jewel milestone Mar 28, 2016
@liewegas liewegas self-assigned this Mar 28, 2016
@liewegas liewegas merged commit b5f8cac into ceph:master Mar 31, 2016
@asheplyakov asheplyakov deleted the bug-12065 branch November 24, 2016 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants