Commit Graph
727 Commits
Author SHA1 Message Date
Richard T Bonhomme dbe894dec6 Update help: Standardise output; Improve code; Reprioritise options
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-23 21:42:03 +00:00
Richard T Bonhomme a8d7f3d50f Merge branch 'SIGINT-exit' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-SIGINT-exit
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-22 18:22:12 +00:00
Richard T Bonhomme a7e837cf92 Fix shellcheck warning for command set-pass case statement
Plus minor improvement to set-pass help text.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-22 16:23:00 +00:00
Richard T Bonhomme f8a5f46f1d Minor improvements to help for cmd:'set-pass' and opt:'--no-pass'
Squashed commit of the following:

commit 4f142baa04227963f291948dcbe2cb08e6ac6cd1
Merge: 0ee7a6d bcc71d6
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Mon Nov 21 20:23:22 2022 +0000

    Merge branch 'doc-set-pass' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-doc-set-pass

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

commit bcc71d6c7e0d7bfe1d628cadc13689eb32fd4c8d
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Mon Nov 21 15:14:27 2022 +0000

    Minor improvements to help for cmd:'set-pass' and opt:'--no-pass'

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-21 20:26:08 +00:00
Richard T Bonhomme 3cb322049a cleanup(): Exit correctly for SIGINT
Also, replace $die_error_exit with $confirm_aborted:
Make die() the default exit on error.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-20 20:54:52 +00:00
Richard T Bonhomme 0ee7a6d75e Minor refactor: escape_hazard()
Squashed commit of the following:

commit 81937721412478c0f4b7d32b6a55d18099608d88
Merge: 43d7648 345e6cc
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Nov 20 13:37:05 2022 +0000

    Merge branch 'improve-escape_hazard' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-escape_hazard

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

commit 345e6cc5540d411e32c3cc7ced3017742188d144
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Nov 20 13:07:37 2022 +0000

    Minor refactor: escape_hazard()

    Remove development code. Improve text.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-20 13:37:47 +00:00
Richard T Bonhomme 43d7648168 Option --subca-len - Allow value to be 0 (zero)
Squashed commit of the following:

commit 3a5e7539db93b88a9db8b2fb9fc6520870f337ac
Merge: 1a46e32 3d9fa5e
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Nov 20 13:31:57 2022 +0000

    Merge branch 'path-len-zero' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-path-len-zero

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

commit 3d9fa5e955f0ed517c63bb8c35e6fde180af8b6a
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Nov 20 00:30:59 2022 +0000

    Option --subca-len - Allow value to be 0 (zero)

    For an intermediate CA certificate, Path length of zero (0) is valid.
    Therefore, allow the character '0' as a valid numeric input for EasyRSA
    option --subca-len=<N>

    This method allows character zero (0) ONLY, as a numeric input
    for options which accept zero as a value.

    Add comment: # Reset per pass flags

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-20 13:32:49 +00:00
Richard T Bonhomme 1a46e32454 Expand check for --keep-tmp value to an existing file of any type
Squashed commit of the following:

commit aecf6e63780d9aec8b31b61aff0704f45c9598c9
Merge: 85db316 244c059
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Nov 20 13:28:12 2022 +0000

    Merge branch 'improve-keep-tmp' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-keep-tmp

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

commit 244c05968e76d1fa7673202e1623cb252083bc66
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 17 02:13:40 2022 +0000

    Expand check for --keep-tmp value to an existing file of any type

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-20 13:29:16 +00:00
Richard T Bonhomme 824849bce7 Merge branch 'fix-set_pass' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-fix-set_pass
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-13 17:19:41 +00:00
Richard T Bonhomme 1aae9b36fd set_pass_legacy(): Remove $no_password "-nodes"
Closes: #765

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-11 18:37:47 +00:00
Richard T Bonhomme d0019deb25 Current 'set-X-pass' commands do not support Edwards Curve cryptography.
Replace all 'set-X-pass' commands with single 'set-pass' command.

