@@ -58,6 +58,19 @@ def test_simple_auth_tls():
58
58
'--tls --tls-certificate-key-file=/mongodb_certs/client.pem --tls-ca-file=/mongodb_certs/ca-certs.pem '
59
59
'--cluster=mycluster' )
60
60
61
+ #####
62
+ # All tests for external authentication methods (X509, LDAP, Kerberos, AWS) rely on the `mongod` configuration to handle
63
+ # authentication using the selected method, followed by authorization via LDAP.
64
+ #
65
+ # Therefore, no users are added to `$external` database before testing. Instead, after successful authentication
66
+ # against the selected service, the username is transformed based on the pattern below to match LDAP user
67
+ # `cn=pmm-test,ou=users,dc=example,dc=org`.
68
+ # This user is preconfigured on LDAP server and, after authorization, inherits the privileges assigned in
69
+ # MongoDB to its default group, `cn=readers,ou=users,dc=example,dc=org`.
70
+ #
71
+ # Transformation pattern from `mongod` configuration:
72
+ # [{match: "arn:aws:iam::(.+):user/(.+)|CN=(.+)|([^@]+)@PERCONATEST.COM", substitution: "cn={1}{2}{3},ou=users,dc=example,dc=org"}]
73
+ #####
61
74
62
75
def test_x509_auth ():
63
76
run_test ('pmm-admin add mongodb psmdb-server --host=psmdb-server --port 27017 '
@@ -80,6 +93,18 @@ def test_ldap_auth_tls():
80
93
'--tls --tls-certificate-key-file=/mongodb_certs/client.pem --tls-ca-file=/mongodb_certs/ca-certs.pem '
81
94
'--cluster=mycluster' )
82
95
96
+ def test_kerberos_auth_wo_tls ():
97
+ run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 '
98
+ '--host=psmdb-server --port 27017 '
99
+ '--authentication-mechanism=GSSAPI --authentication-database=\' $external\' '
100
+ '--cluster=mycluster' )
101
+
102
+ def test_kerberos_auth_tls ():
103
+ run_test (
'pmm-admin add mongodb psmdb-server --username="[email protected] " --password=password1 '
104
+ '--host=psmdb-server --port 27017 '
105
+ '--authentication-mechanism=GSSAPI --authentication-database=\' $external\' '
106
+ '--tls --tls-certificate-key-file=/mongodb_certs/client.pem --tls-ca-file=/mongodb_certs/ca-certs.pem '
107
+ '--cluster=mycluster' )
83
108
84
109
@pytest .mark .skipif (
85
110
any (not os .environ .get (var ) for var in env_vars ) or os .environ .get ('SKIP_AWS_TESTS' ) == 'true' ,
0 commit comments