Commit Graph
1168 Commits
Author SHA1 Message Date
Richard T Bonhomme 7a0c5294b7 Merge branch 'options-number-check' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-options-number-check
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 22:47:55 +01:00
Richard T Bonhomme 55a213c0b4 Help: Remove obsolete test for --vars and --pki-dir (#640)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-20 20:53:29 +01:00
Richard T Bonhomme 901e06970c Options: Check that $val is numeric when a number is expected
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-20 14:34:54 +01:00
Richard T Bonhomme c8e93caafe Merge branch 'TinCanTech-renew-key-notice'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-20 12:30:44 +01:00
Richard T Bonhomme 7a04e503ff Merge branch 'renew-key-notice' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-renew-key-notice
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-20 12:29:22 +01:00
Richard T Bonhomme fbe664a988 renew: Improve notices and input checks
Add warning for new password status, prior to renewal.

Add reminder to replace certificate AND key files, after renewal.

Correct input check for option 'nopass'

Closes: m#644

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-19 18:30:38 +01:00
Richard T Bonhomme 62f203cf17 Unit-test: Update OpenSSL hash to version 3.0.5 (Linux Only)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-19 15:44:21 +01:00
Richard T Bonhomme fef28007f3 Merge branch 'TinCanTech-always-warn-unsupp-chars'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-19 14:36:24 +01:00
Richard T Bonhomme 74a43fd86a vars_setup(): Always warn about unsupported characters in vars
Previously, testing vars for unsupported characters was only done if
vars was in the PKI.  This test can now be done for all vars files.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-18 13:30:14 +01:00
Richard T Bonhomme a9cf058cae Merge branch 'TinCanTech-improve-prog_dir'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-18 12:16:43 +01:00
Richard T Bonhomme dc501cdca3 Merge branch 'improve-prog_dir' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-prog_dir
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-18 12:15:47 +01:00
Richard T Bonhomme 5e649344d0 Merge branch 'TinCanTech-enable-user-vars-init-pki'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-18 11:41:43 +01:00
Richard T Bonhomme 9278bc6923 Expand the possible values of $prog_dir, include full path
The 3 definitions of $prog_dir:
- foo -> prog_dir=/search/path ## Not $PWD
- ./foo -> prog_dir=. ## $PWD
- /full/path/foo -> prog_dir=/full/path ## Could be $PWD

'/full/path' was previously missing from the check.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-17 23:04:11 +01:00
Richard T Bonhomme 48f7ed5f10 Re-enable the use of --vars=file for init-pki
Since relaxing the rules concerning the location of vars file,
commit f4a604438d, it is no longer
necessary to prohibit the use of --vars=file with 'init-pki'.

This initial prohibition was only a temporary measure and has
proven to be of no value.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-17 18:20:43 +01:00
Richard T Bonhomme a80e6b289f Merge branch 'TinCanTech-improve-verify-ca-init'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-16 23:01:18 +01:00
Richard T Bonhomme b77963bff2 Merge branch 'improve-verify-ca-init' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-verify-ca-init
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-16 23:00:10 +01:00
Richard T Bonhomme d6aaf5bc4c Merge branch 'TinCanTech-show-cmds-guard-input'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-16 22:55:55 +01:00
Richard T Bonhomme 0edbdc3446 show: Reorder parameter checks to guard against empty input
'shift 2' was moved above the parameter check in previous commit:
1d227736e4

Move it back to after the check and reword user output for clarity.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 19:21:02 +01:00
Richard T Bonhomme bb304946ba verify_ca_init: Reorder names to improve error message
If verify_ca_init fails then the error message states that: 'serial
is missing'.  While this is true, it is not 'user friendly'.

Reorder the checks so that if verify_ca_init fails then the error
message will "probably" state that: 'ca.crt is missing', which makes
more sense if the CA has not been initialised.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 17:36:18 +01:00
Richard T Bonhomme 4cd102764c Merge branch 'TinCanTech-prohibit-cert-type-common'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 13:48:43 +01:00
Richard T Bonhomme 5dfeff8984 sign--req: Prohibit COMMON as a certificate type
The command 'sign-req COMMON client1 nopass' would generate an invalid
certificate. Do not allow COMMON as a $cert_type.

Also, improve comment and user output for existing certificate check.

Closese: #634

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 13:13:55 +01:00
Richard T Bonhomme 0d999826ea Merge branch 'TinCanTech-improve-gen-dh'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 12:50:30 +01:00
Richard T Bonhomme d42d7504f9 gen-dh: Standardise user messages
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 12:12:01 +01:00
Richard T Bonhomme ed2f1c7cb0 gen-dh: Use temporary file
If a user breaks out [Ctrl-C] from generating a DH parameters file
then there is an empty dh.pem file left over.

Output the DH parameters to a temp-file and move it upon validation
and completion.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-15 01:01:03 +01:00
Richard T Bonhomme 93ec118851 Add Quiet mode to ChangeLog
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-14 20:34:26 +01:00
Richard T Bonhomme 8b7e79096b Introduce Quiet mode option -q|--quiet, disable information output
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-14 20:22:02 +01:00
Richard T Bonhomme ceef45784e Merge branch 'TinCanTech-fix-make-cadir'
Ref: #627 #633

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-14 17:10:19 +01:00
Richard T Bonhomme 20f7aaa9c6 init-pki: Re-order locations of required data files
Prefer /usr/local/share over /usr/share
and move /etc/easy-rsa to last place.

Tidy up a 'case', no functional change.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-13 21:16:58 +01:00
Richard T Bonhomme f4a604438d Allow vars file to exist in current directory (Fix make-cadir)
The utility script 'make-cadir' creates a CA directory with a vars file.
This vars file conflicts with the preferred PKI-vars file.

This patch changes 'init-pki' to allow make-cadir vars file to over-ride
the preferred PKI-vars file, without error.

Closes: #633

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-13 20:40:57 +01:00
Richard T Bonhomme 5b4fd2b484 sign-req: Check for an existing certificate
'sign-req' must not over-write an existing certificate.

Closes: #629

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-08 14:13:32 +01:00
Richard T Bonhomme f3f984991a rewind-renew: Correct user messages, replace 'renew' with 'rewind'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-08 13:20:38 +01:00
Richard T Bonhomme 7b4d2fb23e Merge branch 'TinCanTech-rewind-mkdir'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-07 12:55:58 +01:00
Richard T Bonhomme 10bce6c384 Merge branch 'rewind-mkdir' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-rewind-mkdir
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-07 12:54:49 +01:00
Richard T Bonhomme 3cd149275d Merge branch 'TinCanTech-renew-cleanup'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-06 16:24:24 +01:00
Richard T Bonhomme 8da0d2516d Merge branch 'renew-cleanup' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-renew-cleanup
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-06 16:22:52 +01:00
Richard T Bonhomme 27bed349b5 Merge branch 'TinCanTech-renew-req'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-06 15:10:22 +01:00
Richard T Bonhomme 51aa8a88e7 Merge branch 'renew-req' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-renew-req
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-06 15:08:57 +01:00
Richard T Bonhomme 2ab7205131 Squashed commit - doc: Add 'ed' option to EASYRSA_ALGO
commit 37232a8a6677dcdd5be4b4f9d3f1c8241e214a49
Merge: bee93cf a3c9f0b
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Fri Aug 5 18:05:56 2022 +0100

    Merge branch 'doc-add-ed' of ssh://github.com/mnme/easy-rsa into mnme-doc-add-ed

    Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>

commit a3c9f0bb5b79fa9fffaaf65b109069035138788b
Author: Nicolas Jeker <n.jeker@gmx.net>
Date:   Thu Aug 20 11:31:32 2020 +0200

    doc: Add 'ed' option to EASYRSA_ALGO

    Related to #488

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-05 18:08:02 +01:00
Richard T Bonhomme bee93cf869 Merge branch 'TinCanTech-up23-secure-session'
Note: This change only assigns the secure session variable,
it does not create the directory nor any files within it.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-07-30 12:34:08 +01:00
Richard T Bonhomme 4567091c1f Upgrade-23: Assign a secure session for temporary directory
To create Easyrsa Safe SSL config file, a standard temporary
directory is required, which can only be created after a secure
session has been assigned.

Closes: #622

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-07-30 11:57:38 +01:00
Richard T Bonhomme a46e33a019 Improve comments regarding 'verify_pki_init' (No functional change)
Also, verify use of verify_pki_init(), manually.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-26 01:10:24 +01:00
Richard T Bonhomme ae584fae99 Add 'renew-req' to ChangeLog
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-25 16:54:01 +01:00
Richard T Bonhomme 30bb214c86 Ensure 'pki/renewed/<folders>' exist for 'rewind-renew'
It is possible that only the 'foo_by_serial' folders will exist in
the 'pki/renewed' sub-folder when 'rewind-renew' is needed.

Create the required folders when using 'rewind-renew'.

Closes: #612

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-25 16:16:15 +01:00
Richard T Bonhomme 6060015b39 Restore files when 'renew' fails during 'build_full()' phase
Because easyrsa uses die() on errors, functions which call other
functions may not receive a returned error code and, therefore,
a test for an error will not occur in the calling function.

If 'renew' fails in the build_full() phase then build_full(), gen_req()
or sign_req() will error out to die() and not return an error to 'renew'.
This leaves the files which are about to be renewed in the 'renewed'
sub-folder without replacement files in the PKI folders.

Set 'on_error_undo_renew_move=1' and call renew_restore_move() from
cleanup() when an error occurs during the build_full() phase of 'renew'.

Closes: #613

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-25 15:25:56 +01:00
Richard T Bonhomme 727cd69108 Introduce 'renew-req': Create new certificate request for an existing key
EasyRSA 'renew' does not renew a certificate, it builds a new cert/key pair.
This 'old' method thus causes the Entity Private Key to be 'leaked'.

'renew-req' allows the original Entity Private Key to remain ''secure''.

This is achieved by generating a new certificate request for the original
Entity Private Key, to be submitted for signing by the CA administrator.

Resolves: #609

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-25 13:51:42 +01:00
Richard T Bonhomme e5ec1ab771 Document '--req-serial' - Update 'help' and ChangeLog
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-21 00:22:50 +01:00
Richard T Bonhomme 8135e762c4 Merge branch 'TinCanTech-org-serialNumber'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-20 23:38:57 +01:00
Richard T Bonhomme 47080028e3 Remove stray space characters
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-20 23:11:59 +01:00
Richard T Bonhomme 72a32a3288 Introduce 'serialNumber' field for DN (OID 2.5.4.5)
Add a *final* layer of granularity to X509 Distinguished Name.
Only used if --req-serial="<PRINTABLE>user data" is specified.

To minimize the noise to the user by this new field, change the way
that OpenSSL is called to build a CA: Always use '-batch' mode.

User visible change when building a CA:
* Instead of being prompted for each individual DN field, now the
  user is presented with a read-out of how the fields are currently
  set. There is now only a single confirmation that all fields are
  correct.
* If '--req-serial' is not used then 'serialNumber' is not displayed.

PRINTABLE: a-z,A-Z,0-9, -+/=.,?:()

Closes: OpenVPN#462 - The original proposal and prototype code.
Closes: OpenVPN#598 - Supersedes: Introduce 1.organizationalUnitName
Closes: OpenVPN#600 - Bugfix: Remove unused 'name' definition from SSL conf.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-20 21:46:11 +01:00
Richard T Bonhomme c300f6043f LibreSSL corrections: genpkey and no-password
Squashed commit of the following:

* easyrsa_openssl() - Disable 'genpkey -config' for LibreSSL
  Closes: #601

* Set '-nodes' for LibreSSL version 3 'no-password' mode
  Closes: #602

Minor corrections to indentation/comments.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-20 00:54:42 +01:00