Commit Graph

94642 Commits

Author SHA1 Message Date
Sage Weil
c7ee66c3e5 auth,msg/async/ProtocolV2: negotiate connection modes
The modes are:

- crc: crc32c checksums to protect against bit errors.  No secrecy or
  authenticity guarantees, so a MITM could alter traffic in flight.
- secure: cryptographic secrecy and authenticity proection (i.e, encrypted
  and signed).

We do not include a 'signed' mode that provides authenticity without
secrecy because the cryptographic protocols appear to be faster than
SHA-2.

New settings:

- ms_cluster_mode  : mode(s list) for intra-cluster connections
- ms_service_mode  : mode(s list) for daemons to allow
- ms_client_mode   : mode(s list) for clients to allow

Also,

- ms_mon_cluster_mode  : mon <-> mon connections
- ms_mon_service_mode  : mon <-> daemon or client connections

The msgr2 protocol is expanded slightly to negotiate a mode.  Client
shares it's allowed/preferred modes, and server picks one as auth finishes.
Negotiation is independent of the authentication, except that the
authentiction mode may precluse certain choices. Specifically, AUTH_NONE
does not support 'secure', only 'crc'.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 12:10:33 -06:00
Sage Weil
9c3dd336b7 auth/AuthRegistry: refactor handling of auth_*_requred options
- simplify/consolidate my type and peer type effects on auth method
- watch for runtime config changes

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 12:10:33 -06:00
Sage Weil
fa7c83f6dc osd,mgr,mds: remove unused authorize registries
These are handled by AuthClient and AuthServer now.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 12:10:33 -06:00
Sage Weil
1d29722f80 switch monc, daemons to use new msgr2 auth frame exchange
- MonClient implements AuthClient to authenticate as a client
- MonClient implements AuthServer to allow daemons to verify authorizers
- Monitor implements AuthServer to allow clients to authenticate with
  an exchange of msgr2 frames
- Monitor implements AuthClient to authenticate with other monitors

After this change ProtocolV1 and SimpleMessenger still use all of the
old Dispatcher-based callbacks, but ProtocolV2 doesn't need them at
all (except for ms_handle_authentication when we finish).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 12:10:33 -06:00
Sage Weil
c1a2d1be52 doc/dev/msgr2: update docs to match implementation for auth frames
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
ee2e31b244 auth/AuthClientHandler: add build_initial_request hook
With msgr2 the initial kickoff of an authentication handshake is client ->
server, while with msgr1 it was server -> client.  So existing
implementations have an empty initial message (outside of the messenger's
envelope).  Future auth implementations that are msgr2 only (e.g., krb)
may want to make use of this initial payload.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
d0dc20ed9a msg/Messenger: attach auth_client and/or auth_server to each Messenger
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
cfe7f4992b auth: introduce AuthClient and AuthServer handlers
These will be the primary interfaces consumed by the messenger and
implemented by either MonClient (regular client, or service daemon) or
Monitor for doing authentication.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
f152b4aae1 auth: codify AUTH_MODE_AUTHORIZER
The AuthAuthorizer encoding always begins with byte 0x01.  Codify that
as AUTH_MODE_AUTHORIZER so that we can distinguish an authorizer from
something else (e.g., an attempt to authenticate and get an initial auth
ticket with the mon).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
5bd92c29d9 msg/Connection: track peer_id (id portion of entity_name_t) for msgr2
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
a7d6a54f73 auth/AuthAuthorizeHandler: add get_supported_methods()
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
0267fb04ff auth/AuthAuthorizeHandler: fix args for verify_authorizer()
const bufferlists in, pointers for output args.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
4f78af7d69 auth: constify bufferlist arg to AuthAuthorizer::add_challenge()
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
1adf313ef9 auth/cephx: share all tickets and connection_secret in initial reply
Previously, we would give the client the auth ticket, like a rbd TGT
(ticket granting ticket), and the client would then ask for all of the
other tickets it wants in a separate message.

Instead, have the client specify which tickets it wants up front and pass
them all at the same time.

Also, generate and share the connection_secret, which will be used for
encryption.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
7dd93be90a msg/async,auth: add AuthConnectionMeta to Protocol
This will hold all of the authentication-related state in an easy-to-find
section that can be accessed via a Connection* or by the protocol stack
(as needed).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
fc90a084c4 auth/AuthClientHandler: pass in session_key, connection_secret pointers
No functional change.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
a34fe37418 auth/AuthServiceHandler: take session_key and connection_secret as args
Allow these methods to populate session and connection secrets.

No functional change (yet).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
c0d270a434 auth/cephx: pass more specific type into build_session_auth_info
We were passing CephXServiceTicketInfo in, but the only part of it we
needed was the embedded AuthTicket.  Pass that instead.

