]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
6 years agoosd/OSD: respect osdmap message limits 26340/head
Sage Weil [Fri, 8 Feb 2019 14:59:52 +0000 (08:59 -0600)]
osd/OSD: respect osdmap message limits

We restructure the function significantly to let us work forwards instead
of backwards through epochs.  We also make the assumption that the OSD
will have the maps it is supposed to have.  If we for some reason fail to
load a map, we fall back to something minimal, but in general there is
little point to sending a more complete message when local maps are missing
since it shouldn't ever happen anyway and the receiver can always go get
maps from the mon.

Fixes: http://tracker.ceph.com/issues/38040
Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/OSDMonitor: limit MOSDMap message size by bytes
Sage Weil [Fri, 8 Feb 2019 13:22:28 +0000 (07:22 -0600)]
mon/OSDMonitor: limit MOSDMap message size by bytes

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agocommon/options: add osd_map_message_max_bytes
Sage Weil [Fri, 8 Feb 2019 13:22:20 +0000 (07:22 -0600)]
common/options: add osd_map_message_max_bytes

Limit MOSDMap message size by bytes as well as map count.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoMerge pull request #26317 from jtlayton/wip-jlayton-orch
Sebastian Wagner [Fri, 8 Feb 2019 09:58:46 +0000 (10:58 +0100)]
Merge pull request #26317 from jtlayton/wip-jlayton-orch

mgr/orchestrator: Fix up rook osd create dispatcher

Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com>
6 years agoMerge pull request #26331 from tchaikov/wip-mgr-orchestrator-docstring
Sebastian Wagner [Fri, 8 Feb 2019 08:33:05 +0000 (09:33 +0100)]
Merge pull request #26331 from tchaikov/wip-mgr-orchestrator-docstring

doc/mgr/orchestrator: Add Architecture Image

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com>
6 years agoMerge pull request #26301 from tchaikov/wip-cxx17-aggre-init
Kefu Chai [Fri, 8 Feb 2019 08:09:11 +0000 (16:09 +0800)]
Merge pull request #26301 from tchaikov/wip-cxx17-aggre-init

changes to address FTBFS on fc30

Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
Reviewed-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Adam C. Emerson <aemerson@redhat.com>
6 years agoMerge pull request #26311 from tchaikov/wip-docker-fc-29
Kefu Chai [Fri, 8 Feb 2019 06:37:51 +0000 (14:37 +0800)]
Merge pull request #26311 from tchaikov/wip-docker-fc-29

tests: update Dockerfile to support fc-29

Reviewed-By: Neha Ojha <nojha@redhat.com>
6 years agomgr/orchestrator: reformat the docstring 26331/head
Kefu Chai [Fri, 8 Feb 2019 06:27:35 +0000 (14:27 +0800)]
mgr/orchestrator: reformat the docstring

we need to add an empty line before the param and return lines.

so it renders better with sphinx's `automethod::` directive.

Signed-off-by: Kefu Chai <kchai@redhat.com>
6 years agoMerge pull request #26313 from tchaikov/wip-mgr-ansible-tox
Kefu Chai [Fri, 8 Feb 2019 05:12:25 +0000 (13:12 +0800)]
Merge pull request #26313 from tchaikov/wip-mgr-ansible-tox

mgr/ansible: add install tox==2.9.1

Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com>
6 years agoMerge pull request #26213 from dzafman/wip-38041
David Zafman [Fri, 8 Feb 2019 01:26:34 +0000 (17:26 -0800)]
Merge pull request #26213 from dzafman/wip-38041

osd: Fix recovery and backfill priority handling

Reviewed-by: Neha Ojha <nojha@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
6 years agotest: Add scripts to test backfill/recovery priority handling 26213/head
David Zafman [Sat, 26 Jan 2019 19:16:17 +0000 (11:16 -0800)]
test: Add scripts to test backfill/recovery priority handling

Signed-off-by: David Zafman <dzafman@redhat.com>
6 years agoosd: Add OSD_BACKFILL_PRIORITY_FORCED with lower priority
David Zafman [Fri, 1 Feb 2019 07:04:03 +0000 (23:04 -0800)]
osd: Add OSD_BACKFILL_PRIORITY_FORCED with lower priority
than OSD_RECOVERY_PRIORITY_FORCED

