To enable https in Liberty Scanlab you have to create a SSL certificate. You do that by performing one of these 3 tasks:
- Create a self signed certificate (for testing purposes only)
- Import a key and/or a certificate file (e.g. from certbot / letsencyrpt)
- Create a certificate sign request
From Darwin 2.10 on Liberty provides a wizard that guids you through the process.
Create a self signed certificate
This is done to quickly test an SSL connection. The resulting certificate is not usable for a production-use as your clients browsers will warn you that the certificate is not secure.
- Open the LibertyConfig tool
- Hit Manage Certificate
- Hit Create a self signed certificate
- Fill out All fields and check "Generate"
- Hit Save to finally save the certificate files in the Liberty directory. Note: sometimes it fails and the generation needs be performed a second time. If the problem persists please contact us.
- Enable SSL
- ATT: If "Enforce Strong Ecryption" is used, clients need to use Darwin Version 2.9.2 or newer.
- If you do not have any need for http (like having let's encrypt certificates) enable automatic redirection to https
- Restart the service
- Open a webbrowser, open https://localhost/
- Click away the warning that the certificate is not secure and select "connect anyway".
Import a certificate created fully by a 3rd party like certbot/letsencrypt (recommended)
First you need to acquire a certificate. We describe the process for letsencrypt, a free encryption initiative supported by all major IT companies.
First things first: Make sure port 80 is accessible from the outside internet and points to your Liberty installation. To test this, disable WLAN on your smartphone. If you then type in "http://www.myServer.com" on your phone you must see your liberty start screen.
There is an installation guide on the Certbot page. Please follow the instructions on the website.
I short:
- Download and run the certbot installer
- run "certbot certonly --webroot"
- Enter the requested information (email, domain name).
- The path to the webroot directory by default is "c:"C:\program Files (x86)\LibertyScanlab\htdocs"
The program generates 4 files in C:\Certbot\live\liberty.MyHospitalDomain.com which now need to be installed into Liberty:
- Open LibertyConfig
- Click Manage Certificate
- Click Import certificate and key file
- Select the file privkey.pem as the private key
- Select the file fullchain.pem as the certificate file
- Hit Import to save the certificate in the Liberty installation.
- Enable SSL
- Enforce Strong Ecryption only all Darwin clients connecting are versions > 2.9.2 !
- Restart the service
Certificate renewal
ATT: If your certificate provider requires the site to be reachable on port 80 (like e.g. Letsencrypt) , then don't set the "Automatic redirct to port 80" option.
The Letsencrypt certificates are valid for 4 months and need to be updated from time to time. For this purpose certbot created a scheduled task called the Certbot Renew Task. To feed the updated certificates into Liberty create a batchfile "UpdateCert.bat" in the directory: „C:\certbot\renewal-hooks\deploy“
net stop LibertyScanlab
xcopy "C:\Certbot\live\liberty.MyHospitalDomain.com\privkey.pem" "C:\ProgramData\Liberty\server.key" /Y
xcopy "C:\Certbot\live\liberty.MyHospitalDomain.com \fullchain.pem" "C:\ProgramData\Liberty\server.crt" /Y
net start LibertyScanlab
Naturally you need to change"liberty.MyHospitalDomain.com" to your domain.
To test the renewal process you can issue the command:
certbot.exe renew --dry-run
as Admin
Congratulations. You've set up an SSL certificate for your Liberty server.
Generate a fully certified certificate
Alternatively, if you want to send the certificate request to a signing entity yourself:
- Open the LibertyConfig tool
- Hit Manage Certificate
- Hit Create a certificate request.
- Fill out All fields and check "Generate"
- Save the generated file and provide that file to the 3rd party certification institution (e.g. Verisign, CaCert and others)
- Hit Save to finally save the private key.
- When getting the certificate from the certification organisation hit "Manage Certificate" and then "Import a certificate".
- Hit the "Import Certificate" and select the file.
- Hit Save to finally save the certificate in the Liberty installation.
- Enable SSL
- Enforce Strong Ecryption only all Darwin clients connecting are versions > 2.9.2 !
- If you do not have any need for http (like having let's encrypt certificates) enable automatic redirection to https
- Restart the service
All certificate files are stored at C:\ProgramData\Liberty
Troubleshoot certificate imports
In some cases the key file stemming from a third party certification issuing institution the key file is password protected. In that case we need to remove the password protection from that file so apache can read it without any password prompt.
To remove a password from a key file (aka a .pkey file) one needs to issue the command:
openssl.exe pkey -in <yourfile.pkey> -out keyfile.pem
Openssl.exe can be found in the Liberty installation path which is in a default installation:
"C:\Program Files (x86)\LibertyScanlab\bin"
For versions <= 2.9.2 please follow these steps
Note: For real production servers the certificate should be signed by a 3rd party certification authority, otherwise browsers will complain about an untrusted connection!
To create a self signed certificate proceed the following steps:
- Stop the liberty service
- Open Cmd.exe as Administrator
- Change to the libertyScanlab installation directory e.g. cd "C:\Program Files (x86)\LibertyScanlab\bin\"
- In the command shell enter the following commands:
set OPENSSL_CONF=C:/Program Files (x86)/LibertyScanlab/conf/openssl.cnf
openssl req -new -out server.csr
* enter a pem passphrase eg "mypass123"
* enter country code, e.g. "at"
* <enter>, <enter>
* enter your company name, eg "Schiller inc"
* <enter>
* fqdn, eg www.schiller.ch
* email, egThis email address is being protected from spambots. You need JavaScript enabled to view it.
* challenge-pwd, e.g. challengepwd
* <enter>
openssl rsa -in privkey.pem -out server.key
* pass like above, eg "mypass123"
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
5. Copy the 4 files "server.csr", "privkey.pem", "server.key" and "server.crt" to the conf directory e.g. "C:\ProgramData\Liberty\"
6. Enable the modules in the liberty server configuration:
Open the file "C:/Program Files (x86)/LibertyScanlab/conf/ssl.conf". Note that the editor needs to be opened as Administrator otherwise the content cannot be saved.
Locate the lines:
#LoadModule log_config_module modules/mod_log_config.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
and remove the "#" characters - this advises the server to load the encryption modules.
Save the file
7.) Start and test the server
Start the service from the "Liberty configuraton" tool
Browse to https://localhost/tom24x/
You will need to click around a bit to convince the browser to open the page with a self-signed certificate
Enjoy
Debugging:
If the system does NOT work, try the following:
Shut down the liberty service.
Start the server ("C:\Program Files (x86)\LibertyScanlab\bin\httpd.exe") in a console (cmd.exe) to check if any configuration errors occur. If you are running 64 bit operating system the server will indeed fail to start with the error message "SSLSessionCach invalid argument".
This is a known problem of apache since the interpretation of the "C:/Program Files (x86)" fails. If that happens try the following:
- Create the folder C:\ProgramData\Liberty\cache (if not already there)
- Search for the the value "SSLSessionCache" and set this line to:
SSLSessionCache "shmcb:C:/ProgramData/Liberty/cache/ssl_cache(512000)" - Find the value "ErrorLog" in the <VirtualHost _default_:443> section and change the value to:
ErrorLog "C:/ProgramData/Liberty/logs/error.log" - Find the TransferLog value in the <VirtualHost _default_:443> section and change the value to:
TransferLog "C:/ProgramData/Liberty/logs/access.log"