]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test `auth rotate`
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Jun 2024 18:17:00 +0000 (14:17 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 21 Jun 2024 01:31:12 +0000 (21:31 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/workunits/cephtool/test.sh

index 8a7ab1ea781eecec8e2fb51150c2604b82853956..266f133c6037d35109b4064a8b53ea5bd9fc3f19 100755 (executable)
@@ -609,6 +609,26 @@ function test_auth()
   ceph auth del client.xx
   expect_false ceph auth get client.xx
 
+  # test rotation
+  ceph auth get-or-create client.admin2 mon 'allow *'
+  ceph auth get client.admin2 >> keyring1
+  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2 >> keyring2
+  # they are the same:
+  expect_true diff -au keyring1 keyring2
+  # rotate itself
+  env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth rotate client.admin2 >> keyring3
+  # only the key has changed:
+  diff -au keyring1 keyring3 | grep -E '^[-+][^-+]' | expect_false grep -v key
+  # the key in keyring1 no longer works:
+  expect_false env CEPH_KEYRING=keyring1 ceph -n client.admin2 auth get client.admin2
+  # the key in keyring3 should work:
+  expect_true env CEPH_KEYRING=keyring3 ceph -n client.admin2 auth get client.admin2
+  # now verify the key from `auth get` matches what rotate produced:
+  expect_true ceph auth get client.admin2 >> keyring4
+  expect_true diff -au keyring3 keyring4
+  expect_true ceph auth rm client.admin2
+  rm keyring[1234]
+
   # (almost) interactive mode
   echo -e 'auth add client.xx mon "allow *" osd "allow *"\n' | ceph
   ceph auth get client.xx