Signed-off-by: David Zafman <dzafman@redhat.com>
6 years agoosd AsyncReserver: Update priority in AsyncReserver for force and cancel-force
David Zafman [Sat, 26 Jan 2019 00:04:11 +0000 (16:04 -0800)]
osd AsyncReserver: Update priority in AsyncReserver for force and cancel-force

Fixes: http://tracker.ceph.com/issues/38041
Signed-off-by: David Zafman <dzafman@redhat.com>
6 years agoMerge PR #26059 into master
Sage Weil [Thu, 7 Feb 2019 22:51:39 +0000 (16:51 -0600)]
Merge PR #26059 into master

* refs/pull/26059/head:
mon/MonClient: fix keepalive with v2 auth
msg/async/ProtocolV2: reject peer_addrs of -
msg/async/ProtocolV2: clean up feature management
mon/MonClient: set up rotating_secrets, etc before msgr ready
msg/async: let client specify preferred order of modes
msg/async/ProtocolV2: include entity_name, features in reconnect
msg/async/ProtocolV2: fix write_lock usage around AckFrame
qa/suites/rados/verify/validator/valgrind: debug refs = 5
qa/standalone/ceph-helpers: fix health_ok test
auth/AuthRegistry: only complain about disabling cephx if cephx was enabled
auth/AuthRegistry: fix locking for get_supported_methods()
auth: remove AUTH_UNKNOWN weirdness, hardcoded defaults.
msg/async/ProtocolV2: remove unused get_auth_allowed_methods
osd: set up messener auth_* before setting dispatcher (and going 'ready')
mon/AuthMonitor: request max_global_id increase from peon in tick
mon: prime MgrClient only after messengers are initialized
qa/suites/rados/workloads/rados_api_tests.yaml: debug mgrc = 20 on mon
auth: document Auth{Client,Server} interfaces
auth: future-proof AUTH_MODE_* a bit in case we need to change the encoding byte
mon/MonClient: request monmap on open instead of ping
mgr/PyModuleRegistry: add details for MGR_MODULE_{DEPENDENCY,ERROR}
crimson: fix build
mon/MonClient: finsih authenticate() only after we get monmap; fix 'tell mgr'
mon: add auth_lock to protect auth_meta manipulation
ceph-mon: set up auth before binding
mon: defer initial connection auth attempts until initial quorum is formed
mon/MonClient: make MonClientPinger an AuthCleint
ceph_test_msgr: use DummyAuth
auth/DummyAuth: dummy auth server and client for test code
mon/Monitor: fix leak of auth_handler if we error out
doc/dev/cephx: re-wordwrap
doc/dev/cephx: document nautilus change to cephx
vstart.sh: fix --msgr2 option
msg/async/ProtocolV2: use shared_ptr to manage auth_meta
auth/Auth{Client,Server}: pass auth_meta in explicitly
mon/MonClient: behave if authorizer can't be built (yet)
osd: set_auth_server on client_messenger
common/ceph_context: get_moduel_type() for seastar cct
auth: make connection_secret a std::string
auth,msg/async/ProtocolV2: negotiate connection modes
auth/AuthRegistry: refactor handling of auth_*_requred options
osd,mgr,mds: remove unused authorize registries
switch monc, daemons to use new msgr2 auth frame exchange
doc/dev/msgr2: update docs to match implementation for auth frames
auth/AuthClientHandler: add build_initial_request hook
msg/Messenger: attach auth_client and/or auth_server to each Messenger
auth: introduce AuthClient and AuthServer handlers
auth: codify AUTH_MODE_AUTHORIZER
msg/Connection: track peer_id (id portion of entity_name_t) for msgr2
auth/AuthAuthorizeHandler: add get_supported_methods()
auth/AuthAuthorizeHandler: fix args for verify_authorizer()
auth: constify bufferlist arg to AuthAuthorizer::add_challenge()
auth/cephx: share all tickets and connection_secret in initial reply
msg/async,auth: add AuthConnectionMeta to Protocol
auth/AuthClientHandler: pass in session_key, connection_secret pointers
auth/AuthServiceHandler: take session_key and connection_secret as args
auth/cephx: pass more specific type into build_session_auth_info
mon/Session: separate session creation, peer ident, and registration
mon/AuthMonitor: bump max_global_id from on_active() and tick()
mon/AuthMonitor: be more careful with max_global_id
mon: only all ms_handle_authentication() if auth method says we're done
mon/AuthMonitor: fix "finished with auth" condition check
auth: clean up AuthServiceHandler::handle_request() args
auth: clean up AuthServiceHandler::start_session()
mon/AuthMonitor: drop unused op arg to assign_global_id()
msg/async: separate TAG_AUTH_REQUEST_MORE and TAG_AUTH_REPLY_MORE
msg/async: consolidate authorizer checks
msg/async: move get_auth_allowed into ProtocolV2.cc
mon/MonClient: trivial cleanup

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
6 years agomon/MonClient: fix keepalive with v2 auth 26059/head
Sage Weil [Thu, 7 Feb 2019 18:28:20 +0000 (12:28 -0600)]
mon/MonClient: fix keepalive with v2 auth

