Skip to content

Commit ff5ee2b

Browse files
authored
Merge pull request #609 from xavpaice/xav/sc37229/ceph-secrets
Add Ceph auth redactors
2 parents 0996b3b + d98c01a commit ff5ee2b

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed

pkg/redact/redact.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ func getRedactors(path string) ([]Redactor, error) {
304304
line2: `(?i)("value": *")(?P<mask>.*[^\"]*)(")`,
305305
name: "Redact usernames in multiline JSON",
306306
},
307+
{
308+
line1: `(?i)"entity": *"(osd|client|mgr)\..*[^\"]*"`,
309+
line2: `(?i)("key": *")(?P<mask>.{38}==[^\"]*)(")`,
310+
name: "Redact 'key' values found in Ceph auth lists",
311+
},
307312
}
308313

309314
for _, l := range doubleLines {

pkg/redact/redact_test.go

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,53 @@ func Test_Redactors(t *testing.T) {
816816
"status": {
817817
"loadBalancer": {}
818818
}
819+
},
820+
{
821+
"auth_dump": [
822+
{
823+
"entity": "osd.0",
824+
"key": "ABCxyzABCxyz/foo/bar123xyz/BAZAABBCCDD==",
825+
"caps": {
826+
"mgr": "allow profile osd",
827+
"mon": "allow profile osd",
828+
"osd": "allow *"
829+
}
830+
},
831+
{
832+
"entity": "client.admin",
833+
"key": "ABCxyzABCxyz/foo/bar123xyz/BAZAABBCCDD==",
834+
"caps": {
835+
"mds": "allow *",
836+
"mgr": "allow *",
837+
"mon": "allow *",
838+
"osd": "allow *"
839+
}
840+
},
841+
{
842+
"entity": "client.bootstrap-mds",
843+
"key": "ABCxyzABCxyz/foo/bar123xyz/BAZAABBCCDD==",
844+
"caps": {
845+
"mon": "allow profile bootstrap-mds"
846+
}
847+
},
848+
{
849+
"entity": "client.rgw.rook.ceph.store.a",
850+
"key": "ABCxyzABCxyz/foo/bar123xyz/BAZAABBCCDD==",
851+
"caps": {
852+
"mon": "allow rw",
853+
"osd": "allow rwx"
854+
}
855+
},
856+
{
857+
"entity": "mgr.a",
858+
"key": "ABCxyzABCxyz/foo/bar123xyz/BAZAABBCCDD==",
859+
"caps": {
860+
"mds": "allow *",
861+
"mon": "allow profile mgr",
862+
"osd": "allow *"
863+
}
864+
}
865+
]
819866
}
820867
]`
821868

@@ -1624,11 +1671,58 @@ func Test_Redactors(t *testing.T) {
16241671
"status": {
16251672
"loadBalancer": {}
16261673
}
1674+
},
1675+
{
1676+
"auth_dump": [
1677+
{
1678+
"entity": "osd.0",
1679+
"key": "***HIDDEN***",
1680+
"caps": {
1681+
"mgr": "allow profile osd",
1682+
"mon": "allow profile osd",
1683+
"osd": "allow *"
1684+
}
1685+
},
1686+
{
1687+
"entity": "client.admin",
1688+
"key": "***HIDDEN***",
1689+
"caps": {
1690+
"mds": "allow *",
1691+
"mgr": "allow *",
1692+
"mon": "allow *",
1693+
"osd": "allow *"
1694+
}
1695+
},
1696+
{
1697+
"entity": "client.bootstrap-mds",
1698+
"key": "***HIDDEN***",
1699+
"caps": {
1700+
"mon": "allow profile bootstrap-mds"
1701+
}
1702+
},
1703+
{
1704+
"entity": "client.rgw.rook.ceph.store.a",
1705+
"key": "***HIDDEN***",
1706+
"caps": {
1707+
"mon": "allow rw",
1708+
"osd": "allow rwx"
1709+
}
1710+
},
1711+
{
1712+
"entity": "mgr.a",
1713+
"key": "***HIDDEN***",
1714+
"caps": {
1715+
"mds": "allow *",
1716+
"mon": "allow profile mgr",
1717+
"osd": "allow *"
1718+
}
1719+
}
1720+
]
16271721
}
16281722
]`
16291723

1630-
wantRedactionsLen := 39
1631-
wantRedactionsCount := 25
1724+
wantRedactionsLen := 44
1725+
wantRedactionsCount := 26
16321726

16331727
t.Run("test default redactors", func(t *testing.T) {
16341728
req := require.New(t)

0 commit comments

Comments
 (0)