Get SSL certificate expiry date quickly and easily with ckcrt script

SSL certificates are daily routine of my work, so there was regular practice to check expiry date of live certificate through Chrome browser -> Developer tools. It is quite time-consuming and annoying work if you have to repeat it. So I made this very simple bash script with which you can check expiry date and some other certificate information quickly, from your terminal. This will work on osx or linux machines. Of corse, you must have OpenSSL installed on your machine in order to use this script.

Continue Reading

PHP: SSL operation failed with code 1

If you installed PHP 5.6 or grater and your application returns something like this:

SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL...

Then there is a simple fix for that. You can override default OpenSSL’s CA bundle with the one bellow.

  1. Download this cert bundle.
  2. Add this line to your php.ini file
    openssl.cafile=/path/to/your/downloade/cacert.pem
  3. Restart apache/nginx and you should be ok.

How to transfer SSL certificate from Linux to Windows

Sometimes you may want to transfer your SSL certificate to Windows enviroment. So if you searching for how to transfer and find this article, than I’m sure that you know how to install certificate on Linux or Windows machine. Otherwise there are a million tutorials that you can find on google. I will explain how to transfer your certificate from Linux to Windows.

First, you need to create .pem file. This file must contain private key and certificate hash (.key and .crt). Open your favorite text editor (vi) and paste the content of your key and certificate file in one file. You must paste it in that order with a line break. First key and then crt. Save this file as sslcertificate.pem.

On IIS server you’ll need a file in p12 format. You can simply create p12 file by execute command below on your Linux machine. You’ll have to define password for your .p12 file. Remember this password because you’ll need it later!

openssl pkcs12 -export -in sslcertificate.pem -out sslcertificate.p12 //replace with your attributes

Transfer your freshly created sslcertificate.p12 file on to your Windows machine. You’ll import your sslcertificate.p12 in your IIS. On Windows machine, find properties of your website in IIS and then go into Directory Security tab. Click on button Server Certificate and then select option Import. Than will asked you to find file. You need to change scope to All files as otherwise, sslcertificate.p12 file won’t be visible. When you’ll select sslcertificate.p12 file, you’ll be asked to enter password. Enter the password that you defined in step 3. This is it! You transferred SSL certificate from Linux to Windows.

© 2024 geegkytuts.net
Hosted by SIEL


About author