Commit Graph
1115 Commits
Author SHA1 Message Date
Richard T Bonhomme 38189be360 Introduce 'show-host' - Deep diagnostic
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-11 11:57:41 +01:00
Richard T Bonhomme a11ddefe5d Correct 'date' for Darwin/*BSD: "${days}days" -> "${days}d"
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-11 11:15:40 +01:00
Richard T Bonhomme 8b806163be Prioritise busybox 'date' in date functions and minor corrections
Where busybox is installed, use it even if a standard 'date' exists.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-11 10:59:26 +01:00
Richard T Bonhomme 9e3fe4791f Remove unnecessary subshell from 'date' evaluation
If this 'date' is MacPorts then it will fall throught to:

  * This *is* the bottom-line, "date-wise": Ubuntu or busybox.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-11 02:08:02 +01:00
Richard T Bonhomme 8c1ac0c800 Re-introduce "fixed date" certificates
Use command option '--fix-offset=nnn' [nnn: 1 - 365] day number,
to set the date at which the certificate will become Valid.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-10 22:43:40 +01:00
Richard T Bonhomme bf3c21273e Improve debugging control
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-10 22:32:23 +01:00
Richard T Bonhomme 15429df9fd Minor improvements: Debugging and sign_req()
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-10 21:36:14 +01:00
Richard T Bonhomme 53da18d96a Prioritise 'trap' and 'detect_host()' over all other processing
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-10 20:14:11 +01:00
Richard T Bonhomme 7aa52b75f4 Do not delete PKCS files when using revoke_renewed()
When revoking a renewed certificate, do not delete PKCS files,
because they do not belong to the old certificate which was renewed.

Update warnings to reflect this change.

Add revocation "reason" to confirmation dialogues.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-08 16:26:34 +01:00
Richard T Bonhomme 4078523e60 Merge branch 'TinCanTech-replace-cert_dates'
Additional: Windows 'date.exe' is also supported.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-08 15:19:24 +01:00
Richard T Bonhomme 3342df6650 Merge branch 'replace-cert_dates' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-replace-cert_dates
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-08 15:16:38 +01:00
Richard T Bonhomme 72b84c489d Merge branch 'TinCanTech-remove-renew-30day-grace'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-08 15:13:27 +01:00
Richard T Bonhomme 9fda11d04f Replace the original cert_dates() function with extensible wrappers.
The original cert_dates(); was intended to restrict certificate renewal
to a fixed 30-day-window of the certificate expiry date.  This was an
unnecessary restriction. Removed-by: #594

The original cert_dates(); "gave rise to" the Easy-RSA "ambition" to
support multiple versions of 'date' (*nix), which proved to be more
demanding than initially expected. The "new" code speaks for itself.

Currently supported versions of 'date', as of this pull request:
* Linux (Standard Ubuntu)
* FreeBSD
* MacOS and MacOS Ports
* busybox

New functions:

* cert_date_to_timestamp_s()
  Takes* an X509 certificate date, as output by SSL option '-startdate'
  or '-enddate' and creates a 'timestamp' in seconds since epoch.

* offset_days_to_cert_date() [Note: 'days' not 'date']
  Adds* the $offset number of days to the current date and creates an
  X509 "style" certificate date string.

* ff_date_to_cert_date()
  Takes* a fixed-format date and converts it into an X509 certificate
  "style" date string.

* ssl_cert_not_before_date()
  Dedicated function to return an X509 certificate '-startdate' by SSL.

* ssl_cert_not_after_date()
  Dedicated function to return an X509 certificate '-enddate' by SSL.

These functions serve to provide an extensible frame-work for Easy-RSA
to manage all 'date' requirements.

Extras:

Built in reports 'show-expire','show-revoke' and 'show-renew' all use
these functions to interrogate index.txt and the PKI, extensively.

Add error detection to Easy-RSA options which involve "number of days"
and fail for any input which is not a base-10 number. eg. --days=nn

Closes: #593

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-08 00:59:54 +01:00
Richard T Bonhomme 78f17179d6 Remove restrictive 30-day window hindering 'renew'
Ref: https://github.com/OpenVPN/easy-rsa/issues/593

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-06 14:55:43 +01:00
Richard T Bonhomme ab392617d4 Correct supplemental help text output
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-06 14:35:04 +01:00
Richard T Bonhomme 64828d2134 Merge branch 'TinCanTech-esc-org'
Additional: Insert forced quotes into SSL config file for ALL fields.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-03 17:00:55 +01:00
Richard T Bonhomme a022a5cb2a ChangeLog: Support ampersand and dollar-sign in vars file (#590)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-03 16:38:58 +01:00
Richard T Bonhomme 68fe46e451 Auto-escape '&' and '$' in 'org' mode fields - Other minor tweaks
Auto-escape '&' ampersand explanation:
'easyrsa' uses 'sed' to build a safe SSL config file, which means
that an unescaped '&' ampersand cannot be used in the 'vars' file.
This is due to 'sed' treating '&' as a special character.

Rather than expect users to know all this and use extended escaping,
to get around 'easyrsa' set_var(), use auto-escape. This allows use
of unescaped '&' in vars file. Like any other character.

Auto-escape '$' dollar-sign explanation:
Using '$' in the 'vars' file MUST be escaped. Escaping '$' to stop
expansion is common knowledge and the first thing a user will try.
Using an escaped '$' in the 'vars' file results in an unescaped '$'
being written to the SSL config file, which is then expanded by
OpenSSL or choked on by LibreSSL. Auto-escaping '$' fixes this.

Add SSL library name to die().

Allow verify_ssl_lib() to run ONLY once.

Improve comments.

Re-order the areas searched for data files to prioritise preferred
locations over old defaults.

Tested-with: OpenSSL and LibreSSL and on Windows and FreeBSD.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-03 13:19:28 +01:00
Richard T Bonhomme 678ab06a09 SSL version: Ignore error out, in case of missing SSL config file
Also, re-order 'sed' command; Move CN above DN=org fields. eg: Province etc.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-06-02 02:01:31 +01:00
Richard T Bonhomme c363e904c1 Ignore unit-test sand-box
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-30 18:58:03 +01:00
Richard T Bonhomme d5f349888a Auto escape: Unquote 'bad_char' in string disection (Win: mksh)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-28 00:26:03 +01:00
Richard T Bonhomme 83fa2ac23d Enable verbose unit test log for Linux
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-27 23:11:55 +01:00
Richard T Bonhomme 97f301ca39 Merge branch 'TinCanTech-esc-amp-quote-sed'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-27 22:52:10 +01:00
Richard T Bonhomme 656a2a240c Update 'unsupported character list'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-27 22:36:54 +01:00
Richard T Bonhomme 8930b9cfab Correctly quote 'sed' and auto-escape ampersand
Closes: #364
Closes: #582

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-27 22:11:35 +01:00
Richard T Bonhomme 0ca54ddd47 Add commnd 'make-safe-ssl' to make a safe SSL config on demand
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-27 20:50:43 +01:00
Richard T Bonhomme cfbfeaae53 Add EasyRSA version to error output
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-25 10:24:41 +01:00
Richard T Bonhomme 00675e79da Add standard user confirmation to 'rewind-renew'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-23 16:18:45 +01:00
Richard T Bonhomme 18c530a074 Enable dedicated 'help' test (Linux Only)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-05-22 17:16:49 +01:00
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