You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a Mongo database is provisioned at database/config/mongo-example, and both username/password and TLS certificates are passed, the MongoDB x.509 auth mechanism will always win; this renders other auth mechanisms unusable. This breaks MongoDB secret engines that are using client TLS in addition to other auth mechanisms such as SCRAM-SHA-256, when upgrading from Vault 1.5 to 1.6+.
This is due to the new order in which Mongo config is merged in plugins/database/mongodb/connection_producer.go:
Upon attempting to verify the database config object, Vault cannot authenticate via username/password and instead is forced to use the client TLS certs for authentication. Notice the user that is trying to be used, which was extracted from the TLS cert. See error:
* error creating database object: failed to verify connection: connection() : auth error: round trip error: (UserNotFound) Could not find user "CN=foo,O=foo,L=foo,ST=foo,C=foo" for db "$external"
Expected behavior
The MongoDB secret engine is provisioned successfully.
Environment:
Vault Server Version (retrieve with vault status): v1.6.2
Vault CLI Version (retrieve with vault version): v1.6.2
Additional context
This regression was introduced by #9519, which was a change to allow passing tls=true in the Mongo connection URL properly (#9509). There should probably be some tests around this behavior.
If attempting to connect to a MongoDB instance that requires client TLS, solely with username/password set and no TLS certs, the following error is returned (formatted for readability):
Error writing data to database/config/mongo-example: Error making API request.
URL: PUT https://vault.vault.svc.cluster.local:443/v1/database/config/mongo-example
Code: 400. Errors:
* error creating database object: failed to verify connection: server selection error: server selection timeout, current topology:
{
Type: Unknown,
Servers: [
{
Addr: mongo-example.svc.cluster.local:27017,
Type: Unknown,
State: Connected,
Average RTT: 0,
Last error: connection() : connection(mongo-example.svc.cluster.local:27017[-202]) incomplete read of message header: EOF
},
]
}
The text was updated successfully, but these errors were encountered:
@pbar1 Unsure if you are still facing this issue. But I got around it by setting tlsCertificateKeyFile= & tlsCAFile= in the uri string, instead of tls_certificate_key & tls_ca separately.
Describe the bug
If a Mongo database is provisioned at
database/config/mongo-example
, and both username/password and TLS certificates are passed, the MongoDB x.509 auth mechanism will always win; this renders other auth mechanisms unusable. This breaks MongoDB secret engines that are using client TLS in addition to other auth mechanisms such as SCRAM-SHA-256, when upgrading from Vault 1.5 to 1.6+.This is due to the new order in which Mongo config is merged in
plugins/database/mongodb/connection_producer.go
:To Reproduce
Steps to reproduce the behavior:
vault secrets enable database
Expected behavior
The MongoDB secret engine is provisioned successfully.
Environment:
vault status
): v1.6.2vault version
): v1.6.2Vault server configuration file(s):
Additional context
This regression was introduced by #9519, which was a change to allow passing
tls=true
in the Mongo connection URL properly (#9509). There should probably be some tests around this behavior.If attempting to connect to a MongoDB instance that requires client TLS, solely with username/password set and no TLS certs, the following error is returned (formatted for readability):
The text was updated successfully, but these errors were encountered: