Main Content

Execute Deployed Functions Using HTTPS

Connecting to a MATLAB® Production Server™ instance over HTTPS provides a secure channel for executing MATLAB functions. To establish an HTTPS connection with a MATLAB Production Server instance:

  1. Ensure that the server instance is configured to use HTTPS. For more information, see Enable HTTPS.

  2. If the server instance uses a self-signed SSL certificate or if the root certificate of the server is not present in the trust store of the client machine, you must save the server certificate on the client machine.

  3. Install MATLAB Production Server add-ons using HTTPS.

MATLAB Client for MATLAB Production Server does not support sending a client certificate to the server. Therefore, you cannot use MATLAB Client for MATLAB Production Server to install add-ons from a server or execute functions deployed to a server that has client authentication enabled.

Save SSL Certificate of Server

Before your client application can send HTTPS requests to a server instance, the root SSL certificate of the server must be present in the Windows® Trusted Root Certification Authorities certificate store or Linux® trust store of the client machine. If the server uses a self-signed SSL certificate or if the root certificate of the server signed by a certificate authority (CA) is not present in the Windows certificate store, obtain the server certificate from the MATLAB Production Server administrator or export the certificate using a browser, then add it to the certificate store or the trust store.

Export and Save SSL Certificate

You can use any browser to save the server certificate on the client machine. The procedure to save the certificate using Google Chrome™ follows.

  1. Navigate to the server instance URL https://your_server_FQDN:port/api/health using Google Chrome.

  2. In the Google Chrome address bar, click the padlock icon or the warning icon, depending on whether the server instance uses a CA-signed SSL certificate or a self-signed SSL certificate.

  3. Click Certificate > Details > Copy to File. Doing so opens a wizard that lets you export the SSL certificate. Click Next.

  4. Select the format to export the certificate and click Next.

  5. Specify the location and file name to export the certificate, then click Next.

  6. Click Finish to complete exporting the certificate.

Add Certificate to Windows Certificate Store

You can use a certificate management tool or Microsoft® Management Console (MMC) to add the server certificate to the Windows certificate store. The procedure to add the certificate using MMC follows.

  1. Open MMC from your Windows machine.

  2. Click File > Add/Remove Snap-in. Doing so opens the Add or Remove Snap-ins window.

  3. In the Add or Remove Snap-ins window:

    1. Click Certificates from the left pane, then click Add.

    2. Select Computer account, then click Finish. Doing so adds Certificates(Local Computer) to the right pane.

    3. Click OK. Doing so takes you to the home window.

  4. In the left pane of the home window, under Console Root, double click Certificates(Local Computer). Doing so opens all the certificate folders located in the local machine.

  5. Select Trusted Root Certification Authorities > More Actions > All Tasks > Import. Doing so opens the Certificate Import Wizard.

  6. Click Next, then select the location of your server certificate.

  7. Click Next to import the certificate in the Trusted Root Certification Authorities certificate store.

Specify Custom Path to Certificate

MATLAB Client for MATLAB Production Server searches the default trust store for the server certificate, but also supports specifying the full path to a certificate file. Typically, you want to specify a path to the server certificate during testing. To do so, set the CertificateFile property using the prodserver.addon.set function. The value of the CertificateFile property persists between MATLAB sessions.

>> prodserver.addon.set('CertificateFile','/path/to/my/certificate.pem')

Install Add-On Using HTTPS

The default protocol for communication with the server is HTTP. If the server uses HTTPS, you must install an add-on from that server using HTTPS. Your MATLAB session can use HTTP with one server and HTTPS with another server simultaneously.

Install Add-On Using Command Line

Use the prodserver.addon.install function and set the TransportLayerSecurity property to true to use HTTPS.

>> prodserver.addon.install('fractal','localhost', 9920, 'TransportLayerSecurity', true)

Install Add-On Using Graphical Interface

  1. In the Servers section in the MATLAB Production Server Add-On Explorer app, click New. Doing so opens a dialog box where you enter details about the MATLAB Production Server instance that the MATLAB client wants to communicate with using HTTPS.

    Add new server using HTTPS

  2. Enter the host name and port number of the server instance, select HTTPS, then click OK. Doing so enables HTTPS communication between your MATLAB client and the server instance.

Manage Default Protocol for Client-Server Communication

Set the protocol for client-server communication to HTTPS by using the prodserver.addon.set function and setting the TransportLayerSecurity property to true. The protocol setting persists between MATLAB sessions.

prodserver.addon.set('TransportLayerSecurity', true);

View the current value of the TransportLayerSecurity property using the prodserver.addon.get function.

prodserver.addon.get('TransportLayerSecurity');
ans =

  logical
   1

See Also

| | |

External Websites