Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
MongoDB.SetSSLOptions
Sets the TLS (SSL) options to use when connecting to TLS enabled MongoDB servers.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
MongoDB | 13.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
MongoDBRef | The reference number for the mongo connection. | $MongoDB | |
ClientCertificateKeyFile | The native path to the PEM file with the private key to use. | ||
ClientCertificateKeyPassword | The password for the PEM file with private key. | ||
CertificateAuthorityFile | The native file path for a CA file. e.g. get such a file from CURL website: https://curl.se/docs/caextract.html |
||
CertificateAuthorityDirectory | The native file path to the CA directory. | Optional | |
CertificateRevocationListFile | The native file path to the Certificate revocation list file. | Optional | |
AllowInvalidCertificates | Whether to do weaker certificate validation. Pass 1 to enable or 0 to disable. Default is 0 to disallow. |
0 | Optional |
AllowInvalidHostnames | Whether to allow invalid host names. Pass 1 to enable or 0 to disable. Default is 0 to disallow. This allows you to disable hostname validation to allow to continue if the hostname doesn't match the certificate. |
0 | Optional |
Result
Returns OK or error.
Description
Sets the TLS (SSL) options to use when connecting to TLS enabled MongoDB servers.A call to MongoDB.SetSSLOptions overrides all TLS options set through the connection string with which the client was constructed.
All texts can be empty if needed.
See Files.DeleteLater to delete a temporary key file when FileMaker quits.
Examples
Connect via certificate:
Set Variable [ $Mongo ; Value: MBS( "MongoDB.New" ) ]
If [ MBS("IsError") ]
Show Custom Dialog [ "Failed to create new MongoDB o…" ; $Mongo ]
Exit Script [ Text Result: ]
End If
#
# set URL with authentication via certificate
Set Variable [ $r ; Value: MBS( "MongoDB.SetURI"; $Mongo; "mongodb://localhost/?tls=true" ) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to parse connection str…" ; $r ]
Exit Script [ Text Result: ]
End If
#
# specify where to find keys
Set Variable [ $r ; Value: MBS( "MongoDB.SetSSLOptions"; $Mongo; "/Users/cs/Desktop/key.pem"; "test123"; "/Users/cs/Desktop/cacert.pem" ) ]
Set Variable [ $r ; Value: MBS( "MongoDB.SetAuthMechanism"; $Mongo; "MONGODB-X509" ) ]
#
# now connect
Set Variable [ $r ; Value: MBS( "MongoDB.Connect"; $Mongo) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to connect to MongoDB." ; $r ]
Exit Script [ Text Result: ]
End If
Allow all certificates without checking:
Set Variable [ $r ; Value: MBS( "MongoDB.SetSSLOptions"; $Mongo; ""; ""; ""; ""; ""; 1; 1) ]
See also
- Files.Delete
- Files.DeleteLater
- IsError
- MongoDB.Connect
- MongoDB.GetOptions
- MongoDB.New
- MongoDB.Release
- MongoDB.SetAuthMechanism
- MongoDB.SetURI
Release notes
- Version 13.4
- Added MongoDB.SetSSLOptions function.
Blog Entries
- News in MBS FileMaker Plugin 13.4
- Neues MBS Plugin 13.4 für Claris FileMaker
- MBS Plugin 13.4 for Claris FileMaker - More than 7100 Functions In One Plugin
- MBS FileMaker Plugin, version 13.4pr1
This function checks for a license.
Created 18th July 2023, last changed 24th June 2024