Tuesday, April 27, 2021

Adding a digicert certificate to xampp

I setup a computer that was connected to a building speaker system to act as a PA System.  I created a web utility that allowed users to enable and disable the audio if it was required without having to get IT to do it.  Now those with all the browser security settings and SSL everywhere I had to add an SSL Certificate to the server.

The Server is running XAMPP on Windows, so we have a couple steps to get this site validated.

  1. Download our Certificate and Key.  In this case the key is on my primary webserver, and the certificate I need to download from digicert.

  2. Install the certificate.  Using the "CMD Prompt" type MMC then add the snap in for certificates, ensure you use the "local computer" and then in the "Trusted Root Certification Authorities" import the SSL Certificate.

  3. Stop Apache, Create a folder in C:\xampp\apache\ called crt

  4. Create 2 Files, copy the content from the provided links into the new files. 
    cert.conf  https://gist.githubusercontent.com/turtlepod/3b8d8d0eef29de019951aa9d9dcba546/raw/518d3a96b7bb03494ada4f2ebde8325fb6ba6966/cert.conf
    and make-cert.bat
    https://gist.github.com/turtlepod/e94928cddbfc46cfbaf8c3e5856577d0

  5. Double click and run the make-cert.bat and create your local certificate, this will make it easier or create a directory with your domain name (pasystem.domain.ca) and copy/paste the cert and the key in there

  6. Add the following to the xampp conf file located in C:\xampp\apache\conf\extra\httpd-xampp.conf

    • And add this code at the bottom:
      ## site.test
      <VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs"
      ServerName pasystem.domain.ca
      ServerAlias pasystem.domain.ca
      </VirtualHost>
      <VirtualHost *:443>
      DocumentRoot "C:/xampp/htdocs"
       ServerName pasystem.domain.ca
      ServerAlias pasystem.domain.ca
      SSLEngine on
      SSLCertificateFile "crt/pasystem.domain.ca/server.crt"
      SSLCertificateKeyFile "crt/pasystem.domain.ca/server.key"
       </VirtualHost>
    • In newer versions of xampp you may need to combine them as shown below
      <VirtualHost *:80 *:443>
      DocumentRoot "C:/xampp/htdocs"
      ServerName pasystem.domain.ca
      ServerAlias pasystem.domain.ca
      SSLEngine on
      SSLCertificateFile "$PATH/crt/pasystem.domain.ca/server.crt"
      SSLCertificateKeyFile "$PATH/crt/pasystem.domain.ca/server.key"
      </VirtualHost>

  7. After that, you will need to restart Apache in XAMPP.

Reference

https://stackoverflow.com/questions/64800565/how-to-create-valid-ssl-in-localhost-for-xampp

https://shellcreeper.com/how-to-create-valid-ssl-in-localhost-for-xampp/

How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...