1086 Commits

Author SHA1 Message Date
Richard T Bonhomme
9fd6fe4cf0
Merge branch 'TinCanTech-verbose-revoke-renew'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-22 15:03:22 +01:00
Richard T Bonhomme
f52b866ebd
Improve revocation and renewal functions
Changes:
* Improve help
* Move renew_restore_move() out of die() and back to renewal block.
* Minor corrections to user output.
* Add detailed description of which files will be moved/removed.
* Simplify check/create revoked/renewed directory structures.
* Only die on failure to move certificate, otherwise warn only.
  Some files may not be present. eg. PKCS files, already removed.

Manually tested.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-22 13:58:38 +01:00
Richard T Bonhomme
325fdd8cb2
Merge branch 'TinCanTech-upgrade-renew'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-22 11:11:56 +01:00
Richard T Bonhomme
1fea2b5f5b
Merge branch 'upgrade-renew' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-upgrade-renew
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-22 10:53:43 +01:00
Richard T Bonhomme
1514c032ce
Trivial typo fix (NFC)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-21 22:34:25 +01:00
Richard T Bonhomme
c5a2e339a7
Reformat help
Having used help extensively, this reformats help for readability.
Both 'user output' and 'code style' _appear_ to be improved.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-21 20:51:13 +01:00
Richard T Bonhomme
305a19ea74
Minor corrections
Use move not copy (copy was used in development).

Corrections to help and error messages.

Re-arrange "hand-off" 'case'; group renew functions together.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-21 13:40:28 +01:00
Richard T Bonhomme
303c076438
Introduce 'rewind-renew' (#579)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-21 13:31:37 +01:00
Richard T Bonhomme
d5f6f69de2
Introduce 'rewind-renew' - Recover "guineapig" renewed certificates
The original version of EasyRSA command 'renew', leaves the certificate
without a method to be revoked.

This is due to 'renew' moving files OUT of the PKI, which means they cannot
be targeted by command 'revoke'.

Additionally, 'renew' renames the files to an unfriendly serial-number.

--

Command 'rewind-renew' restores the original commonName as file-name-base.
And moves these files to renewed folders which are targeted by 'revoke-renewed'.

Closes: #578 (Thoroughly tested)

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-21 00:50:16 +01:00
Richard T Bonhomme
c99e708e88
Re-enable certificate random serial numbers by default
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-20 20:32:01 +01:00
Richard T Bonhomme
aa95552615
Update Openssl binary hash
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-20 12:31:07 +01:00
Richard T Bonhomme
1d227736e4
Minor improvements and enforce some standards
Command '[' uses '-n' by default:
* Never use '[ -n "$example" ]'
* Always use '[ "$example" ]'
This improves readabiity.

Use only '-e' to test for file existence.

Try to use simple tests, not 'not not X' (double negative) tests.
Example:
* [ "$EASYRSA_RAND_SERIAL != "no" ] = Replace with ' = "yes" '

Use 'shift' cleanly, immediately after assignment.

Improve/correct comments and user messages.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-20 11:28:29 +01:00
Richard T Bonhomme
deffb7e44f
Add 'pki_is_required', compliment of 'no_pki_required'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-20 09:40:25 +01:00
Richard T Bonhomme
322168bca6
Add final untrapped error check
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-20 00:54:39 +01:00
Richard T Bonhomme
cb869ee269
Merge branch 'TinCanTech-single-cert-status'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 21:38:10 +01:00
Richard T Bonhomme
73d521bd34
Update #577
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 21:21:32 +01:00
Richard T Bonhomme
57998c2825
Expand status reports to include checking a single certificate
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 21:14:01 +01:00
Richard T Bonhomme
968ff0599b
Use 'user_vars_true' flag to indicate use of '--vars=FILE'
Use the flag as intended.

Also, improvements to layout and comments, in nearby functions.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 13:58:03 +01:00
Richard T Bonhomme
969b1b0fd6
Merge branch 'TinCanTech-new-output'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 12:58:58 +01:00
Eric F Crist
1600b3fe9b
update ChangeLog for 3.1.0 release
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-05-18 20:52:31 -05:00
Eric Crist
92d8491160
Merge pull request #575 from OpenVPN/release/3.0
update python call, remove test pki on build
2022-05-18 20:47:27 -05:00
Richard T Bonhomme
1d1b7177d6
Standardise all output for warn(), notice() and message():[New]
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-19 01:57:14 +01:00
Richard T Bonhomme
cf32d9f485
Add recovery mechanism for certificate renewal failures
Closes: #572

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-18 22:05:47 +01:00
Richard T Bonhomme
4d5ff71ba3
Move cert_dates() to after revoke/renew/revoke-renewed code blocks
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-18 18:02:10 +01:00
Eric F Crist
2dcbb64058
update python call, remove test pki on build
Helps with preventing #571 again by removing the test pki that may
exist.  The build script now removes it if present.

Update the python call the python3 so it works on macOS like in master.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-05-18 08:08:25 -05:00
Richard T Bonhomme
81c47847f6
Update ChangeLog for Easy-RSA version 3.1.0
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-18 13:47:56 +01:00
Eric Crist
f18d08e1b4
Merge pull request #570 from OpenVPN/release/3.0
update ChangeLog for v3.0.9 final release
2022-05-17 21:35:01 -05:00
Eric F Crist
150e96ec9b
update ChangeLog for v3.0.9 final release
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-05-17 21:25:46 -05:00
Richard T Bonhomme
2c26358ac8 Correct input date coming from status_expire() fed to cert_dates()
The input data, when a certificate is not found, was an unpunctuated
numerical representation of date. eg: '220613123456'.

Format this input to: '22-06-13 12:34:56' for use.

Also, disambiguate between certificate-data verses database-data
by renaming the database variables from 'crt_foo' to 'db_foo'.

Also, disambiguate between full-date verses epoch-date-seconds
by renaming epoch-date-seconds variables from 'foo' to 'foo_s'.

Also, improvements to status reports output format.

Also, improve related comments.

Closes: #568

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-18 02:07:41 +01:00
Richard T Bonhomme
4579d70881
Consolidate verification of EASYRSA_ALGO and PARAMS
New function: verify_algo_params()
Verify algorithm and parameters in a single function.

Remove verify_curve_ec() and verify_curve_ed()

Place verify_algo_params() at the end of vars_setup().

No longer use a dedicated directory for Elliptic curve
parameters file.  Instead, use an easyrsa-temp file.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-16 22:59:21 +01:00
Richard T Bonhomme
55f5745786
Minor improvement to secure_session() and easyrsa_mktemp()
Also, remove obsolete comment.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-16 21:30:48 +01:00
Richard T Bonhomme
26b7247f70
Correct logic for detecting 'vars'
Flags are set when a 'vars' file is found:
eg. [ -e "$pki_vars" ] && e_pki_vars=1

Use flag '$e_pki_vars' not the target file variable '$pki_vars' for
subsequent code decisions.  Unset '$pki_vars', once it us used.

The same goes for: '$prog_vars', '$pwd_vars' and '$easy_vars'.

Closes: #567

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-16 21:09:43 +01:00
Richard T Bonhomme
bd3a3b041c
Add final check for 'vars'; MUST exist or die
This check ensures the a valid command does not sneak a missing but
expected 'vars' file through 'vars' detection phase.

Move detect_host() and expand the comment.

Minor reformatting, for readability.

Improve/update comments.

Stage-3-of: #566

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-15 19:03:00 +01:00
Richard T Bonhomme
5c3f4403a2
Prohibit use of: '--vars=FILE init-pki'; Prefer '--pki-dir=DIR'
Undo changes made by 4922cae2637ff1d6247840a800f3c691aa7eb7ab
which allowed '--vars=FILE init-pki'.

Keep the changes to user output which suppress messages to "use PKI/vars".

Stage-2-of: #566

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-14 22:53:12 +01:00
Richard T Bonhomme
4257ced3de
Deprecate use of: '--vars=FILE init-pki'; Prefer '--pki-dir=DIR'
Stage-1-of: #566

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-14 21:56:44 +01:00
Richard T Bonhomme
969804c530
Expand macOS unit test to include Edwards curve, if appropriate
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-14 02:08:42 +01:00
Richard T Bonhomme
3e218efda3
Allow multiple 'SAN: IP Address' entries
Closes: #564

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 23:56:56 +01:00
Richard T Bonhomme
ad804cdd65
Use full '--passin'/'--passout' unit tests
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 23:25:40 +01:00
Richard T Bonhomme
d652a55088
Correct a syntax error (shellcheck)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 23:05:25 +01:00
Richard T Bonhomme
4922cae263
Allow user '--vars=file' to bypass setup checks for 'vars' file
Using option '--vars=file' now sets variable 'user_vars_true'.
When 'user_vars_true' then do not create a conflicting PKI/vars.
Also, remove vars-file warnings when 'user_vars_true'.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 22:57:03 +01:00
Richard T Bonhomme
3e6478aae4
Add cmd-opt 'batch' to verify_cert() - Allows returning deliberate error
This allows verify_cert() to show the status and, optionally, return an
error (1) on "failure to verify" to a calling program.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 22:46:51 +01:00
Richard T Bonhomme
8c05298f62
Add option '-p' to test '--passin' and '--passout'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-13 14:14:58 +01:00
Richard T Bonhomme
e7a5d321e4
Exit with an error, if there was an error..
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-11 20:58:36 +01:00
Richard T Bonhomme
a94ae1a537
Minor improvement to locating 'vars' file
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-11 16:50:53 +01:00
Richard T Bonhomme
20d2bedaed
Merge branch 'AndersBlomdell-master'
Interesting awk code archived.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-10 09:58:21 +01:00
Richard T Bonhomme
93bf14f223 Merge branch 'master' of ssh://github.com/AndersBlomdell/easy-rsa into AndersBlomdell-master 2022-05-10 09:57:07 +01:00
Richard T Bonhomme
3e6f297a37
Merge branch 'TinCanTech-status-reports'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-10 09:53:38 +01:00
Richard T Bonhomme
7743b32a7d Merge branch 'status-reports' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-status-reports 2022-05-10 09:47:46 +01:00
Richard T Bonhomme
d7494fb73e
Merge branch 'nkakouros-init-vars'
Minor changes to original comments.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-10 09:41:29 +01:00
Richard T Bonhomme
e3d08f776f Merge branch 'init-vars' of ssh://github.com/nkakouros/easy-rsa into nkakouros-init-vars 2022-05-10 09:33:03 +01:00