Quick and easy self signed ssl certificate

In many environments you can use ssl encryption, and you may skip the encryption because generating a cert or getting a lets encrypt cert would add more time to the thing your are working on. To overcome this security issue I wrote a small script to create a crt and key file.

selfsigned.sh

#!/bin/bash

# fast ssl cert without ca

ENDPOINT=$1

openssl genrsa -out $ENDPOINT.key 2048
openssl req -new -x509 -key $ENDPOINT.key -out $ENDPOINT.crt -days 3650 -subj /CN=$ENDPOINT

Usage:

 ./selfsigned.sh domain.tld
Generating RSA private key, 2048 bit long modulus
..............+++
....+++
e is 65537 (0x010001)

This created 2 files domain.tld.key and domain.tld.crt

Avatar
Stein van Broekhoven
Cloud & Open-Source magician 🧙‍♂️

I try to find the KISS in complex systems and share it with the world.

comments powered by Disqus

Related