| 492 | // ---------------------- |
| 493 | |
| 494 | int MonClient::init() |
| 495 | { |
| 496 | ldout(cct, 10) << __func__ << dendl; |
| 497 | |
| 498 | std::lock_guard l(monc_lock); |
| 499 | stopping = false; |
| 500 | |
| 501 | entity_name = cct->_conf->name; |
| 502 | |
| 503 | auth_registry.refresh_config(); |
| 504 | |
| 505 | keyring.reset(new KeyRing); |
| 506 | if (auth_registry.is_supported_method(messenger->get_mytype(), |
| 507 | CEPH_AUTH_CEPHX)) { |
| 508 | // this should succeed, because auth_registry just checked! |
| 509 | int r = keyring->from_ceph_context(cct); |
| 510 | if (r != 0) { |
| 511 | // but be somewhat graceful in case there was a race condition |
| 512 | lderr(cct) << "keyring not found" << dendl; |
| 513 | return r; |
| 514 | } |
| 515 | } |
| 516 | if (!auth_registry.any_supported_methods(messenger->get_mytype())) { |
| 517 | return -ENOENT; |
| 518 | } |
| 519 | |
| 520 | rotating_secrets.reset( |
| 521 | new RotatingKeyRing(cct, cct->get_module_type(), keyring.get())); |
| 522 | |
| 523 | initialized = true; |
| 524 | |
| 525 | messenger->set_auth_client(this); |
| 526 | messenger->add_dispatcher_head(this, Dispatcher::PRIORITY_HIGH); |
| 527 | |
| 528 | timer.init(); |
| 529 | schedule_tick(); |
| 530 | |
| 531 | cct->get_admin_socket()->register_command( |
| 532 | "rotate-key", |
| 533 | this, |
| 534 | "rotate live authentication key"); |
| 535 | |
| 536 | return 0; |
| 537 | } |
| 538 | |
| 539 | void MonClient::shutdown() |
| 540 | { |
no test coverage detected