forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qa/workunits/mon/auth_key_rotation.sh: exercise pending key / rotation
Signed-off-by: Sage Weil <[email protected]>
- Loading branch information
1 parent
c3562e9
commit 39da18b
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ tasks: | |
clients: | ||
all: | ||
- mon/auth_caps.sh | ||
- mon/auth_key_rotation.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/bash -ex | ||
|
||
function expect_false() | ||
{ | ||
set -x | ||
if "$@"; then return 1; else return 0; fi | ||
} | ||
|
||
|
||
ceph auth export | ||
ceph auth rm client.rot | ||
|
||
ceph auth get-or-create client.rot mon 'allow rwx' | ||
ceph auth export client.rot | grep key | ||
ceph auth export client.rot | expect_false grep pending.key | ||
|
||
ceph auth get-or-create-pending client.rot | ||
ceph auth export client.rot | grep key | ||
ceph auth export client.rot | grep pending.key | ||
|
||
ceph auth clear-pending client.rot | ||
ceph auth export client.rot | expect_false grep pending.key | ||
|
||
ceph auth get-or-create-pending client.rot | ||
ceph auth export client.rot | grep key | ||
ceph auth export client.rot | grep pending.key | ||
K=$(ceph auth export client.rot | grep 'key = ' | head -n 1 | awk '{print $3}') | ||
PK=$(ceph auth export client.rot | grep pending.key | awk '{print $4}') | ||
echo "K is $K" | ||
echo "PK is $PK" | ||
ceph -n client.rot --key $K -s | ||
|
||
ceph auth commit-pending client.rot | ||
ceph auth export client.rot | expect_false grep pending.key | ||
ceph auth export client.rot | grep key | grep $PK | ||
|
||
ceph auth get-or-create-pending client.rot | ||
ceph auth export client.rot | grep key | ||
ceph auth export client.rot | grep pending.key | ||
K=$(ceph auth export client.rot | grep 'key = ' | head -n 1 | awk '{print $3}') | ||
PK=$(ceph auth export client.rot | grep pending.key | awk '{print $4}') | ||
echo "2, K is $K" | ||
echo "2, PK is $PK" | ||
|
||
ceph auth export client.rot | ||
|
||
while ceph -n client.rot --key $K -s ; do | ||
ceph auth export client.rot | ||
ceph -n client.rot --key $PK -s | ||
sleep 1 | ||
done | ||
|
||
ceph auth export client.rot | expect_false grep pending.key | ||
ceph auth export client.rot | grep key | grep $PK | ||
|
||
ceph -n client.rot --key $PK -s | ||
|
||
echo ok |