]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: mds gets rotating secrets
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 30 Sep 2009 21:02:08 +0000 (14:02 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 30 Sep 2009 21:02:08 +0000 (14:02 -0700)
src/auth/Auth.h
src/mds/MDS.cc
src/mon/MonClient.cc

index bb2684db7d38f1117ffe9013456a1ef93d36a503..13052ebde253ba4bbb328b74185d9170237d11fd 100644 (file)
@@ -324,6 +324,12 @@ int encode_encrypt(const T& t, CryptoKey& key, bufferlist& out) {
   return 0;
 }
 
+static inline bool auth_principal_needs_rotating_keys(EntityName& name)
+{
+  return ((name.entity_type == CEPHX_PRINCIPAL_OSD) ||
+          (name.entity_type == CEPHX_PRINCIPAL_MDS));
+}
+
 /*
  * Verify authorizer and generate reply authorizer
  */
index 27613e647afd4a0c2e418b7d0b1c73044e207e7f..a9eae366554d1ba7b28def849fc635f9a0e285f3 100644 (file)
@@ -383,6 +383,9 @@ int MDS::init()
 
   monc->get_monmap();
 
+  monc->wait_authenticate(30.0);
+  monc->wait_auth_rotating(30.0);
+
   mds_lock.Lock();
 
   // starting beacon.  this will induce an MDSMap from the monitor
@@ -395,8 +398,6 @@ int MDS::init()
 
   monc->sub_want("mdsmap", 0);
   monc->renew_subs();
-  monc->wait_authenticate(30.0);
-  monc->wait_auth_rotating(30.0);
 
   // schedule tick
   reset_tick();
index 52c26368be08e28fdd3629e1d2fa75bd51ccf2dd..d408983b709c91967efe6e267d0aa2770940ea1b 100644 (file)
@@ -501,7 +501,7 @@ int MonClient::authorize(double timeout)
 
 int MonClient::_start_auth_rotating()
 {
-  if (entity_name.entity_type != CEPHX_PRINCIPAL_OSD)
+  if (!auth_principal_needs_rotating_keys(entity_name))
     return 0;
 
   MAuthRotating *m = new MAuthRotating();
@@ -512,26 +512,6 @@ int MonClient::_start_auth_rotating()
 
   dout(0) << "MonClient::_start_auth_rotating sending message" << dendl;
   _send_mon_message(m);
-#if 0
-  auth_timeout_event = new C_AuthRotatingTimeout(this, timeout);
-  if (!auth_timeout_event)
-    return -ENOMEM;
-  timer.add_event_after(timeout, auth_timeout_event);
-
-  dout(0) << "MonClient::_start_auth_rotating waiting" << dendl;
-  auth_cond.Wait(monc_lock);
-  dout(0) << "MonClient::_start_auth_rotating wait ended" << dendl;
-
-  if (auth_got_timeout) {
-    dout(0) << "MonClient::_start_auth_rotating got timeout" << dendl;
-    return -ETIMEDOUT;
-  }
-
-  if (auth_timeout_event) {
-    timer.cancel_event(auth_timeout_event);
-    auth_timeout_event = NULL;
-  }
-#endif
 
   return 0;
 }
@@ -550,7 +530,7 @@ int MonClient::wait_auth_rotating(double timeout)
 {
   Mutex::Locker l(monc_lock);
 
-  if (entity_name.entity_type != CEPHX_PRINCIPAL_OSD)
+  if (!auth_principal_needs_rotating_keys(entity_name))
     return 0;
 
   if (!g_keyring.need_rotating_secrets())