How to secure the powerGateServer connection with a certificate

Create Certificate

A self signed certificate can be generated using the Internet Information Service(IIS). This step can be skipped if you already have a certificate.

  1. Click on the Start menu and open the Internet Information Services (IIS) Manager
  2. Click on the name of the server in the "Connections" panel on the left
  3. Double click on "Server Certificates"
  4. On the right side, click on "Create Self-Signed Certificate"
  5. Enter a name and click "OK"

Add the certificate to the trusted root store

The self signed certificate can be added to the trusted root store in order to avoid errors with the certificate:

  1. Open the Microsoft Management Console (MMC)
  2. Click on "File" -> "Add/Remove Snap-in..."
  3. Search for "Certificates" and click "Add >"
  4. Choose the account and click "Finish"
  5. Click "OK"
  6. Click on "Certificates"
  7. Right click on a folder and go to "All Tasks" -> "Import"
  8. Select your certificate

powerGateServer configuration

Navigate to the plugin folder C:\ProgramData\coolOrange\powerGateServer\Plugins and open your "{NameOfYourPlugin}.addin" file, which must be extended, so that all the implemented Webservices are accessible through the HTTPS protocol:

{
 "Assembly": ".\NameOfYourPlugin.dll",
"Protocol":"https",
}

 

Change the security setting in line 9 in the file powerGateServer.exe.config under C:\Program Files\coolOrange\powerGateServer:

<security mode="Transport" />

Note: All the installed plugins must now be changed to use https instead http bindings!

IIS configuration

Solution 1: IIS Manager

In order to enable the HTTPS within IIS, open the Internet Information Services (IIS) Manager and navigate to Sites -> Default Web Site. Click on Bindings... and create a new https binding for the previously configured port.

IIS_add_https_bindingThe previously created SSL-certificate must now be selected.

Solution 2: Command line

Bind the certificate to an URL or a port using the Command Line

The certificate needs to be bound to an url or a port using netsh.

In order to create a binding ip and port or URLcertification hash and application id need to be defined.

IP and port(ipport):

Syntax <IP>:<Port>

<IP> can be set to 0.0.0.0 to match all IPv4 and IPv6 addresses

<Port> can be chosen freely, but mustn't be reserved or used by another application

URL(urlacl):

If using the urlacl it is important to also specify the certstorename parameter, otherwise cryptic errors are thrown

certification hash(certhash):

This can be copied from the certification file properties in IIS

Application id(appid): choose an appid in order to identify this binding later. This should be in the format {00112233-4455-6677-8899- AABBCCDDEEFF}

Syntax:

netsh http add sslcert ipport=<ipport> certhash=<certhash> appid=<appid>

Example (! Do not copy. This is just an example how to call netsh!):

netsh http add sslcert ipport=0.0.0.0:8081 certhash=0102030405060708090A0B0C0D0E0F1011121314 appid={00112233-4455-6677-8899- AABBCCDDEEFF}

 

Optionally you can configure namespace reservations for the previously configured protocol and port, run the following command prompt with elevated privileges:

netsh http add urlacl url=https://+:8081/PGS user=\Everyone

::on german environments this command fails with: Die SDDL konnte nicht erstellt werden. Fehler: 1332
::use the following command instead:
::netsh http add urlacl url=https://+:8081/PGS user=\Jeder

 

powerGate Client workstations

TLS 1.0, TLS 1.1 and TLS 1.2 must be enabled on all workstations which connect to the powerGateServer through HTTPS bindings.

Depending on the used .Net Framework version of the hosting applications (or possibly when using Internet Explorer) these TLS layers must be enabled manually (see KB article: How to use powerGate with TLS 1.2).

Install the self signed certificate on all workstations so that workstations don't get the error message "There is a problem with this website's security certificate".

See also

ServicePointManager.Security Protocol Property (Microsoft docs)

TLS best practices (Microsoft docs)

How to enable TLS 1.2 (Microsoft docs)

Security of webHttpBinding (Microsoft docs)