Skip to content

Commit f946db9

Browse files
authored
PMM-14184 optionally add clients via gssapi (#157)
* PMM-14184 optionally add clients via gssapi * PMM-14184 optionally add clients via gssapi * PMM-14184 fix typo * PMM-14184 extra repl set config
1 parent 9769ffa commit f946db9

File tree

6 files changed

+34
-1
lines changed

6 files changed

+34
-1
lines changed

pmm_psmdb-pbm_setup/configure-agents.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ pmm_mongo_user_pass=${PMM_MONGO_USER_PASS:-pmmpass}
66
pbm_user=${PBM_USER:-pbm}
77
pbm_pass=${PBM_PASS:-pbmpass}
88
mongo_setup_type=${MONGO_SETUP_TYPE:-pss}
9+
gssapi_enabled=${GSSAPI:-false}
10+
gssapi_username=${GSSAPI_USERNAME:-pmm@PERCONATEST.COM}
11+
gssapi_password=${GSSAPI_PASSWORD:-password1}
912

1013
echo
1114
echo "configuring pbm agents"
@@ -36,6 +39,10 @@ do
3639
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs ${node}_${random_number} 127.0.0.1:27017
3740
else
3841
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
42+
43+
if [[ $gssapi_enabled == "true" ]]; then
44+
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs --username=${gssapi_username} --password=${gssapi_password} --authentication-mechanism=GSSAPI --authentication-database="$external" --host=${node} --port=27017 ${node}_gssapi_${random_number}
45+
fi
3946
fi
4047
done
4148
echo

pmm_psmdb-pbm_setup/configure-extra-agents.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ pmm_mongo_user_pass=${PMM_MONGO_USER_PASS:-pmmpass}
66
pbm_user=${PBM_USER:-pbm}
77
pbm_pass=${PBM_PASS:-pbmpass}
88
mongo_setup_type=${MONGO_SETUP_TYPE:-pss}
9+
gssapi_enabled=${GSSAPI:-false}
10+
gssapi_username=${GSSAPI_USERNAME:-pmm@PERCONATEST.COM}
11+
gssapi_password=${GSSAPI_PASSWORD:-password1}
912

1013
echo
1114
echo "configuring pbm agents"
@@ -34,5 +37,9 @@ do
3437
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs1 ${node}_${random_number} 127.0.0.1:27017
3538
else
3639
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs1 --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
40+
41+
if [[ $gssapi_enabled == "true" ]]; then
42+
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --agent-password=mypass --cluster=replicaset --replication-set=rs --username=${gssapi_username} --password=${gssapi_password} --authentication-mechanism=GSSAPI --authentication-database="$external" --host=${node} --port=27017 ${node}_gssapi_${random_number}
43+
fi
3744
fi
3845
done

pmm_psmdb-pbm_setup/configure-extra-replset.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,20 @@ db.getSiblingDB("admin").createUser({
101101
]
102102
});
103103
EOF
104+
105+
echo "creating pmm kerberos user"
106+
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
107+
db.getSiblingDB("\$external").createUser({
108+
user: "${pmm_mongo_user}@PERCONATEST.COM",
109+
roles: [
110+
{ role: "explainRole", db: "admin" },
111+
{ role: "clusterMonitor", db: "admin" },
112+
{ role: "read", db: "local" },
113+
{ "db" : "admin", "role" : "readWrite", "collection": "" },
114+
{ "db" : "admin", "role" : "backup" },
115+
{ "db" : "admin", "role" : "clusterMonitor" },
116+
{ "db" : "admin", "role" : "restore" },
117+
{ "db" : "admin", "role" : "pbmAnyAction" }
118+
]
119+
});
120+
EOF

pmm_psmdb-pbm_setup/configure-replset.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ db.getSiblingDB("admin").createUser({
100100
{ "db" : "admin", "role" : "pbmAnyAction" }
101101
]
102102
});
103+
EOF
103104
echo "creating pmm kerberos user"
104105
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
105106
db.getSiblingDB("\$external").createUser({

pmm_qa/pmm-framework.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ def setup_psmdb(db_type, db_version=None, db_config=None, args=None):
562562
'COMPOSE_PROFILES': get_value('COMPOSE_PROFILES', db_type, args, db_config),
563563
'MONGO_SETUP_TYPE': get_value('SETUP_TYPE', db_type, args, db_config),
564564
'OL_VERSION': get_value('OL_VERSION', db_type, args, db_config),
565+
'GSSAPI': get_value('GSSAPI', db_type, args, db_config),
565566
'TESTS': 'no',
566567
'CLEANUP': 'no'
567568
}

pmm_qa/scripts/database_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"PSMDB": {
33
"versions": ["4.4", "5.0", "6.0", "7.0", "8.0", "latest"],
44
"configurations": {"CLIENT_VERSION": "3-dev-latest", "SETUP_TYPE": "pss", "COMPOSE_PROFILES": "classic",
5-
"TARBALL": "", "OL_VERSION": "9"}
5+
"TARBALL": "", "OL_VERSION": "9", "GSSAPI": "false"}
66
},
77
"MLAUNCH_PSMDB": {
88
"versions": ["4.4", "5.0", "6.0", "7.0", "8.0"],

0 commit comments

Comments
 (0)