Generate a CSR+Key from the shell with a GUI
This script allows you to generate a CSR (and the relative key) with Openssl with ease, providing you with a GUI to input all the necessary parameters (CN, SANs, key length, ecc.)
The generation is performed by openssl, while the graphical interface is rendered via dialog. At the end the script produces a .CSR, to be used with your Certification Authority to generate a certificate, and .KEY file containing the private key.
- You will need the openssl toolkit, in most cases it is installed by default on all Linux distributions (openssl GitHub page).
- The graphical interface is provided by Dialog, so you will need to install it to make this script work.
- Make sure Dialog is available on your system by running:
dialog --version
If not, you can install it by following the instructions in this chapter
- Make sure openssl is available on your system by running:
openssl version
- Download shellcsrgen.sh from the main branch to your local machine:
wget https://raw.githubusercontent.com/EarlyOwl/ShellCSRGen/main/shellcsrgen.sh
- Make it executable:
chmod +x shellcsrgen.sh
- Run the script with:
./shellcsrgen.sh
The procedure is pretty straightforward. At first you will have to provide the Country (C), State (S), Locality (L), Organization Name (O), Organizational Unit (OU) and, most importantly, the Common Name (CN):
A prompt will ask you if you want to provide Subject Alternative Names (SAN). If you want to do so, select Yes. You will then be able to insert as many IP/DNS SANs as you want.
The next selection will give 4 options for the key length: 2048, 3072, 4096 and 7168
A confirmation screen will show a brief summary of the provided data. If everything's correct, select Yes to proceed.
Finally you will be able to choose the filename/path for both the CSR and the KEY. At the end a confirmation screen will inform you of the successful creation of the files.
If Dialog is not present on your machine, you can run those commands based on your current OS / distro to install it:
sudo apt-get update
sudo apt-get install dialog
sudo yum install dialog
Install it via HomeBrew by running:
brew install dialog
Yes and yes.
I'm eager to learn, open an issue or a pull request to suggest an improvement / fix.