From 6c8c7b9b8288bd6d56979622c38d0a142000fc7c Mon Sep 17 00:00:00 2001 From: T10 Date: Wed, 2 Feb 2022 08:54:43 +0400 Subject: [PATCH 1/3] Change the installation path from global to user home dir .local/bin --- Makefile | 4 ++-- bin/ca-gen | 14 +++++++------- bin/cert-gen | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 108bb03..d6cbf49 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ install: ${MKDIR_P} /usr/local/bin @# Install binary - install -m 0755 bin/ca-gen /usr/local/bin/ca-gen - install -m 0755 bin/cert-gen /usr/local/bin/cert-gen + install -m 0755 bin/ca-gen ~/.local/bin/ca-gen + install -m 0755 bin/cert-gen ~/.local/bin/cert-gen @echo "Installation complete:" diff --git a/bin/ca-gen b/bin/ca-gen index 4426d06..b3a5af5 100755 --- a/bin/ca-gen +++ b/bin/ca-gen @@ -11,13 +11,13 @@ DEF_KEYSIZE=2048 DEF_DAYS=3650 DEF_SIGN_SIGNATURE="sha256" # Subject default options -DEF_COUNTRY= -DEF_STATE= -DEF_CITY= -DEF_ORG= -DEF_UNIT= -DEF_CN= -DEF_EMAIL= +DEF_COUNTRY=MU +DEF_STATE=GP +DEF_CITY=Mahebourg +DEF_ORG=Tricky-bit +DEF_UNIT=IT +DEF_CN=tricky-bit.int +DEF_EMAIL=thiery.louison@gmail.com # Verbosity DEF_VERBOSE= diff --git a/bin/cert-gen b/bin/cert-gen index f580c00..452bd27 100755 --- a/bin/cert-gen +++ b/bin/cert-gen @@ -11,16 +11,16 @@ DEF_KEYSIZE=2048 DEF_DAYS=825 DEF_SIGN_SIGNATURE="sha256" # Subject default options -DEF_COUNTRY= -DEF_STATE= -DEF_CITY= -DEF_ORG= -DEF_UNIT= -DEF_CN= -DEF_EMAIL= +DEF_COUNTRY=MU +DEF_STATE=GP +DEF_CITY=Mahebourg +DEF_ORG=Tricky-Bit +DEF_UNIT=IT +DEF_CN=tricky-bit.int +DEF_EMAIL=thiery.louison@gmail.com # v3 subject alt names -DEF_ALT_NAME= +DEF_ALT_NAME=trick-bit.int DEF_ALT_IP_NAME= # Verbosity From 5f4846bc5961fb186f538b4eeccb4935890def59 Mon Sep 17 00:00:00 2001 From: T10 Date: Wed, 2 Feb 2022 09:06:58 +0400 Subject: [PATCH 2/3] Make common config for rootCA and certificate external to the scripts in configs file --- Makefile | 1 + bin/ca-gen | 24 ++++++++++++------------ bin/cert-gen | 28 ++++++++++++++-------------- bin/configs | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 bin/configs diff --git a/Makefile b/Makefile index d6cbf49..6bc772f 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,7 @@ install: @# Install binary install -m 0755 bin/ca-gen ~/.local/bin/ca-gen install -m 0755 bin/cert-gen ~/.local/bin/cert-gen + install -m 0755 bin/cert-gen ~/.local/bin/configs @echo "Installation complete:" diff --git a/bin/ca-gen b/bin/ca-gen index b3a5af5..deb4fe2 100755 --- a/bin/ca-gen +++ b/bin/ca-gen @@ -7,18 +7,18 @@ set -o pipefail NAME="ca-gen" # Generate default options -DEF_KEYSIZE=2048 -DEF_DAYS=3650 -DEF_SIGN_SIGNATURE="sha256" -# Subject default options -DEF_COUNTRY=MU -DEF_STATE=GP -DEF_CITY=Mahebourg -DEF_ORG=Tricky-bit -DEF_UNIT=IT -DEF_CN=tricky-bit.int -DEF_EMAIL=thiery.louison@gmail.com - +# DEF_KEYSIZE=2048 +# DEF_DAYS=3650 +# DEF_SIGN_SIGNATURE="sha256" +# # Subject default options +# DEF_COUNTRY=MU +# DEF_STATE=GP +# DEF_CITY=Mahebourg +# DEF_ORG=Tricky-bit +# DEF_UNIT=IT +# DEF_CN=tricky-bit.int +# DEF_EMAIL=thiery.louison@gmail.com +source ~/.local/bin/configs # Verbosity DEF_VERBOSE= diff --git a/bin/cert-gen b/bin/cert-gen index 452bd27..892d942 100755 --- a/bin/cert-gen +++ b/bin/cert-gen @@ -7,22 +7,22 @@ set -o pipefail NAME="cert-gen" # Generate default options -DEF_KEYSIZE=2048 -DEF_DAYS=825 -DEF_SIGN_SIGNATURE="sha256" -# Subject default options -DEF_COUNTRY=MU -DEF_STATE=GP -DEF_CITY=Mahebourg -DEF_ORG=Tricky-Bit -DEF_UNIT=IT -DEF_CN=tricky-bit.int -DEF_EMAIL=thiery.louison@gmail.com +# DEF_KEYSIZE=2048 +# DEF_DAYS=825 +# DEF_SIGN_SIGNATURE="sha256" +# # Subject default options +# DEF_COUNTRY=MU +# DEF_STATE=GP +# DEF_CITY=Mahebourg +# DEF_ORG=Tricky-Bit +# DEF_UNIT=IT +# DEF_CN=tricky-bit.int +# DEF_EMAIL=thiery.louison@gmail.com # v3 subject alt names -DEF_ALT_NAME=trick-bit.int -DEF_ALT_IP_NAME= - +# DEF_ALT_NAME=trick-bit.int +# DEF_ALT_IP_NAME= +source ~/.local/bin/configs # Verbosity DEF_VERBOSE= diff --git a/bin/configs b/bin/configs new file mode 100644 index 0000000..d2fe7f1 --- /dev/null +++ b/bin/configs @@ -0,0 +1,17 @@ +# Generate default options +DEF_KEYSIZE=4096 +DEF_DAYS=3650 +DEF_SIGN_SIGNATURE="sha256" +# Subject default options +DEF_COUNTRY=MU +DEF_STATE=GP +DEF_CITY=Mahebourg +DEF_ORG=Tricky-bit +DEF_UNIT=IT +DEF_CN=tricky-bit.int +DEF_EMAIL=thiery.louison@gmail.com +# v3 subject alt names +DEF_ALT_NAME=trick-bit.int +DEF_ALT_IP_NAME= + + From e1756dd59cfd8635c10dcd0f95fc9f9c4585f368 Mon Sep 17 00:00:00 2001 From: T10 Date: Wed, 2 Feb 2022 09:11:52 +0400 Subject: [PATCH 3/3] Make common config for rootCA and certificate external to the scripts in configs file --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4293e37..890f5b2 100644 --- a/README.md +++ b/README.md @@ -15,46 +15,73 @@ All subsequent created certificates will then be valid SSL certificates to each **Table of Contents** 1. [Available Tools](#available-tools) - 1. [Tools](#tools) - 2. [Requirements](#requirements) - 3. [Installation](#installation) + 1. [Tools](#tools) + 2. [Requirements](#requirements) + 3. [Installation](#installation) 2. [Create Certificate Authoriy](#create-certificate-authority) - 1. [Usage: ca-gen](#usage-ca-gen) - 2. [Execute: ca-gen](#execute-ca-gen) - 3. [Example: CA](#example-ca) + 1. [Configuration](#config) + 2. [Usage: ca-gen](#usage-ca-gen) + 3. [Execute: ca-gen](#execute-ca-gen) + 4. [Example: CA](#example-ca) 3. [Create SSL Certificate](#create-ssl-certificate) - 1. [Usage: cert-gen](#usage-cert-gen) - 2. [Execute: cert-gen](#execute-cert-gen) - 3. [Example: SSL certificate](#example-ssl-certificate) + 1. [Usage: cert-gen](#usage-cert-gen) + 2. [Execute: cert-gen](#execute-cert-gen) + 3. [Example: SSL certificate](#example-ssl-certificate) 4. [Import CA into Chrome](#import-ca-into-chrome) 5. [License](#license) ----- +--- ## Available Tools #### Tools -| Tools | Description | -|--------------------------|-------------| -| [ca-gen](bin/ca-gen) | Creates a certificate authority | +| Tools | Description | +| ------------------------ | ---------------------------------------------------------- | +| [ca-gen](bin/ca-gen) | Creates a certificate authority | | [cert-gen](bin/cert-gen) | Creates SSL certificates signed by a certificate authority | #### Requirements -* `openssl` -* `bash` +- `openssl` +- `bash` #### Installation + ```bash $ sudo make install ``` +#### Configuration + +#### config + +update the following file(~/.local/bin/configs) + +```bash +# Generate default options +DEF_KEYSIZE=4096 +DEF_DAYS=3650 +DEF_SIGN_SIGNATURE="sha256" +# Subject default options +DEF_COUNTRY=MU +DEF_STATE=GP +DEF_CITY=Mahebourg +DEF_ORG=Tricky-bit +DEF_UNIT=IT +DEF_CN=tricky-bit.int +DEF_EMAIL=thiery.louison@gmail.com +# v3 subject alt names +DEF_ALT_NAME=trick-bit.int +DEF_ALT_IP_NAME= +``` ## Create Certificate Authority #### Usage: ca-gen + The following shows the general usage for `ca-gen`: + ```bash USAGE: ca-gen -n CN [-kdcslouev] ca-gen --help @@ -80,13 +107,16 @@ Required parameter ``` #### Execute: ca-gen + The following command shows how the CA is generated for the [Devilbox](https://github.com/cytopia/devilbox): + ```bash $ ca-gen -v -c DE -s Berlin -l Berlin -o Devilbox -u Devilbox -n devilbox.org \ -e ca@devilbox.org devilbox-rootCA.key devilbox-rootCA.crt ``` #### Example: CA + ```bash Certificate: Data: @@ -152,11 +182,12 @@ Certificate: 3e:3e:85:09 ``` - ## Create SSL Certificate #### Usage: cert-gen + The following shows the general usage for cert-gen: + ```bash USAGE: cert-gen -n CN [-kdcsloueav] cert-gen --help @@ -187,7 +218,9 @@ Required parameter ``` #### Execute: cert-gen + The following command shows how SSL certificates are generated for the [Devilbox](https://github.com/cytopia/devilbox): + ```bash $ cert-gen -v -c DE -s Berlin -l Berlin -o Devilbox -u Devilbox \ -n project.loc -e admin@project.loc \ @@ -200,6 +233,7 @@ $ cert-gen -v -c DE -s Berlin -l Berlin -o Devilbox -u Devilbox \ ``` #### Example: SSL Certificate + ```bash Certificate: Data: @@ -269,7 +303,6 @@ Certificate: b6:1a:14:ab ``` - ## Import CA into Chrome **1. Open Chrome settings - scroll down and click `Advanced`** @@ -292,7 +325,6 @@ Certificate: - ## License [MIT License](LICENSE.md)