Skip to content

reef: mon/AuthMonitor: provide command to rotate the key for a user credential#58236

Merged
batrick merged 4 commits intoceph:reeffrom
batrick:wip-66618-reef
Jun 11, 2025
Merged

reef: mon/AuthMonitor: provide command to rotate the key for a user credential#58236
batrick merged 4 commits intoceph:reeffrom
batrick:wip-66618-reef

Conversation

@batrick
Copy link
Member

@batrick batrick commented Jun 24, 2024

backport tracker: https://tracker.ceph.com/issues/66618


backport of #58121
parent tracker: https://tracker.ceph.com/issues/66509

this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh

@batrick batrick requested review from a team as code owners June 24, 2024 15:54
@batrick batrick added this to the reef milestone Jun 24, 2024
@batrick batrick added the core label Jun 24, 2024
@batrick
Copy link
Member Author

batrick commented Aug 23, 2024

jenkins test make check

@batrick
Copy link
Member Author

batrick commented Aug 23, 2024

jenkins test windows

@batrick
Copy link
Member Author

batrick commented Aug 23, 2024

jenkins test api

1 similar comment
@batrick
Copy link
Member Author

batrick commented Sep 11, 2024

jenkins test api

@batrick
Copy link
Member Author

batrick commented Sep 11, 2024

jenkins test windows

@batrick
Copy link
Member Author

batrick commented Sep 11, 2024

jenkins test make check

@github-actions github-actions bot added the stale label Nov 26, 2024
@batrick batrick removed the stale label Nov 26, 2024
@batrick batrick force-pushed the wip-66618-reef branch 2 times, most recently from 4c774f6 to 178ea2a Compare November 26, 2024 15:21
@ceph ceph deleted a comment from github-actions bot Dec 30, 2024
@mchangir
Copy link
Contributor

This PR is under test in https://tracker.ceph.com/issues/69881.

@shraddhaag
Copy link
Contributor

Hey @batrick, while going through the failures for the batch that included this PR the following error was encountered that seems to be related to this PR:

2025-02-15T00:47:12.574 INFO:tasks.workunit.client.0.smithi102.stdout:  key = AQAQ5K9n8Q6fGRAAeif4RSrb0bR7QEiWR73JfA==
2025-02-15T00:47:12.590 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:614: test_auth:  ceph auth get client.admin2
2025-02-15T00:47:13.054 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:615: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2
2025-02-15T00:47:13.535 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:617: test_auth:  expect_true diff -au keyring1 keyring2
2025-02-15T00:47:13.535 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:41: expect_true:  set -x
2025-02-15T00:47:13.535 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  diff -au keyring1 keyring2
2025-02-15T00:47:13.537 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  return 0
2025-02-15T00:47:13.537 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:619: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth rotate client.admin2
2025-02-15T00:47:14.040 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  diff -au keyring1 keyring3
2025-02-15T00:47:14.040 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  grep -E '^[-+][^-+]'
2025-02-15T00:47:14.040 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  expect_false grep -v key
2025-02-15T00:47:14.041 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:35: expect_false:  set -x
2025-02-15T00:47:14.041 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:36: expect_false:  grep -v key
2025-02-15T00:47:14.042 INFO:tasks.workunit.client.0.smithi102.stdout:- caps mon = "allow *"
2025-02-15T00:47:14.042 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:36: expect_false:  return 1
2025-02-15T00:47:14.042 INFO:tasks.workunit.client.0.smithi102.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:1: test_auth:  rm -fr /tmp/cephtool.uDS
2025-02-15T00:47:14.043 DEBUG:teuthology.orchestra.run:got remote process result: 1
2025-02-15T00:47:14.044 INFO:tasks.workunit:Stopping ['cephtool'] on client.0...
2025-02-15T00:47:14.044 DEBUG:teuthology.orchestra.run.smithi102:> sudo rm -rf -- /home/ubuntu/cephtest/workunits.list.client.0 /home/ubuntu/cephtest/clone.client.0
2025-02-15T00:47:14.343 ERROR:teuthology.run_tasks:Saw exception from tasks.