The old trick of queuing a keepalive sequenced before auth does not work
when auth happens earlier in the process.  Work around it.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: reject peer_addrs of -
Sage Weil [Thu, 7 Feb 2019 15:47:54 +0000 (09:47 -0600)]
msg/async/ProtocolV2: reject peer_addrs of -

This shouldn't happen and isn't valid.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: clean up feature management
Sage Weil [Thu, 7 Feb 2019 14:47:57 +0000 (08:47 -0600)]
msg/async/ProtocolV2: clean up feature management

- check features on reconnect
- preserve features when connections are replaced
- require MSG_ADDR2 across the board

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/MonClient: set up rotating_secrets, etc before msgr ready
Sage Weil [Wed, 6 Feb 2019 04:26:52 +0000 (22:26 -0600)]
mon/MonClient: set up rotating_secrets, etc before msgr ready

We need to have rotating_secrets non-null before we can accept
connections or else we will segfault in handle_auth_request.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async: let client specify preferred order of modes
Sage Weil [Wed, 6 Feb 2019 23:43:42 +0000 (17:43 -0600)]
msg/async: let client specify preferred order of modes

The server side has an allowed list, while the client has an ordered list
in order of preference.

Note that some of the options are used as both (e.g., cluster_modes) as they
are used at both connecting and accepting ends of the connection.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: include entity_name, features in reconnect
Sage Weil [Wed, 6 Feb 2019 03:41:14 +0000 (21:41 -0600)]
msg/async/ProtocolV2: include entity_name, features in reconnect

- A connects to B
- A sends client_ident
- fault before A gets server_ident, so A doesn't know B's features or name
- B reconnects to A
- connection established

A thinks B is unknown.0 and has not idea what the featurs are.

Fix this by including id and featurs in reconnect.  We don't know the type, but that is
included in TAG_HELLO in another branch, which will be merged separately; add a

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: fix write_lock usage around AckFrame
Sage Weil [Tue, 5 Feb 2019 16:32:05 +0000 (10:32 -0600)]
msg/async/ProtocolV2: fix write_lock usage around AckFrame

If we are calling _try_send or touching outcoming_bl we must be holding
write_lock.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoqa/suites/rados/verify/validator/valgrind: debug refs = 5
Sage Weil [Tue, 5 Feb 2019 13:30:52 +0000 (07:30 -0600)]
qa/suites/rados/verify/validator/valgrind: debug refs = 5

If we detect a leak, let's include logging so we can find it.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoqa/standalone/ceph-helpers: fix health_ok test
Sage Weil [Tue, 5 Feb 2019 11:41:28 +0000 (05:41 -0600)]
qa/standalone/ceph-helpers: fix health_ok test

Stopping the osd daemon won't reliably get you HEALTH_WARN or ERR; you have
to make sure it is also marked down.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthRegistry: only complain about disabling cephx if cephx was enabled
Sage Weil [Tue, 5 Feb 2019 11:39:01 +0000 (05:39 -0600)]
auth/AuthRegistry: only complain about disabling cephx if cephx was enabled

This gets rid of some warnings when auth_supported=none.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthRegistry: fix locking for get_supported_methods()
Sage Weil [Mon, 4 Feb 2019 09:51:47 +0000 (03:51 -0600)]
auth/AuthRegistry: fix locking for get_supported_methods()

The other read-side accessors all consume this method and don't
need their own locking.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: remove AUTH_UNKNOWN weirdness, hardcoded defaults.
Sage Weil [Mon, 4 Feb 2019 09:34:33 +0000 (03:34 -0600)]
auth: remove AUTH_UNKNOWN weirdness, hardcoded defaults.

This is what the old code does so I kept it but I don't think it makes any sense.
Same with the defaults; let's just set the config option to something valid.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: remove unused get_auth_allowed_methods
Sage Weil [Mon, 4 Feb 2019 09:32:02 +0000 (03:32 -0600)]
msg/async/ProtocolV2: remove unused get_auth_allowed_methods

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoosd: set up messener auth_* before setting dispatcher (and going 'ready')
Sage Weil [Mon, 4 Feb 2019 09:28:06 +0000 (03:28 -0600)]
osd: set up messener auth_* before setting dispatcher (and going 'ready')

The messenger doesn't activate until you set the dispatcher.  Set up the auth_client
and auth_server values before that.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/AuthMonitor: request max_global_id increase from peon in tick
Sage Weil [Mon, 4 Feb 2019 08:48:56 +0000 (02:48 -0600)]
mon/AuthMonitor: request max_global_id increase from peon in tick

For authv2, we only increase max_global_id from tick, not via prep_auth(), so we
need to ask the leader for more IDs here as we do there.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon: prime MgrClient only after messengers are initialized
Sage Weil [Sun, 3 Feb 2019 19:58:48 +0000 (13:58 -0600)]
mon: prime MgrClient only after messengers are initialized

If we do it earlier we may crash due to an uninitialised messenger
auth_client.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoqa/suites/rados/workloads/rados_api_tests.yaml: debug mgrc = 20 on mon
Sage Weil [Sun, 3 Feb 2019 13:41:26 +0000 (07:41 -0600)]
qa/suites/rados/workloads/rados_api_tests.yaml: debug mgrc = 20 on mon

Seeing some hangs when the mon is forwarding mgr commands (pg deep-scrub)
to the mgr.  This is a buggy test (it should send it to the mgr directly)
but it is helpful to verify the mon forwarding behavior works.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: document Auth{Client,Server} interfaces
Sage Weil [Fri, 1 Feb 2019 18:17:07 +0000 (12:17 -0600)]
auth: document Auth{Client,Server} interfaces

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: future-proof AUTH_MODE_* a bit in case we need to change the encoding byte
Sage Weil [Fri, 1 Feb 2019 18:14:08 +0000 (12:14 -0600)]
auth: future-proof AUTH_MODE_* a bit in case we need to change the encoding byte

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/MonClient: request monmap on open instead of ping
Sage Weil [Fri, 1 Feb 2019 17:09:42 +0000 (11:09 -0600)]
mon/MonClient: request monmap on open instead of ping

The ping is useless.  The MMonGetMap ensures we get a monmap (and finish
authenticate()) before we get any other maps/messages, like mgr_map.
Getting other maps sooner rather than later can be confuse to MonClient
users because they will get dispatched MMgrMap before the authenticate()
call has returned.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomgr/PyModuleRegistry: add details for MGR_MODULE_{DEPENDENCY,ERROR}
Sage Weil [Thu, 31 Jan 2019 23:51:36 +0000 (17:51 -0600)]
mgr/PyModuleRegistry: add details for MGR_MODULE_{DEPENDENCY,ERROR}

We want to know what modules failed and why.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agocrimson: fix build
Sage Weil [Fri, 1 Feb 2019 12:38:39 +0000 (06:38 -0600)]
crimson: fix build

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/MonClient: finsih authenticate() only after we get monmap; fix 'tell mgr'
Sage Weil [Thu, 31 Jan 2019 20:05:37 +0000 (14:05 -0600)]
mon/MonClient: finsih authenticate() only after we get monmap; fix 'tell mgr'

We used to get a valid monmap before we finished the MAuth exchange and
returned from authenticate().  Now, we finish authenticating before we even
send or receive a message, so authenticate() returns quickly.  This
confuses many callers, and is probably a bad idea.  So, rejigger the
_finish_auth and _finish_hunting callers so that we finish hunting as soon
as we have picked a mon but don't finish_auth if we have not gotten our
first monmap.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon: add auth_lock to protect auth_meta manipulation
Sage Weil [Thu, 31 Jan 2019 19:10:31 +0000 (13:10 -0600)]
mon: add auth_lock to protect auth_meta manipulation

In particular, we could be handling a get_auth_request() on a reconnect
while also running handle_auth_request() on a racing connection between
monitors.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoceph-mon: set up auth before binding
Sage Weil [Thu, 31 Jan 2019 15:28:30 +0000 (09:28 -0600)]
ceph-mon: set up auth before binding

Otherwise initial connections will fail because they lack the auth_server.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon: defer initial connection auth attempts until initial quorum is formed
Sage Weil [Thu, 31 Jan 2019 15:29:45 +0000 (09:29 -0600)]
mon: defer initial connection auth attempts until initial quorum is formed

Otherwise e.g. a client.admin connectin will fail because the mon doesn't
have the key in the database yet.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/MonClient: make MonClientPinger an AuthCleint
Sage Weil [Wed, 30 Jan 2019 23:59:51 +0000 (17:59 -0600)]
mon/MonClient: make MonClientPinger an AuthCleint

Reuse MonConnection to do the authentication.

Note this is a change in behavior: ceph ping mon* now requires
authentication.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoceph_test_msgr: use DummyAuth
Sage Weil [Wed, 30 Jan 2019 18:32:02 +0000 (12:32 -0600)]
ceph_test_msgr: use DummyAuth

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/DummyAuth: dummy auth server and client for test code
Sage Weil [Wed, 30 Jan 2019 18:29:06 +0000 (12:29 -0600)]
auth/DummyAuth: dummy auth server and client for test code

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/Monitor: fix leak of auth_handler if we error out
Sage Weil [Wed, 30 Jan 2019 16:55:12 +0000 (10:55 -0600)]
mon/Monitor: fix leak of auth_handler if we error out

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agodoc/dev/cephx: re-wordwrap
Sage Weil [Wed, 30 Jan 2019 16:40:47 +0000 (10:40 -0600)]
doc/dev/cephx: re-wordwrap

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agodoc/dev/cephx: document nautilus change to cephx
Sage Weil [Fri, 25 Jan 2019 09:05:20 +0000 (03:05 -0600)]
doc/dev/cephx: document nautilus change to cephx

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agovstart.sh: fix --msgr2 option
Sage Weil [Wed, 30 Jan 2019 13:04:21 +0000 (07:04 -0600)]
vstart.sh: fix --msgr2 option

Should be v2 only and turn of v1.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async/ProtocolV2: use shared_ptr to manage auth_meta
Sage Weil [Tue, 29 Jan 2019 17:57:55 +0000 (11:57 -0600)]
msg/async/ProtocolV2: use shared_ptr to manage auth_meta

When we reconnect a session, we need to move the new connection's auth_meta
over to the existing connection.  However, the existing connection may
have a thread that is unlocked and calling into an AuthClient or AuthServer
method making good use of the old auth_meta.

Resolved this by making auth_meta a shared_ptr and taking a local ref
before dropping the connection lock.  This way we are free to move the
auth_meta over to the new connection as long as we are holding the lock,
and at the same time the existing connection can fiddle with the old
auth_meta without being disturbed.  (That old auth_meta is about to get
discarded, but we still need to prevent the two threads from stomping on
each other.)

This also cleans up the reset_recv_state() a bit since we can simply
replace the old auth_meta with a totally fresh one without worrying about
what kind of state might be lurking in there.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/Auth{Client,Server}: pass auth_meta in explicitly
Sage Weil [Tue, 29 Jan 2019 17:46:48 +0000 (11:46 -0600)]
auth/Auth{Client,Server}: pass auth_meta in explicitly

This removes the wonky accessor on Connection, and most importantly
allows the caller to control the lifecycle of the AuthConnectionMeta.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomon/MonClient: behave if authorizer can't be built (yet)
Sage Weil [Tue, 29 Jan 2019 16:48:15 +0000 (10:48 -0600)]
mon/MonClient: behave if authorizer can't be built (yet)

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoosd: set_auth_server on client_messenger
Sage Weil [Mon, 28 Jan 2019 15:35:58 +0000 (09:35 -0600)]
osd: set_auth_server on client_messenger

monc sets up the AuthClient, not the AuthServer.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agocommon/ceph_context: get_moduel_type() for seastar cct
Sage Weil [Thu, 24 Jan 2019 22:57:05 +0000 (16:57 -0600)]
common/ceph_context: get_moduel_type() for seastar cct

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: make connection_secret a std::string
Sage Weil [Wed, 23 Jan 2019 16:14:16 +0000 (10:14 -0600)]
auth: make connection_secret a std::string