No functional change.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
c1aacdd85e mon/Session: separate session creation, peer ident, and registration
- We can now construct a session before we know who it is
- We can later call _ident to identify it
- and also later register it in the session map

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
6663d17ad7 mon/AuthMonitor: bump max_global_id from on_active() and tick()
We should get some runway even if there isn't an auth request coming in.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
91dd0c9787 mon/AuthMonitor: be more careful with max_global_id
We're potentially handing out ids that haven't committed by increasing
max_global_id before it commits.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
596fcff1ed mon: only all ms_handle_authentication() if auth method says we're done
Previously we would call ms_handle_authentication() possibly multiple
times, and without knowning whether it might succeed. Instead, only call
it when start_session() or handle_request() returns >0 to indicate that
we should.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
da326e7ab8 mon/AuthMonitor: fix "finished with auth" condition check
We are sending the monmap prematurely (before we finish the authentication
handshake).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
133481ffd7 auth: clean up AuthServiceHandler::handle_request() args
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
57c72346c7 auth: clean up AuthServiceHandler::start_session()
- return error code, not type (which never changes)
- take const ref for input args
- pointers for output args

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
090033abd0 mon/AuthMonitor: drop unused op arg to assign_global_id()
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
1c40968bd5 msg/async: separate TAG_AUTH_REQUEST_MORE and TAG_AUTH_REPLY_MORE
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:03 -06:00
Sage Weil
43548f743d msg/async: consolidate authorizer checks
No need to special-case auth methods at this layer.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:02 -06:00
Sage Weil
27f8ff6282 msg/async: move get_auth_allowed into ProtocolV2.cc
We're the only user, and no Dispatchers override.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:02 -06:00
Sage Weil
942396bdf9 mon/MonClient: trivial cleanup
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:53:02 -06:00
Sage Weil
a8935b3580 ceph_test_msgr: fix server->client addr discovery
The client's myaddr will be an ANY address, but the internel connection table
will use a v1: or v2: address.  Use the get_peer_addrs() to figure out how to
connect instead.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
80cc838b7b msg/{async,simple}: make learned_addr a bit smarter
Only set type ANY if we are a pure client; otherwise, preserve the
type.  Also, only populate the addr if we have a blank ip (sometimes
we already know it from learn_addr_unknowns).

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
cb0e7e0281 msg/async: very protocol type when looking up existing connections
Since we register client connections as any:, we may have either a ProtocolV1 or V2
connection.  This happens when clients have an imprecise mon search list and connect
to the same mon via both v1 and v2, for example when you do something like

 ceph -m 'v2:127.0.0.1:40648/0,v1:127.0.0.1:40649/0' -s

If we do encounter the other protocol type than what we expect, just mark it down and
proceed.  This is only a temporarily case that happens during mon discovery, the client
is always prepared to retry, and it doesn't actually matter which one succeeds since
it will return a monmap and the client will adapt accordingly.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
3518f794a2 common/LogEntry: use as_legacy_addr()
...just in case addrs has an any addr.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
f1f3b12df7 msg/msg_types: add entity_addrvec_t::as_legacy_addr()
Return either the actual legacy addr, or an any addr as a legacy addr.  If
neither is available, lie and return a v2 (or other) addr as a legacy adr.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
1c26e4d0f6 msg/async/AsyncMessenger: drop weird assert
I'm not sure what this was intended for originally...

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
d2d632192a msg/Messenger: be less verbose
This message has been annoying me

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
48dd8d04b4 msg/simple: learn client addr as type any
Just like AsyncMessenger.  Best to be consistent!

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
c6c5636b2d msg/simple: set_addr_unknowns(): use front(), not legacy_addr()
We may be passed an any: address.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
37e4f613d5 msg/msg_types: drop any: prefix
If it can be any type of address, then simply don't specify the type.  This
is less confusing for humans.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
ec8cc63910 remove all Messenger::get_myaddr() users
Use get_myaddrs() instead and join the glorious future.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
82e91aa2f5 test/crimson: fix DummyAuthAuthorizer
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:13:09 -06:00
Sage Weil
e01af63269 mon/MonClient: kill get_myaddr()
Not used, and wrong.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:12:43 -06:00
Sage Weil
c64bed3b23 msg/async/ProtocolV1: use legacy v1 address, not any, in protocol
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:12:43 -06:00
Sage Weil
2bc41b4485 msg/Messenger: add get_myaddr_legacy()
This returns a legacy v1 address out of a v1 or any address.  It's
intended to be used in contexts where we *always* want a v1 address,
like SimpleMessenger.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:12:43 -06:00
Sage Weil
3e938143eb msg/msg_types: add entity_addr_t::is_any()
Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:12:43 -06:00
Ricardo Dias
03bc0dcdda msg/async: msgr2: send entity type and peer_address in Tag::HELLO frame
Signed-off-by: Ricardo Dias <rdias@suse.com>
2019-02-07 06:12:43 -06:00
Sage Weil
db320dd096 msg/async: identify client using any: addr
The client can speak v1 or v2, so it is misleading to identify it with a v1 or v2
address (it is either).  This avoid some kludgey workarounds.

We also are a bit more precise about what target_addr means.  It is only used by
the client to indicate which of the peer_addrs we are connecting to, or by a
peer to identify which the peer_addrs we *would* reconnect to.

Signed-off-by: Sage Weil <sage@redhat.com>
2019-02-07 06:12:43 -06:00
Lenz Grimmer
299f2e6629
Merge pull request #26198 from Exotelis/mobile-navigation
mgr/dashboard: Add description to menu items on mobile navigation
2019-02-07 11:05:50 +01:00
Lenz Grimmer
76dc9c6a16
Merge pull request #25346 from p-na/wip-pna-prettier-modified
mgr/dashboard: Fix modified files only (frontend)

Reviewed-by: Sebastian Krah <skrah@suse.com>
Reviewed-by: Stephan Müller <smueller@suse.com>
2019-02-07 11:04:31 +01:00