Could you please take a look? Meanwhile I'll request @SrinivasaBharath to rerun the batch excluding this PR to be sure.

@SrinivasaBharath
Copy link
Contributor

@shraddhaag Excluded the PR from the batch

@mchangir
Copy link
Contributor

This PR is under test in https://tracker.ceph.com/issues/70178.

@Naveenaidu
Copy link
Contributor

Naveenaidu commented Apr 1, 2025

while going through the failures of a batch that included this PR, we see the following error:

2025-03-18T03:54:56.338 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:613: test_auth:  ceph auth get-or-create client.admin2 mon 'allow *'
2025-03-18T03:54:56.856 INFO:tasks.workunit.client.0.smithi037.stdout:[client.admin2]
2025-03-18T03:54:56.856 INFO:tasks.workunit.client.0.smithi037.stdout:  key = AQCQ7thnz39PKRAACyv9fwObuJ6S+Q3aHRh/Tw==
2025-03-18T03:54:56.868 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:614: test_auth:  ceph auth get client.admin2
2025-03-18T03:54:57.390 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:615: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2
2025-03-18T03:54:57.886 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:617: test_auth:  expect_true diff -au keyring1 keyring2
2025-03-18T03:54:57.886 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:41: expect_true:  set -x
2025-03-18T03:54:57.886 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  diff -au keyring1 keyring2
2025-03-18T03:54:57.886 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  return 0
2025-03-18T03:54:57.886 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:619: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth rotate client.admin2
2025-03-18T03:54:58.430 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  diff -au keyring1 keyring3
2025-03-18T03:54:58.430 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  grep -E '^[-+][^-+]'
2025-03-18T03:54:58.430 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  expect_false grep -v key
2025-03-18T03:54:58.431 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:35: expect_false:  set -x
2025-03-18T03:54:58.431 INFO:tasks.workunit.client.0.smithi037.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:36: expect_false:  grep -v key

The error lines seems to match the changes that were done in this PR. These are the jobs that had this errors in the run of the batch

  • /a/yuriw-2025-03-18_01:22:46-rados-wip-yuri5-testing-2025-03-17-1441-reef-distro-default-smithi/8196407
  • /a/yuriw-2025-03-18_01:22:46-rados-wip-yuri5-testing-2025-03-17-1441-reef-distro-default-smithi/8196610
  • /a/yuriw-2025-03-18_01:22:46-rados-wip-yuri5-testing-2025-03-17-1441-reef-distro-default-smithi/8196542
  • /a/yuriw-2025-03-18_01:22:46-rados-wip-yuri5-testing-2025-03-17-1441-reef-distro-default-smithi/8196473

@batrick it would be nice if you could take a look at this! Meanwhile have requested @SrinivasaBharath to rerun the batch without this PR to be sure

@Naveenaidu
Copy link
Contributor

while going through the failures of a batch that included this PR, we see the following error:

2025-04-24T14:44:34.575 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:613: test_auth:  ceph auth get-or-create client.admin2 mon 'allow *'
2025-04-24T14:44:35.057 INFO:tasks.workunit.client.0.smithi104.stdout:[client.admin2]
2025-04-24T14:44:35.057 INFO:tasks.workunit.client.0.smithi104.stdout:  key = AQBSTgpo/GCwNRAAN2ucL4YR04DolOHZ9fBywA==
2025-04-24T14:44:35.073 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:614: test_auth:  ceph auth get client.admin2
2025-04-24T14:44:35.556 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:615: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2
2025-04-24T14:44:36.037 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:617: test_auth:  expect_true diff -au keyring1 keyring2
2025-04-24T14:44:36.037 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:41: expect_true:  set -x
2025-04-24T14:44:36.038 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  diff -au keyring1 keyring2
2025-04-24T14:44:36.039 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:42: expect_true:  return 0
2025-04-24T14:44:36.039 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:619: test_auth:  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth rotate client.admin2
2025-04-24T14:44:36.545 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  diff -au keyring1 keyring3
2025-04-24T14:44:36.546 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  grep -E '^[-+][^-+]'
2025-04-24T14:44:36.546 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:621: test_auth:  expect_false grep -v key
2025-04-24T14:44:36.546 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:35: expect_false:  set -x
2025-04-24T14:44:36.546 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:36: expect_false:  grep -v key
2025-04-24T14:44:36.546 INFO:tasks.workunit.client.0.smithi104.stdout:- caps mon = "allow *"
2025-04-24T14:44:36.547 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:36: expect_false:  return 1
2025-04-24T14:44:36.547 INFO:tasks.workunit.client.0.smithi104.stderr:/home/ubuntu/cephtest/clone.client.0/qa/workunits/cephtool/test.sh:1: test_auth:  rm -fr /tmp/cephtool.R1f
2025-04-24T14:44:36.548 DEBUG:teuthology.orchestra.run:got remote process result: 1