Move connection mode decision to initial auth_request point so that it
can inform auth implementation how big the connection secret should be.
Pass that value through where appropriate.

The connection_secret is now a std::string filled with random bytes.

For now the v2 protocol just uses the session_key CryptoKey to encrypt,
but this is about to change.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth,msg/async/ProtocolV2: negotiate connection modes
Sage Weil [Tue, 22 Jan 2019 22:59:22 +0000 (16:59 -0600)]
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>
6 years agoauth/AuthRegistry: refactor handling of auth_*_requred options
Sage Weil [Tue, 22 Jan 2019 18:27:29 +0000 (12:27 -0600)]
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>
6 years agoosd,mgr,mds: remove unused authorize registries
Sage Weil [Mon, 21 Jan 2019 23:55:58 +0000 (17:55 -0600)]
osd,mgr,mds: remove unused authorize registries

These are handled by AuthClient and AuthServer now.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoswitch monc, daemons to use new msgr2 auth frame exchange
Sage Weil [Mon, 21 Jan 2019 16:22:26 +0000 (10:22 -0600)]
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>
6 years agoMerge PR #26306 into master
Sage Weil [Thu, 7 Feb 2019 15:49:54 +0000 (09:49 -0600)]
Merge PR #26306 into master

* refs/pull/26306/head:
ceph_test_msgr: fix server->client addr discovery
msg/{async,simple}: make learned_addr a bit smarter
msg/async: very protocol type when looking up existing connections
common/LogEntry: use as_legacy_addr()
msg/msg_types: add entity_addrvec_t::as_legacy_addr()
msg/async/AsyncMessenger: drop weird assert
msg/Messenger: be less verbose
msg/simple: learn client addr as type any
msg/simple: set_addr_unknowns(): use front(), not legacy_addr()
msg/msg_types: drop any: prefix
remove all Messenger::get_myaddr() users
test/crimson: fix DummyAuthAuthorizer
mon/MonClient: kill get_myaddr()
msg/async/ProtocolV1: use legacy v1 address, not any, in protocol
msg/Messenger: add get_myaddr_legacy()
msg/msg_types: add entity_addr_t::is_any()
msg/async: msgr2: send entity type and peer_address in Tag::HELLO frame
msg/async: identify client using any: addr

Reviewed-by: Ricardo Dias <rdias@suse.com>
6 years agoMerge pull request #26008 from theanalyst/wip-rgw-scheduler
Matt Benjamin [Thu, 7 Feb 2019 15:46:18 +0000 (10:46 -0500)]
Merge pull request #26008 from theanalyst/wip-rgw-scheduler

rgw: scheduler

6 years agodoc/mgr/orchestrator: Add Image 26321/head
Sebastian Wagner [Thu, 7 Feb 2019 15:11:02 +0000 (16:11 +0100)]
doc/mgr/orchestrator: Add Image

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
6 years agomgr/rook: fix result handling for RookWriteCompletions 26317/head
Jeff Layton [Wed, 6 Feb 2019 19:35:32 +0000 (14:35 -0500)]
mgr/rook: fix result handling for RookWriteCompletions

Add a result property, and ensure that the create_osd codepath returns
a string with the result when an exception isn't triggered.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
6 years agomgr/rook: fix bug in OSD creation path
Jeff Layton [Wed, 6 Feb 2019 19:23:38 +0000 (14:23 -0500)]
mgr/rook: fix bug in OSD creation path

The list of devices is in "paths".

Signed-off-by: Jeff Layton <jlayton@redhat.com>
6 years agoMerge pull request #26068 from badone/wip-ceph-ansible-switch-to-ansible-2.7
Yuri Weinstein [Thu, 7 Feb 2019 14:20:59 +0000 (06:20 -0800)]
Merge pull request #26068 from badone/wip-ceph-ansible-switch-to-ansible-2.7

qa/tests: Move ceph-ansible tests to ansible version 2.7

Reviewed-by: Yuri Weinstein <yweinste@redhat.com>
6 years agoMerge pull request #26312 from smithfarm/wip-luminous-cve
Abhishek L [Thu, 7 Feb 2019 13:51:43 +0000 (14:51 +0100)]
Merge pull request #26312 from smithfarm/wip-luminous-cve

doc: mention CVEs in luminous v12.2.11 release notes