The new EasyRSA 'set-pass' command uses OpenSSL command 'pkey' to manipulate
private keys.  OpenSSL 'pkey' command supports all EasyRSA cryptography.

Retain compatibility with old commands.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-10 23:31:15 +00:00
Richard T Bonhomme 00e93d0abd Require unique random serial number for certificate or fail
Squashed commit of the following:

commit 7bdc3cdfbf4ac11dc5ff6377b1b32306fc50bc66
Merge: 320a324 7fa4ec9
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 10 19:41:31 2022 +0000

    Merge branch 'fix-random-cert-serial' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-fix-random-cert-serial

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

commit 7fa4ec9e3155f8b54648226397ef73f9086779d1
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 10 19:27:37 2022 +0000

    Require unique random serial number for certificate or fail

    This only effects Random certificate serial numbers: EASYRSA_RAND_SN
    (EASYRSA_RAND_SN is the Easy-RSA default mode)

    Previously, no matter if a _unique_ random serial number was generated,
    sign_req() would always use the last random number generated, as serial
    number for the new certificate.

    This behaviour also allowed _complete failure_ of the SSL serial number
    check to pass without error.

    This change allows signing a request to succeed ONLY when a unique serial
    number has been generated and validated.

    A failure of the SSL CA unique serial number check will NOT be ignored.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-10 20:41:55 +00:00
Richard T Bonhomme 320a324965 New function: easyrsa-random() - Generate random hexadecimal data
Squashed commit of the following:

commit cb68324306febcddf7ef03fe56fc1eddf06e7db7
Merge: 82483f1 2199d0c
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Nov 9 21:19:41 2022 +0000

    Merge branch 'f-easyrsa_random' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-f-easyrsa_random

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

commit 2199d0c323e506df436a335375be9115a12d6b7f
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Nov 9 21:05:17 2022 +0000

    Minor improvements to temp-session and temp-file

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

commit aa15b74722632ecab14c07ba9f2158d121e55d4f
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Nov 9 20:35:43 2022 +0000

    New function: easyrsa-random() - Generate random hexadecimal data

    Replace the various random requirements with this new function.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-09 21:21:05 +00:00
Richard T Bonhomme 82483f103e Improve detect_host() and show_host()
Squashed commit of the following:

commit 5d48d39891b8ecd8c34f6faef1de06d327ed2b18
Merge: c905f09 2cfc18c
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 3 21:56:48 2022 +0000

    Merge branch 'restrain-detect_host' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-restrain-detect_host

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

commit 2cfc18c46bb23d1a2e88502ee76faf373f848155
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 3 21:15:09 2022 +0000

    Improve detect_host() and show_host()

    These changes make reductions to:
    - The effects of detect_host()
    - The output of show_host()

    detect_host:
    - Does not set an SSL library.
    - Is not essential, so can be run before all other essential code.

    show_host:
    - Only show extended details for -v 'verbose' output.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-03 21:59:56 +00:00
Richard T Bonhomme c905f0929a Introduce global option '--nopass|--no-pass'
Squashed commit of the following:

commit 3bff869d3058b2d8d2e21b572dfed6bac773ffe8
Merge: dbb8517 1652f20
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 3 19:55:34 2022 +0000

    Merge branch 'new-global-opt-nopass' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-new-global-opt-nopass

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

