1204 Commits

Author SHA1 Message Date
Richard T Bonhomme
b71bfb478c
Options: Expand alias '--days' to all suitable options with a period
Option alias '--days=NUMBER' can now be used for all other options which
indicate a validity period.

* Option: --days

This global option is an alias for one of the following:
* Expiry days for a new CA.
  eg: '--days=3650 build-ca'
* Expiry days for new/renewed certificate.
  eg: '--days=1095 renew server'
* Expiry days for certificate revokation list.
  eg: '--days=180 gen-crl'
* Cutoff days for commands: show-expire or renewable.
  eg: '--days=90 show-expire'"

The alias '--days' is now ONLY applied to the variable which requires it.
eg: If building a certificate then the appropriate variable for that type
is set. The other possible uses are not set by the same use.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-31 20:56:35 +01:00
Richard T Bonhomme
ace0a733a5
Merge branch 'ashutoshojha5-patch-1'
Closes: #671

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-30 20:04:20 +01:00
Richard T Bonhomme
a1790c44ba
Merge branch 'patch-1' of ssh://github.com/ashutoshojha5/easy-rsa into ashutoshojha5-patch-1
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-30 20:03:12 +01:00
Ashutosh Ojha
b877210a48
fixed typo
Signed-off-by: Ashutosh Ojha <ashutoshojha5@gmail.com>
2022-08-30 19:04:49 +05:30
Richard T Bonhomme
b1cc53fbcb
Merge branch 'TinCanTech-fix-locate-x509-types'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 02:09:50 +01:00
Richard T Bonhomme
02004074b4
Merge branch 'fix-locate-x509-types' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-fix-locate-x509-types
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 02:08:48 +01:00
Richard T Bonhomme
bb81dc5bb4
x509-types: Reset non-existent x509-types dir set by vars
Closes: #654

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 01:42:01 +01:00
Richard T Bonhomme
75f633a315
Merge branch 'TinCanTech-locate-x509-types'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 01:12:43 +01:00
Richard T Bonhomme
5da1f8e0cb
Merge branch 'locate-x509-types' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-locate-x509-types
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 01:11:03 +01:00
Richard T Bonhomme
47547efefc
vars_setup: Correctly locate x509-types for usage() directory STATUS
Locate existing x509-types directory, after sourcing vars.
If vars is set incorrectly then this WILL over-ride vars.

Closes: #654

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-29 01:00:19 +01:00
Richard T Bonhomme
7bf1a262be
Merge branch 'TinCanTech-status-x509-types'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-28 16:57:21 +01:00
Richard T Bonhomme
1254ca5e47
Merge branch 'status-x509-types' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-status-x509-types
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-28 16:56:30 +01:00
Richard T Bonhomme
df37955f4a
build-ca: Assign default sub-CA commonName and enable SSL interactive
Squashed commit of the following:

commit 5e9609873a01dd358e3a4c6928fc553e5257d8ea
Merge: ed54b1a 42bfae4
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sun Aug 28 14:44:13 2022 +0100

    Merge branch 'subca-default-cn' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-subca-default-cn

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

commit 42bfae4673996307107964be0fc8b15883072d31
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Sat Aug 27 13:20:41 2022 +0100

    build-ca: Assign default sub-CA commonName and enable SSL interactive

    When building a CA/SubCA, if a commonName has not been assigned by --req-cn
    then assign a default commonName, of either:
    * 'Easy-RSA CA' or 'Easy-RSA Sub-CA'.

    If a default commonName has been assigned then use SSL interactive mode
    to edit/confirm each of the subject fields individually. Otherwise, use
    EasyRSA to confirm all of the subject fields with a single prompt.

    Closes: #659

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

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-28 16:36:28 +01:00
Richard T Bonhomme
1c9ff967fb
x509-types: Add x509-types location to usage() STATUS
Make find_x509_types_dir() a stand alone function.

When calling usage(), find_x509_types_dir() can be a soft fail.
When x509-types directory is required, this function is a hard fail.

This also simplifies install_data_to_pki(), because x509-types do not
need to be installed in the PKI.

Closes: #654

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-27 17:17:51 +01:00
Richard T Bonhomme
ed54b1abd0
Merge branch 'TinCanTech-rescind-deprecate-req-cn'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-26 19:53:14 +01:00
Richard T Bonhomme
27e9103662
Merge branch 'rescind-deprecate-req-cn' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-rescind-deprecate-req-cn
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-26 19:52:29 +01:00
Richard T Bonhomme
68efe90eaa
Options: Rescind deprecation notice of option --req-cn
Note: --req-cn can only be used when building a CA/subCA.
When building All other certificates --req-cn is not honoured.

Reported-in: #659

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-26 18:54:45 +01:00
Richard T Bonhomme
d2703dcfac
Merge branch 'TinCanTech-silent-add-dash-s'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 20:19:39 +01:00
Richard T Bonhomme
f292c31b13
Merge branch 'silent-add-dash-s' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-silent-add-dash-s
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 20:18:44 +01:00
Richard T Bonhomme
f5bd5f9d0d
Options: Add '-s' to also enabe --silent mode.
Plus a small tidy up.

Closes: #653

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 20:14:18 +01:00
Richard T Bonhomme
d86cb5662f
Merge branch 'TinCanTech-improve-host-out'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 16:24:56 +01:00
Richard T Bonhomme
346c8d39ef
Merge branch 'improve-host-out' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-host-out
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 16:24:06 +01:00
Richard T Bonhomme
5890b692cd
detect_host: Use SSL Library version from EasyRSA version
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 16:19:31 +01:00
Richard T Bonhomme
a123d05fa9
Merge branch 'TinCanTech-improve-vars-handling'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 13:24:07 +01:00
Richard T Bonhomme
d08939e865
Merge branch 'improve-vars-handling' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-vars-handling
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-24 13:23:19 +01:00
Richard T Bonhomme
69afb5960e
Overhaul vars detection
Processing vars at init-pki was intentionally kept to minimum, due to
complications with user expectations verses Easy-RSA preferences.

This overhaul aims to finalise Easy-RSA interference with vars.

1. Prefer that vars is in the PKI but only force that at init-pki,
when no other vars files can be found. Otherwise, do not create a
template vars and leave it to the user, with appropriate messages.

2. Fail all commands, except init-pki, if more than one vars exists.

3. Take special care of 'init-pki soft'.

4. For existing PKIs, be aware that vars may NOT exist.

This patch is less complicated than it appears to be.
Most of the changes are either comments or user messages.
There are some new state flags to manage the location of vars,
which are used to decide when a new vars is created and control
user messages.

Closes: #651

New message for "Using x509-types directory: $EASYRSA_EXT_DIR"
Closes: #654

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-23 22:10:03 +01:00
Richard T Bonhomme
f13bf5eb76
Merge branch 'TinCanTech-cleanup-cleanup'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-22 23:00:41 +01:00
Richard T Bonhomme
edb46ca199
Merge branch 'cleanup-cleanup' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-cleanup-cleanup
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-22 22:59:01 +01:00
Richard T Bonhomme
e24bf0a72e
cleanup: Make "clean line" respect silent, batch and quiet modes
Improve two comments and information() output

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-22 22:37:27 +01:00
Richard T Bonhomme
c63682fef3
Merge branch 'TinCanTech-enfore-x509-COMMON'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 23:01:51 +01:00
Richard T Bonhomme
ca761167d1
Merge branch 'enfore-x509-COMMON' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-enfore-x509-COMMON
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 23:00:46 +01:00
Richard T Bonhomme
c1991b24fc
Merge branch 'TinCanTech-update-unsup-chars'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 22:58:32 +01:00
Richard T Bonhomme
d1cabcad2a
Merge branch 'update-unsup-chars' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-update-unsup-chars
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 22:56:41 +01:00
Richard T Bonhomme
7dc62b1499
Merge branch 'TinCanTech-options-number-check'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 22:49:02 +01:00
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
805f3b73dc
sign-req: Enforce X509-type files exist and are used. (#581)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-21 00:44:35 +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
8a0702329c
Unsupported characters: Correct check and warning message
Since the introduction of 'escape_hazard()' function, all characters
except (`) backtick are supported.

This patch brings vars.example in line with the warning in easyrsa and
also only warns about backtick.

It is possible that curly brace '{}' may also cause OpenSSL to behave
strangely. However, the strange behaviour, which I previously observed,
may have been rectified by OpenSSL.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-08-20 17:33:39 +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 f4a604438d3ce5fe67a1f4db956dc42fc4ae5588, 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