Reviewed-By: Sage Weil <sage@redhat.com>
6 years agomgr: install tox==2.9.1 for tox tests 26313/head
Kefu Chai [Thu, 7 Feb 2019 09:51:55 +0000 (17:51 +0800)]
mgr: install tox==2.9.1 for tox tests

* pybind/mgr/ansible/requirements.txt:
  in src/pybind/mgr/ansible/tox.ini, tox>=2.8.1 is required. to be
consistent with other requirements.txt in Ceph, tox 2.9.1 will be
installed for these tox environments.
* pybind/mgr/orchestrator_cli/requirements.txt:
  in src/pybind/mgr/orchestrator_cli: tox>=2.5 is required. to be
consistent with other requirements.txt in Ceph, tox 2.9.1 will be
installed for these tox environments.

Signed-off-by: Kefu Chai <kchai@redhat.com>
6 years agodoc/dev/msgr2: update docs to match implementation for auth frames
Sage Weil [Sun, 20 Jan 2019 23:16:54 +0000 (17:16 -0600)]
doc/dev/msgr2: update docs to match implementation for auth frames

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthClientHandler: add build_initial_request hook
Sage Weil [Sun, 20 Jan 2019 23:06:23 +0000 (17:06 -0600)]
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>
6 years agomsg/Messenger: attach auth_client and/or auth_server to each Messenger
Sage Weil [Sun, 20 Jan 2019 23:03:55 +0000 (17:03 -0600)]
msg/Messenger: attach auth_client and/or auth_server to each Messenger

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: introduce AuthClient and AuthServer handlers
Sage Weil [Sun, 20 Jan 2019 23:03:18 +0000 (17:03 -0600)]
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>
6 years agoauth: codify AUTH_MODE_AUTHORIZER
Sage Weil [Sun, 20 Jan 2019 22:51:12 +0000 (16:51 -0600)]
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>
6 years agomsg/Connection: track peer_id (id portion of entity_name_t) for msgr2
Sage Weil [Sun, 20 Jan 2019 22:47:38 +0000 (16:47 -0600)]
msg/Connection: track peer_id (id portion of entity_name_t) for msgr2

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthAuthorizeHandler: add get_supported_methods()
Sage Weil [Sun, 20 Jan 2019 22:45:29 +0000 (16:45 -0600)]
auth/AuthAuthorizeHandler: add get_supported_methods()

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthAuthorizeHandler: fix args for verify_authorizer()
Sage Weil [Fri, 18 Jan 2019 21:54:58 +0000 (15:54 -0600)]
auth/AuthAuthorizeHandler: fix args for verify_authorizer()

const bufferlists in, pointers for output args.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: constify bufferlist arg to AuthAuthorizer::add_challenge()
Sage Weil [Thu, 17 Jan 2019 22:55:28 +0000 (16:55 -0600)]
auth: constify bufferlist arg to AuthAuthorizer::add_challenge()

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/cephx: share all tickets and connection_secret in initial reply
Sage Weil [Wed, 16 Jan 2019 16:46:34 +0000 (10:46 -0600)]
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>
6 years agomsg/async,auth: add AuthConnectionMeta to Protocol
Sage Weil [Wed, 16 Jan 2019 20:57:13 +0000 (14:57 -0600)]
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>
6 years agoauth/AuthClientHandler: pass in session_key, connection_secret pointers
Sage Weil [Wed, 16 Jan 2019 21:00:59 +0000 (15:00 -0600)]
auth/AuthClientHandler: pass in session_key, connection_secret pointers

