-
Notifications
You must be signed in to change notification settings - Fork 51
Secure openHistorian Web Interface adding https
Note that these instructions target a Windows deployment. Instructions for non-Windows platforms running with Mono will have similar instructions but instead use the httpcfg
tool:
http://manpages.ubuntu.com/manpages/xenial/man1/httpcfg.1.html
- Create a self-signed or obtain an SSL certificate
Note that certificate must be installed to Local Computer / Personal / Certificates in order for it to be associated with self-hosted web port.
- Copy the "thumbprint" from the certificate details with no spaces - this will become the
certhash
parameter value replacingYOUR_CERT_HASH
in the commands below. - Open an administrator command prompt and run the following commands:
netsh http add sslcert ipport=[::0]:8181 appid="{F65126E5-E27A-49DF-8188-1CDE74FE15F3}" certhash=YOUR_CERT_HASH
netsh http add sslcert ipport=0.0.0.0:8181 appid="{F65126E5-E27A-49DF-8188-1CDE74FE15F3}" certhash=YOUR_CERT_HASH
netsh http add urlacl url=https://+:8181/ user=Everyone
Port
8181
is selected as the secure port for SSL binding here since port8180
is preconfigured for non-SSL bindings, i.e.,http
, by default during installation. You will need to delete the existing urlacl bindings for8180
if you want to continue to use the original port, see removing ssl section below. Currently the self-hosted web service only listens on one port, so its usage will be SSL or not.
The
appID
parameter came from the[assembly: Guid("value")]
fromAssemblyInfo.cs
in theopenHistorian
service.
- Make sure
openHistorian
service is not running and update the following setting in theopenHistorian.exe.config
file:
<add name="WebHostURL" value="https://+:8181" description="The web hosting URL for remote system management." encrypted="false" />
Note that you can also run the
XML Configuration Editor
for the openHistorian to make this change. Using this tool, navigate to thesystemSettings
section and find the key calledWebHostURL
changing the value fromhttp://+:8180
tohttps://+:8181
. ClickingSave Settings
will stop the openHistorian service, save the configuration change and automatically restart the openHistorian.
- Make sure when navigating to openHistorian to use the new port and specify
https
:
- Open an administrator command prompt and run the following commands:
netsh http delete sslcert ipport=[::0]:8181
netsh http delete sslcert ipport=0.0.0.0:8181
netsh http delete urlacl url=https://+:8181/
- Ensuring
openHistorian
service is not running, update the following setting in theopenHistorian.exe.config
file changing the value fromhttps://+:8181
back tohttp://+:8180
:
<add name="WebHostURL" value="http://+:8180" description="The web hosting URL for remote system management." encrypted="false" />
Steps 1-2 create the self-signed certificate:
- Run
Windows PowerShell
as an Administrator - Run the following PowerShell command:
New-SelfSignedCertificate -FriendlyName "openHistorian Self-Signed Certificate" -DnsName openHistorianSSL, localhost -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(3)
Note that the
-NotAfter (Get-Date).AddYears(3)
parameter at the end of the command says the certificate will expire in three years.
Also, the
Thumbprint
value shown on the screen after the PowerShell command successfully ran will be needed for step 3 when adding ssl. Go ahead and copy this and save it for later as this will be the replacement value forYOUR_CERT_HASH
.
Steps 3-12 add the certificate to the Windows trusted certificate store:
- Run `mmc.exe'
- Press
Ctrl+M
(or selectFile > Add/Remove Snap-in...
) - Select
Certificates
and clickAdd
- Select
Computer account
and clickNext >
- Make sure
Local computer: (the computer the console is running on)
is selected and clickFinish
thenOK
- Navigate to the
Console Root / Certificates (Local Computer) / Personal / Certificates
folder - Right-click on
openHistorianSSL
certificate and selectCopy
- Navigate to the
Console Root / Certificates (Local Computer) / Trusted Root Certification Authorities / Certificates
folder - Right-click on the
Certificates
sub-folder ofTrusted Root Certification Authorities
in the tree and selectPaste
- The
openHistorianSSL
certificate should now be in theTrusted Root Certification Authorities / Certificates
folder and be trusted by the local system