Skip to content

Commit 25a4104

Browse files
committed
minor updates
- signed-off-by: trimstray <trimstray@gmail.com>
1 parent c236826 commit 25a4104

File tree

2 files changed

+44
-31
lines changed

2 files changed

+44
-31
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
* [Debug mode (with Lua)](doc/HELPERS.md#debug-mode-with-lua)
301301
* [Analyse data pass to and from the threads](doc/HELPERS.md#analyse-data-pass-to-and-from-the-threads)
302302
* [Parsing wrk result and generate report](doc/HELPERS.md#parsing-wrk-result-and-generate-report)
303-
* [Load testing with locust](#load-testing-with-locust)
303+
* [Load testing with locust](doc/HELPERS.md#load-testing-with-locust)
304304
* [Multiple paths](doc/HELPERS.md#multiple-paths)
305305
* [Multiple paths with different user sessions](doc/HELPERS.md#multiple-paths-with-different-user-sessions)
306306
* [TCP SYN flood Denial of Service attack](doc/HELPERS.md#tcp-syn-flood-denial-of-service-attack)
@@ -389,15 +389,16 @@
389389
* [Generate CSR (metadata from existing certificate)](doc/HELPERS.md#generate-csr-metadata-from-existing-certificate)
390390
* [Generate CSR with -config param](doc/HELPERS.md#generate-csr-with--config-param)
391391
* [Generate private key and CSR](doc/HELPERS.md#generate-private-key-and-csr)
392-
* [List available EC curves](#list-available-ec-curves)
392+
* [List available EC curves](doc/HELPERS.md#list-available-ec-curves)
393+
* [Print ECDSA private and public keys](doc/HELPERS.md#print-ecdsa-private-and-public-keys)
393394
* [Generate ECDSA private key](doc/HELPERS.md#generate-ecdsa-private-key)
394395
* [Generate private key and CSR (ECC)](doc/HELPERS.md#generate-private-key-and-csr-ecc)
395396
* [Generate self-signed certificate](doc/HELPERS.md#generate-self-signed-certificate)
396397
* [Generate self-signed certificate from existing private key](doc/HELPERS.md#generate-self-signed-certificate-from-existing-private-key)
397398
* [Generate self-signed certificate from existing private key and csr](doc/HELPERS.md#generate-self-signed-certificate-from-existing-private-key-and-csr)
398-
* [Generate multidomain certificate](doc/HELPERS.md#generate-multidomain-certificate)
399-
* [Generate wildcard certificate](doc/HELPERS.md#generate-wildcard-certificate)
400-
* [Generate certificate with 4096 bit private key](doc/HELPERS.md#generate-certificate-with-4096-bit-private-key)
399+
* [Generate multidomain certificate (Certbot)](doc/HELPERS.md#generate-multidomain-certificate-certbot)
400+
* [Generate wildcard certificate (Certbot)](doc/HELPERS.md#generate-wildcard-certificate-certbot)
401+
* [Generate certificate with 4096 bit private key (Certbot)](doc/HELPERS.md#generate-certificate-with-4096-bit-private-key-certbot)
401402
* [Generate DH public parameters](doc/HELPERS.md#generate-dh-public-parameters)
402403
* [Display DH public parameters](doc/HELPERS.md#display-dh-public-parameters)
403404
* [Extract private key from pfx](doc/HELPERS.md#extract-private-key-from-pfx)
@@ -406,14 +407,14 @@
406407
* [Convert DER to PEM](doc/HELPERS.md#convert-der-to-pem)
407408
* [Convert PEM to DER](doc/HELPERS.md#convert-pem-to-der)
408409
* [Verification of the certificate's supported purposes](doc/HELPERS.md#verification-of-the-certificates-supported-purposes)
409-
* [Check private key](#check-private-key)
410+
* [Check private key](doc/HELPERS.md#check-private-key)
410411
* [Verification of the private key](doc/HELPERS.md#verification-of-the-private-key)
411-
* [Get public key from private key](#get-public-key-from-private-key)
412+
* [Get public key from private key](doc/HELPERS.md#get-public-key-from-private-key)
412413
* [Verification of the public key](doc/HELPERS.md#verification-of-the-public-key)
413414
* [Verification of the certificate](doc/HELPERS.md#verification-of-the-certificate)
414415
* [Verification of the CSR](doc/HELPERS.md#verification-of-the-csr)
415-
* [Check whether the private key and the certificate match](doc/HELPERS.md#check-whether-the-private-key-and-the-certificate-match)
416-
* [Check whether the private key and the CSR match](doc/HELPERS.md#check-whether-the-private-key-and-the-csr-match)
416+
* [Check the private key and the certificate are match](doc/HELPERS.md#check-the-private-key-and-the-certificate-are-match)
417+
* [Check the private key and the CSR are match](doc/HELPERS.md#check-the-private-key-and-the-csr-are-match)
417418
[TLSv1.3 and CCM ciphers](doc/HELPERS.md#tlsv13-and-ccm-ciphers)
418419
- **[Base Rules (16)](doc/RULES.md#base-rules)**<a id="toc-base-rules"></a>
419420
* [Organising Nginx configuration](doc/RULES.md#beginner-organising-nginx-configuration)
@@ -1086,9 +1087,9 @@ Existing chapters:
10861087
- [x] _Generate self-signed certificate_
10871088
- [x] _Generate self-signed certificate from existing private key_
10881089
- [x] _Generate self-signed certificate from existing private key and csr_
1089-
- [x] _Generate multidomain certificate_
1090-
- [x] _Generate wildcard certificate_
1091-
- [x] _Generate certificate with 4096 bit private key_
1090+
- [x] _Generate multidomain certificate (Certbot)_
1091+
- [x] _Generate wildcard certificate (Certbot)_
1092+
- [x] _Generate certificate with 4096 bit private key (Certbot)_
10921093
- [x] _Generate DH public parameters_
10931094
- [x] _Display DH public parameters_
10941095
- [x] _Extract certs from p7b_
@@ -1101,7 +1102,7 @@ Existing chapters:
11011102
- [x] _Verification of the public key_
11021103
- [x] _Verification of the certificate_
11031104
- [x] _Verification of the CSR_
1104-
- [x] _Check whether the private key and the certificate match_
1105+
- [x] _Check the private key and the certificate are match_
11051106
- [x] _TLSv1.3 and CCM ciphers_
11061107

11071108
</details>

doc/HELPERS.md

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ Go back to the **[Table of Contents](https://github.com/trimstray/nginx-admins-h
157157
* [Generate CSR with -config param](#generate-csr-with--config-param)
158158
* [Generate private key and CSR](#generate-private-key-and-csr)
159159
* [List available EC curves](#list-available-ec-curves)
160+
* [Print ECDSA private and public keys](#print-ecdsa-private-and-public-keys)
160161
* [Generate ECDSA private key](#generate-ecdsa-private-key)
161162
* [Generate private key and CSR (ECC)](#generate-private-key-with-csr-ecc)
162163
* [Generate self-signed certificate](#generate-self-signed-certificate)
163164
* [Generate self-signed certificate from existing private key](#generate-self-signed-certificate-from-existing-private-key)
164165
* [Generate self-signed certificate from existing private key and csr](#generate-self-signed-certificate-from-existing-private-key-and-csr)
165-
* [Generate multidomain certificate](#generate-multidomain-certificate)
166-
* [Generate wildcard certificate](#generate-wildcard-certificate)
167-
* [Generate certificate with 4096 bit private key](#generate-certificate-with-4096-bit-private-key)
166+
* [Generate multidomain certificate (Certbot)](#generate-multidomain-certificate-certbot)
167+
* [Generate wildcard certificate (Certbot)](#generate-wildcard-certificate-certbot)
168+
* [Generate certificate with 4096 bit private key (Certbot)](#generate-certificate-with-4096-bit-private-key-certbot)
168169
* [Generate DH public parameters](#generate-dh-public-parameters)
169170
* [Display DH public parameters](#display-dh-public-parameters)
170171
* [Extract private key from pfx](#extract-private-key-from-pfx)
@@ -179,8 +180,8 @@ Go back to the **[Table of Contents](https://github.com/trimstray/nginx-admins-h
179180
* [Verification of the public key](#verification-of-the-public-key)
180181
* [Verification of the certificate](#verification-of-the-certificate)
181182
* [Verification of the CSR](#verification-of-the-csr)
182-
* [Check whether the private key and the certificate match](#check-whether-the-private-key-and-the-certificate-match)
183-
* [Check whether the private key and the CSR match](#check-whether-the-private-key-and-the-csr-match)
183+
* [Check the private key and the certificate are match](#check-the-private-key-and-the-certificate-are-match)
184+
* [Check the private key and the CSR are match](#check-the-private-key-and-the-csr-are-match)
184185
* [TLSv1.3 and CCM ciphers](#tlsv13-and-ccm-ciphers)
185186

186187
#### Installing from prebuilt packages
@@ -7492,7 +7493,7 @@ htpasswd -c htpasswd_example.com.conf <username>
74927493
74937494
```bash
74947495
# _len: 2048, 4096
7495-
( _fd="private.key" ; _len="4096" ; \
7496+
( _fd="private.key" ; _len="2048" ; \
74967497
openssl genrsa -out ${_fd} ${_len} )
74977498
```
74987499
@@ -7501,7 +7502,7 @@ openssl genrsa -out ${_fd} ${_len} )
75017502
```bash
75027503
# _ciph: des3, aes128, aes256
75037504
# _len: 2048, 4096
7504-
( _ciph="aes128" ; _fd="private.key" ; _len="4096" ; \
7505+
( _ciph="aes128" ; _fd="private.key" ; _len="2048" ; \
75057506
openssl genrsa -${_ciph} -out ${_fd} ${_len} )
75067507
```
75077508
@@ -7520,6 +7521,13 @@ openssl rsa -in ${_fd} -out ${_fd_unp} )
75207521
openssl rsa -${_ciph} -in ${_fd} -out ${_fd_pass}
75217522
```
75227523
7524+
###### Generate private key and CSR
7525+
7526+
```bash
7527+
( _fd="private.key" ; _fd_csr="request.csr" ; _len="2048" ; \
7528+
openssl req -out ${_fd_csr} -new -newkey rsa:${_len} -nodes -keyout ${_fd} )
7529+
```
7530+
75237531
###### Generate CSR
75247532
75257533
```bash
@@ -7604,17 +7612,21 @@ For more information please look at these great explanations:
76047612
- [Your OpenSSL CSR command is out of date](https://expeditedsecurity.com/blog/openssl-csr-command/)
76057613
- [OpenSSL example configuration file](https://www.tbs-certificats.com/openssl-dem-server-cert.cnf)
76067614
7607-
###### Generate private key and CSR
7615+
###### List available EC curves
76087616
76097617
```bash
7610-
( _fd="private.key" ; _fd_csr="request.csr" ; _len="4096" ; \
7611-
openssl req -out ${_fd_csr} -new -newkey rsa:${_len} -nodes -keyout ${_fd} )
7618+
openssl ecparam -list_curves
76127619
```
76137620
7614-
###### List available EC curves
7621+
###### Print ECDSA private and public keys
76157622
76167623
```bash
7617-
openssl ecparam -list_curves
7624+
( _fd="private.key" ; \
7625+
openssl ec -in ${_fd} -noout -text )
7626+
7627+
# For x25519 only extracting public key
7628+
( _fd="private.key" ; _fd_pub="public.key" ; \
7629+
openssl pkey -in ${_fd} -pubout -out ${_fd_pub} )
76187630
```
76197631
76207632
###### Generate ECDSA private key
@@ -7642,7 +7654,7 @@ openssl req -new -key ${_fd} -out ${_fd_csr} -sha256 )
76427654
76437655
```bash
76447656
# _len: 2048, 4096
7645-
( _fd="domain.key" ; _fd_out="domain.crt" ; _len="4096" ; _days="365" ; \
7657+
( _fd="domain.key" ; _fd_out="domain.crt" ; _len="2048" ; _days="365" ; \
76467658
openssl req -newkey rsa:${_len} -nodes \
76477659
-keyout ${_fd} -x509 -days ${_days} -out ${_fd_out} )
76487660
```
@@ -7665,19 +7677,19 @@ openssl x509 -signkey ${_fd} -nodes \
76657677
-in ${_fd_csr} -req -days ${_days} -out ${_fd_out} )
76667678
```
76677679
7668-
###### Generate multidomain certificate
7680+
###### Generate multidomain certificate (Certbot)
76697681
76707682
```bash
76717683
certbot certonly -d example.com -d www.example.com
76727684
```
76737685
7674-
###### Generate wildcard certificate
7686+
###### Generate wildcard certificate (Certbot)
76757687
76767688
```bash
76777689
certbot certonly --manual --preferred-challenges=dns -d example.com -d *.example.com
76787690
```
76797691
7680-
###### Generate certificate with 4096 bit private key
7692+
###### Generate certificate with 4096 bit private key (Certbot)
76817693
76827694
```bash
76837695
certbot certonly -d example.com -d www.example.com --rsa-key-size 4096
@@ -7789,14 +7801,14 @@ openssl x509 -noout -text -in ${_fd} )
77897801
openssl req -text -noout -in ${_fd_csr} )
77907802
```
77917803
7792-
###### Check whether the private key and the certificate match
7804+
###### Check the private key and the certificate are match
77937805
77947806
```bash
77957807
(openssl rsa -noout -modulus -in private.key | openssl md5 ; \
77967808
openssl x509 -noout -modulus -in certificate.crt | openssl md5) | uniq
77977809
```
77987810
7799-
###### Check whether the private key and the CSR match
7811+
###### Check the private key and the CSR are match
78007812
78017813
```bash
78027814
(openssl rsa -noout -modulus -in private.key | openssl md5 ; \

0 commit comments

Comments
 (0)