The error lines seems to match the changes that were done in this PR. These are the jobs that had this errors in the run of the batch

  • /a/skanta-2025-04-24_14:20:20-rados-wip-bharath8-testing-2025-04-23-0519-reef-distro-default-smithi/8257810
  • /a/skanta-2025-04-24_14:20:20-rados-wip-bharath8-testing-2025-04-23-0519-reef-distro-default-smithi/8257816
  • /a/skanta-2025-04-24_14:20:20-rados-wip-bharath8-testing-2025-04-23-0519-reef-distro-default-smithi/8257830
  • /a/skanta-2025-04-24_14:20:20-rados-wip-bharath8-testing-2025-04-23-0519-reef-distro-default-smithi/8257824

@batrick it would be nice if you could take a look at this! Meanwhile have requested @SrinivasaBharath to rerun the batch without this PR to be sure

@batrick
Copy link
Member Author

batrick commented Apr 29, 2025

I will take over QA of this. Need to figure out what's going on.

@batrick
Copy link
Member Author

batrick commented Apr 29, 2025

This PR is under test in https://tracker.ceph.com/issues/71132.

batrick added a commit to batrick/ceph that referenced this pull request Apr 29, 2025
* refs/pull/58236/head:
	doc: add documentation for `ceph auth rotate`
	PendingReleaseNotes: add note for new `auth rotate`
	qa: test `auth rotate`
	mon/AuthMonitor: add `ceph auth rotate` command
batrick added a commit to batrick/ceph that referenced this pull request Apr 30, 2025
* refs/pull/58236/head:
	test
	doc: add documentation for `ceph auth rotate`
	PendingReleaseNotes: add note for new `auth rotate`
	qa: test `auth rotate`
	mon/AuthMonitor: add `ceph auth rotate` command
@batrick
Copy link
Member Author

batrick commented Apr 30, 2025

Fixed with this patch:

diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc
index c1e70e91c109..4c88c7d74a71 100644
--- a/src/mon/AuthMonitor.cc
+++ b/src/mon/AuthMonitor.cc
@@ -1941,9 +1941,8 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op)
 
     {
       KeyRing kr;
-      kr.add(entity, entity_auth.key, entity_auth.pending_key);
+      kr.add(entity, entity_auth);
       if (f) {
-        kr.set_caps(entity, entity_auth.caps);
         kr.encode_formatted("auth", f.get(), rdata);
       } else {
         kr.encode_plaintext(rdata);

https://pulpito.ceph.com/pdonnell-2025-04-30_17:14:51-rados:singleton-bluestore-wip-pdonnell-testing-20250430.151812-reef-debug-distro-default-smithi/

batrick added 4 commits April 30, 2025 14:00
Add command to rotate the permanent key of an entity. This avoids the need to
delete / recreate the key when it is compromised, lost, or just scheduled for
rotation.

Fixes: https://tracker.ceph.com/issues/66509
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit d57326f)

Conflicts:
    src/mon/AuthMonitor.cc: _encode_auth not in reef
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 2ae027f)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit deab044)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit b871bbe)
@batrick batrick merged commit e5663f0 into ceph:reef Jun 11, 2025
8 checks passed
@batrick batrick deleted the wip-66618-reef branch June 11, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants