Skip to content

Commit 2a94ae4

Browse files
committed
PMM-14184 Enable Kerberos authentication in extra profile setup by modifying MongoDB configuration and creating a test Kerberos user.
1 parent 74c06d1 commit 2a94ae4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pmm_psmdb-pbm_setup/start-rs-only.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ echo "✓ Kerberos user setup completed"
4545
bash -x ./configure-agents.sh
4646

4747
if [ $profile = "extra" ]; then
48+
# Enable authorization first
49+
echo "Enabling authorization..."
50+
docker exec rs201 sed -i 's/authorization: disabled/authorization: enabled/' /etc/mongod/mongod.conf
51+
docker exec rs201 systemctl restart mongod
52+
sleep 10
53+
54+
# Setup Kerberos users after authorization is enabled
55+
echo "Setting up Kerberos authentication users..."
56+
# Wait for MongoDB to be ready
57+
sleep 5
58+
# Direct command to create Kerberos user
59+
docker exec rs201 mongo --quiet -u root -p root --authenticationDatabase admin --eval "db.getSiblingDB('\$external').createUser({user: 'pmm-test@PERCONATEST.COM', roles: [{role: 'explainRole', db: 'admin'}, {role: 'clusterMonitor', db: 'admin'}, {role: 'userAdminAnyDatabase', db: 'admin'}, {role: 'dbAdminAnyDatabase', db: 'admin'}, {role: 'readWriteAnyDatabase', db: 'admin'}, {role: 'read', db: 'local'}]})"
60+
echo "✓ Kerberos user setup completed"
4861
if [ $mongo_setup_type == "pss" ]; then
4962
bash -x ./configure-extra-replset.sh
5063
else

0 commit comments

Comments
 (0)