No functional change.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth/AuthServiceHandler: take session_key and connection_secret as args
Sage Weil [Wed, 16 Jan 2019 19:56:43 +0000 (13:56 -0600)]
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>
6 years agoauth/cephx: pass more specific type into build_session_auth_info
Sage Weil [Wed, 16 Jan 2019 17:21:42 +0000 (11:21 -0600)]
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>
6 years agomon/Session: separate session creation, peer ident, and registration
Sage Weil [Sun, 20 Jan 2019 23:09:56 +0000 (17:09 -0600)]
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>
6 years agomon/AuthMonitor: bump max_global_id from on_active() and tick()
Sage Weil [Tue, 15 Jan 2019 20:41:36 +0000 (14:41 -0600)]
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>
6 years agomon/AuthMonitor: be more careful with max_global_id
Sage Weil [Tue, 15 Jan 2019 17:29:34 +0000 (11:29 -0600)]
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>
6 years agomon: only all ms_handle_authentication() if auth method says we're done
Sage Weil [Mon, 14 Jan 2019 23:18:13 +0000 (17:18 -0600)]
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>
6 years agomon/AuthMonitor: fix "finished with auth" condition check
Sage Weil [Mon, 14 Jan 2019 22:55:08 +0000 (16:55 -0600)]
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>
6 years agoauth: clean up AuthServiceHandler::handle_request() args
Sage Weil [Mon, 14 Jan 2019 22:45:13 +0000 (16:45 -0600)]
auth: clean up AuthServiceHandler::handle_request() args

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoauth: clean up AuthServiceHandler::start_session()
Sage Weil [Mon, 14 Jan 2019 22:13:53 +0000 (16:13 -0600)]
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>
6 years agomon/AuthMonitor: drop unused op arg to assign_global_id()
Sage Weil [Mon, 14 Jan 2019 22:07:16 +0000 (16:07 -0600)]
mon/AuthMonitor: drop unused op arg to assign_global_id()

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async: separate TAG_AUTH_REQUEST_MORE and TAG_AUTH_REPLY_MORE
Sage Weil [Mon, 14 Jan 2019 23:00:17 +0000 (17:00 -0600)]
msg/async: separate TAG_AUTH_REQUEST_MORE and TAG_AUTH_REPLY_MORE

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async: consolidate authorizer checks
Sage Weil [Fri, 11 Jan 2019 21:59:58 +0000 (15:59 -0600)]
msg/async: consolidate authorizer checks

No need to special-case auth methods at this layer.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/async: move get_auth_allowed into ProtocolV2.cc
Sage Weil [Fri, 11 Jan 2019 21:46:20 +0000 (15:46 -0600)]
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>
6 years agomon/MonClient: trivial cleanup
Sage Weil [Sun, 20 Jan 2019 23:07:01 +0000 (17:07 -0600)]
mon/MonClient: trivial cleanup

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agoMerge pull request #26098 from pritha-srivastava/wip-rgw-awsv4signature
Matt Benjamin [Thu, 7 Feb 2019 12:34:46 +0000 (07:34 -0500)]
Merge pull request #26098 from pritha-srivastava/wip-rgw-awsv4signature

rgw: Correcting logic for signature calculation for non s3 ops.

6 years agoMerge pull request #24818 from pritha-srivastava/wip-rgw-sts-auth-policy
Matt Benjamin [Thu, 7 Feb 2019 12:33:29 +0000 (07:33 -0500)]
Merge pull request #24818 from pritha-srivastava/wip-rgw-sts-auth-policy

[DNM] rgw: Controlling STS authentication via a Policy

6 years agoceph_test_msgr: fix server->client addr discovery 26306/head
Sage Weil [Wed, 6 Feb 2019 22:01:01 +0000 (16:01 -0600)]
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>
6 years agomsg/{async,simple}: make learned_addr a bit smarter
Sage Weil [Wed, 6 Feb 2019 12:23:16 +0000 (06:23 -0600)]
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>
6 years agomsg/async: very protocol type when looking up existing connections
Sage Weil [Tue, 5 Feb 2019 11:08:00 +0000 (05:08 -0600)]
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>
6 years agocommon/LogEntry: use as_legacy_addr()
Sage Weil [Mon, 4 Feb 2019 11:42:38 +0000 (05:42 -0600)]
common/LogEntry: use as_legacy_addr()

...just in case addrs has an any addr.

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/msg_types: add entity_addrvec_t::as_legacy_addr()
Sage Weil [Mon, 4 Feb 2019 11:41:42 +0000 (05:41 -0600)]
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>
6 years agomsg/async/AsyncMessenger: drop weird assert
Sage Weil [Mon, 4 Feb 2019 11:34:11 +0000 (05:34 -0600)]
msg/async/AsyncMessenger: drop weird assert

I'm not sure what this was intended for originally...

Signed-off-by: Sage Weil <sage@redhat.com>
6 years agomsg/Messenger: be less verbose
Sage Weil [Mon, 4 Feb 2019 11:30:12 +0000 (05:30 -0600)]
msg/Messenger: be less verbose

This message has been annoying me

Signed-off-by: Sage Weil <sage@redhat.com>