commit 1652f20e88ae72e731d8e6001d561d10aebdb780
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Nov 2 17:46:54 2022 +0000

    Introduce global option '--nopass|--no-pass' (#752)

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

commit 7817324cbb31baf922724e46d5a50947b0b649d6
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Nov 2 17:29:41 2022 +0000

    Introduce global option '--nopass|--no-pass'

    This change forces all commands where passwords are not desired,
    to internally rely on the specific EasyRSA variable 'EASYRSA_NO_PASS'.

    Current use of 'nopass' as a command option, is unchanged.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-03 19:56:34 +00:00
Richard T Bonhomme dbb851736a print_version(): Redirect stderr for "openssl" call
Squashed commit of the following:

commit 6ed16cd3860a1cf155c48809d11b55101ff66224
Merge: 4472516 94f6402
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Tue Nov 1 22:51:33 2022 +0000

    Merge branch 'redir-stderr-version' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-redir-stderr-version

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

commit 94f6402c64b9d11da34c93d06b62a00b2ad2fe40
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Tue Nov 1 20:51:26 2022 +0000

    print_version(): Redirect stderr for "openssl" call

    This redirects stderr message generated by missing config file,
    specifically for LibreSSL.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-11-01 22:52:48 +00:00
Richard T Bonhomme 4472516e24 Reset option flag check 'number_only' per option
Squashed commit of the following:

commit 4aada5ffcd8cff893618bbbfe24f589f33665352
Merge: 439cdc1 6f8ba1e
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Mon Oct 31 00:31:56 2022 +0000

    Merge branch 'bugfix-number-only' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-bugfix-number-only

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

commit 6f8ba1e608d5223efa9dd296ed2c61418da991aa
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Oct 30 23:56:46 2022 +0000

    Reset option flag check 'number_only' per option

    Closes: #747

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-31 00:34:42 +00:00
Richard T Bonhomme 19b468c8f8 Minor style change
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-30 23:16:38 +00:00
Richard T Bonhomme b6b909bbab Introduce global option '--notext|--no-text'
Global option '--notext|--no-text':
Disable the output of human readable text into certificate files,
when signing a request file.

Closes: #624

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-30 19:31:24 +00:00
Richard T Bonhomme 47e8eaa1b0 For 'init-pki hard' only, always try to create a new pki/vars file
This simplifies the code for 'init-pki soft', which deliberately saves
the 'pki/vars' file.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-28 00:05:10 +01:00
Richard T Bonhomme 7eea5f35a5 Remove function find_x509_types_dir()
Move the function purpose back to function install_data_to_pki().

This means that there is only one list of sources to maintain.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-27 22:54:25 +01:00
Richard T Bonhomme c379603cfd find_x509_types_dir(): Remove excess checks
Remove check for '$EASYRSA_PKI' folder 'x509-types',
because it is the first element on the subsequent 'for' list.

Remove check for hard coded 'pki' folder 'x509-types',
because it will over-ride option '--pki-dir=<DIR>'.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-27 03:08:43 +01:00
Richard T Bonhomme ada7bb41f6 Command 'renew': Remove option 'nopass'
Command 'renew' no longer builds new keys, therefore, the option 'nopass'
is not required.

Closes: #740

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-26 23:22:16 +01:00
Richard T Bonhomme db33add56a Command 'help': For unknown command, exit with error.
Added ChangeLog notice.

Squashed commit of the following:

commit de8f9e689e6409b606f112067754c28e3eef1d1d
Merge: ab7c480 0753241
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Oct 26 21:45:29 2022 +0100

    Merge branch 'help-err-exit' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-help-err-exit

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

commit 0753241b0c45311475822d05ce492ef925423dad
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Tue Oct 25 21:52:49 2022 +0100

    Command 'help': For unknown command, exit with error.

    Closes: #736

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-26 21:48:45 +01:00
Richard T Bonhomme ab7c4804fb Minor refactor of secure_session() and easyrsa_mktemp()
Squashed commit of the following:

commit b93c8e60649d835b66fc4ab2c1d6050e6b1ca231
Merge: 17cbf07 130c161
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Oct 26 21:08:00 2022 +0100

    Merge branch 'easyrsa-mktemp' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-easyrsa-mktemp

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

commit 130c161746d8e7885c7c3a86b8d29d28476b3890
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Wed Oct 26 20:00:56 2022 +0100

    Minor refactor of secure_session() and easyrsa_mktemp()

    Return without error on successful completion of final command.

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-26 21:08:54 +01:00
Richard T Bonhomme 368de14fc1 vars.example: Remove EASYRSA_REQ_CN and EASYRSA_TEMP_FILE
Squashed commit of the following:

commit c27825c3bc5dddaeb3749d7a315a77239146ad22
Merge: 02f13f6 93da550
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Tue Oct 25 20:50:44 2022 +0100

    Merge branch 'vars-remove-req-cn' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-vars-remove-req-cn

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

commit 93da55003cee29695616d01243aecddcf7954c25
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Fri Oct 21 21:10:08 2022 +0100

    vars.example: Minor corrections and formatting

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

commit 9976f3f0d13a73827052f490438b95153a1b7576
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Fri Oct 21 20:57:07 2022 +0100

    vars.example: Remove EASYRSA_TEMP_FILE

    Closes: #729

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

commit 8a35375f84ab88b6f009e5971ddb7358f6619a03
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Fri Oct 21 20:44:53 2022 +0100

    vars.example: Remove EASYRSA_REQ_CN

    Closes: #730

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-25 20:51:51 +01:00
Richard T Bonhomme 02f13f6064 Find data-files in the correct order (#727)
Squashed commit of the following:

commit 136484f3ed28d57bf4244d9c716b8daa1cd9a8a7
Merge: 2083fb2 cae6357
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Tue Oct 18 19:44:17 2022 +0100

    Merge branch 'fix-order-725' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-fix-order-725

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

commit cae6357c63b473e33e31620264bef4ede596ffac
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Oct 16 22:52:44 2022 +0100

    Find data-files in the correct order

    With this change the PKI becomes the 'preferred' location for data-files.

    All other supported locations are searched by specific order.

    While this new order is the correct 'preferred' order, the associated code
    install_data_to_pki() needs to be simplified.

    Closes: #725
    Closes: #723

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-18 19:44:56 +01:00
Richard T Bonhomme 72cfbd2cd0 Refactor option parser: Use $number_only to verify $val is numeric
Compress repeated numeric checks.
Reformat case statement.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-12 23:56:05 +01:00
Richard T Bonhomme 95af4f0a30 Documentation updates (No functional changes)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-12 23:47:11 +01:00
Richard T Bonhomme b7199ec19a init-pki soft: Include delete of revoked and renewed sub-directories
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-08 20:58:22 +01:00
Richard T Bonhomme 586f237897 Squashed commit of the following:
commit 5aa65657e2fdda455a8549ed4f4e60cad6cf2389
Author: Matthias Andree <matthias.andree@gmx.de>
Date:   Sun Oct 2 20:44:08 2022 +0200

    Use POSIX [[:space:]] instead of \s for sed(1).

    2nd half of fix for #714.

    Obtained from:	topical@gmx.net
    URL:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266726

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-03 19:30:39 +01:00
Richard T Bonhomme 0d03a6f657 Remove obsolete command 'renewable'
All valid certificates are renewable.

Closes: #714

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-10-02 17:56:39 +01:00
Richard T Bonhomme 70958e0f88 Merge branch 'doc-x509-types' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-doc-x509-types
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-28 16:45:36 +01:00
Richard T Bonhomme 10485ab70d Merge branch 'update-ns-support' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-update-ns-support
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-28 16:37:50 +01:00
Richard T Bonhomme f4cb94ade6 Merge branch 'fix-subca-len' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-fix-subca-len
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-27 20:51:37 +01:00
Richard T Bonhomme 92f90fcd18 Option --keep-tmp: Reliability improvements
Do not allow a known PKI folder <NAME> as --keep-tmp=<NAME>

Remove unnecessary random number extension.

Move all snapshots to sub-directory: $EASYRSA_TEMP_DIR/tmp/<NAME>

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-26 21:45:16 +01:00
Richard T Bonhomme bcd1376aa2 Option --keep-tmp: Append EASYRSA_TEMP_DIR_session random number
Append the random 32bit number generated for temporary session directory
to the '--keep-tmp=NAME' directory NAME specified by the user.

This avoids obliterating a private keys directory.

Example:
With default settings, '--keep-tmp=private' will delete "$PKI/private".

This will now destroy any directory with the name:
* "$temp_dir/$NAME.$rand"

Closes: #707

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-26 19:21:46 +01:00
Richard T Bonhomme df80f52e28 Refactor Netscape support
Do not require '--ns-cert=yes' (or no):
If '--ns-cert' is specified then Netscape support is being requested.
However, '--ns-cert=no' (or yes) will still work as expected.
if '--ns-cert' is used then '--ns-cert=yes' is the new default.

Remove 'awk_yesno()': Unnecessary complexity.

Reword 'help': The behavior is simplified and so is the help.

Closes: #698
Closes: #709

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-26 18:16:21 +01:00
Richard T Bonhomme 96b3d38847 Move show_host() to cleanup() and move detect_host() after options
Move show_host() to cleanup() and only call it when die() was called.
This allows for confirm() Aborted to exit without extended error data.

Move detect_host after options processing. Allows for use of options.
eg: --verbose

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-25 21:09:24 +01:00
Richard T Bonhomme 14ebbe2bf6 Use correct input file x509-types/ca
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-25 20:47:21 +01:00
Richard T Bonhomme 44d69ca2fe typ0: Replace single TAB with SPACE
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-24 18:05:16 +01:00
Richard T Bonhomme 4f9e32fc7c Opt. --subca-len: basicConstraints CA extension, Append 'pathlen:N'
When signing a request for an intermediate CA using --subca-len=N:

For a Sub-CA, the current method to apply 'pathlen:N' to CA basicConstraints
over-writes all user set basicConstraints.

Replace that with an awk script which reads the current x509-types/ca file;
selects the last occurence of 'basicConstraints' (As does OpenSSL) and then
prints that line, with ", pathlen:$EASYRSA_SUBCA_LEN" appended, into the
temporary x509-types/ca file.

If no CA basicConstraint is found then exit with an error. Reason:

Easy-RSA default CA basicConstrain will always be defined. If that is changed
by the user, who then attempts to use Easy-RSA to append 'pathlen' then that
is an error. Easy-RSA must not insert a default when the default has been
deliberately removed.

Closes: #691 - Original bug report.
Closes: #692 - First use of awk as a solution. [Credit]

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-24 15:37:37 +01:00
Richard T Bonhomme 5978a211bf build_full: Remove sign_req() subshell and do full cleanup
build-x-full uses a subshell to detect errors and cleanup the files
if an error occurs.  This does not work if Ctrl-C is pressed during
the confirmation yes/no dialog.

Replace the subshell with an indicator, $on_error_build_full_cleanup,
to force cleanup() to remove the CSR, key and certificate files when
an error occurs or user presses Ctrl-C.

Closes: #680

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-23 13:58:45 +01:00
Richard T Bonhomme 1599714db4 help: Document supported certificate X509 types
Closes: #630

Note: 'kdc' is not a supported X509 type #673

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-22 18:17:05 +01:00
Richard T Bonhomme 8e3f928fff Merge branch 'status-old-renew' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-status-old-renew
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-21 21:38:20 +01:00
Richard T Bonhomme b6748d9fdc Merge branch 'ca-x509-types-files' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-ca-x509-types-files
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-21 21:36:03 +01:00
Richard T Bonhomme 1582656254 Merge branch 'add-rebuild' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-add-rebuild
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-21 21:33:16 +01:00
Richard T Bonhomme 0f7c74d1ca Status Report 'show-renew': Include renewed certs from /cert_by_serial
Expand 'show-renew' to include certs which have been renewed the old way.
These are stored in 'renewed/certs_by_serial' and require 'rewind-renew'
before they can be revoked.

Also, introduce option '-v|--verbose' to make all status reports (only)
more verbose.

In this particular use case, verbose message detail expected serialNumber
mismatches, which can then be verified.  The previous code returned with
out an error, even though the test suggests that an error had occurred.

This verbosity for reports helps to verify that the report is correct.

Manually tested on a PKI with a mix of v1/v2 style renews.

Closese: 699

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-21 20:35:24 +01:00
Richard T Bonhomme 748c19be21 build-ca: Check x509-types 'ca' and 'COMMON' files exist
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-20 22:05:53 +01:00
Richard T Bonhomme 0f50f5c788 Error messages: Minor text-only improvements
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-09-19 13:33:06 +01:00