WebHook.SetSSL
Sets SSL certificate and key to use.
Component |
Version |
macOS |
Windows |
Linux |
Server |
iOS SDK |
WebHook
|
11.5 |
✅ Yes |
✅ Yes |
✅ Yes |
✅ Yes |
✅ Yes |
MBS( "WebHook.SetSSL"; WebHook; CertificateFile; PrivateKeyFile { ; Password } )
More
MBS(
"WebHook.SetSSL"; /* Sets SSL certificate and key to use. */
$WebHook; /* The reference number of the web hook. */
$CertificateFile; /* The native file path to the certificate file. */
$PrivateKeyFile; /* The native file path to the private key file. */
$Password) /* Optional; The password needed to decrypt private key.e.g. "test" */
Less
Parameters
Parameter |
Description |
Example |
Flags |
WebHook |
The reference number of the web hook. |
$webhook |
|
CertificateFile |
The native file path to the certificate file. |
|
|
PrivateKeyFile |
The native file path to the private key file. |
|
|
Password |
Available in MBS FileMaker Plugin 13.3 or newer. The password needed to decrypt private key. |
"test" |
Optional |
Result
Returns OK or error.
Description
Sets SSL certificate and key to use.
We can then accept connections with TLS v1.2.
You can create your own SSL key and self signed certificate with openssl in the terminal:
openssl genpkey -out private_key.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048
Or with password: openssl genpkey -aes-256-cbc -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:4096
openssl req -new -key private_key.pem -out device1.csr
openssl x509 -req -days 365 -in device1.csr -signkey private_key.pem -out certificate.crt
Alternatively you can use the web server as proxy to do SSL and forward the call it gets at e.g. https://domainname/webhook to http://domainname:xxxx internally with some random port number you picked. This way the web hook is not exposed directly to the outside, but stays behind the web server and the firewall.
Examples
Start a SSL HTTP Webhook:
Set Variable [ $$WebHooks ; Value: MBS("WebHook.Create") ]
Set Variable [ $r ; Value: MBS("WebHook.SetSSL"; $$WebHooks; "/Users/cs/WebHook/certificate.crt"; "/Users/cs/WebHook/private_key.pem") ]
Set Variable [ $r ; Value: MBS("WebHook.Listen"; $$WebHooks; 9999) ]
Set Variable [ $r ; Value: MBS("WebHook.SetScript"; $$WebHooks; Get(FileName); "WebHookReceived") ]
See also
Release notes
Example Databases
Blog Entries
This function checks for a license.
Created 13th October 2021, last changed 14th May 2023
WebHook.SetMode
-
WebHook.SetScript