1738 Commits

Author SHA1 Message Date
Richard T Bonhomme
f05fdccd76
escape_hazard: Rename temp-file vars_org_tmp -> escape_hazard_tmp
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 03:21:41 +01:00
Richard T Bonhomme
d80040ba09
Integrate '$has_config' into expand_ssl_config() and escape_hazard()
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 03:02:26 +01:00
Richard T Bonhomme
f352b6f40f
Set run-once correctly, for expand_ssl_config() and escape_hazard()
Set run-once after if condition, otherwise Forced execution does not
set run-once.

Use "local" variable 'makesafeconf' to force a new safe ssl config.

Remove variable require_safe_ssl_conf, partially replaced by makesafeconf.

Add 'make-safe-ssl' command to the list which does not require a CA.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 23:56:44 +01:00
Richard T Bonhomme
22ff0eae39
Rename variable easyrsa_safe_ssl_conf -> safe_ssl_cnf_tmp
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 21:57:11 +01:00
Richard T Bonhomme
4bde4824b7
Rename function easyrsa_rewrite_ssl_config() -> expand_ssl_config()
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 21:51:37 +01:00
Richard T Bonhomme
352d0fa8bf
escape_hazard(): Rename temp-file easyrsa_vars_org -> vars_org_tmp
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 21:42:48 +01:00
Richard T Bonhomme
6edd8ce13c
easyrsa_openssl(): Refactor expand SSL conf and escaping hazard
easyrsa_openssl(): Move run-control to functions easyrsa_rewrite_ssl_config()
and escape_hazard().  Replaces complex control code in easyrsa_openssl().

Run-control supports:
* EASYRSA_FORCE_SAFE_SSL: --force-safe-ssl, ALWAYS run.
* EASYRSA_NO_SAFE_SSL: --no-safe-ssl, NEVER run.
* Run-once: Default, run-once only.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 21:22:12 +01:00
Richard T Bonhomme
6de6f927b0
Merge branch 'TinCanTech-iss978-fix-sign-req'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 17:13:11 +01:00
Richard T Bonhomme
00e7380ad2
Merge branch 'iss978-fix-sign-req' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-iss978-fix-sign-req
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 17:12:32 +01:00
Richard T Bonhomme
6e585eda19
build-ca: Use create_x509_type() correctly; Remove errant characters
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 13:56:20 +01:00
Richard T Bonhomme
6f806d9577
sign-req: Remove useless use of cat
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 03:01:39 +01:00
Richard T Bonhomme
a1c9b016b2
sign-req: Confirm Netscape extension use immediately
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 02:46:30 +01:00
Richard T Bonhomme
c03e1eef84
check_serial_unique(): Reduction
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 01:50:27 +01:00
Richard T Bonhomme
8ca55cfff0
sign-req: Unique serial, check input serial is hexadecimal only
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-16 00:27:56 +01:00
Richard T Bonhomme
a78babf835
sign-req: Use correct x509-type COMMON temp-file name
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-15 22:06:56 +01:00
Richard T Bonhomme
93a8980c5e
sign-req: Error check creation of x509-type temp-files
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-15 21:43:47 +01:00
Richard T Bonhomme
7039d02952
Add vars.example here-doc and move here-docs code to lower section
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-15 21:13:13 +01:00
Richard T Bonhomme
8cdfbb2ffe
Minor cleanup of Unique random serial number control
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-14 21:43:29 +01:00
Richard T Bonhomme
3789aff3f5
Unset initial variables: Remove 'user_san_true', no longer used
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-14 15:56:03 +01:00
Richard T Bonhomme
fdb8e0e8df
Add show-req to the list of commands which do not require a CA
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-14 13:53:37 +01:00
Richard T Bonhomme
e5f3551710
sign-req: Major refactor
Move extension data preparation to before printing extension temp-file.
This allows the { extensions output command group } to always complete,
without error.

Consolidate create_x509_type_*() functions in one single function.
create_x509_type_easyrsa() remains as a separate function.
This file does not exist in x509-types directory. It is similar to the
COMMON x509-type; The details are the common extensions shared by x509
types: serverClient, server and client. Not suitable for x509-type ca.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-14 13:51:18 +01:00
Richard T Bonhomme
1d9370c00e
Merge branch 'TinCanTech-expose-sign-req-serial-check'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-13 17:08:17 +01:00
Richard T Bonhomme
a0ea8ac5c1
Merge branch 'expose-sign-req-serial-check' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-expose-sign-req-serial-check
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-13 17:07:37 +01:00
Richard T Bonhomme
b0a3ec9caf
check_serial_unique(): In batch mode, exit-with-error for non-unique
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-13 16:41:16 +01:00
Richard T Bonhomme
ef3e64f0a1
ChangeLog: Expose serial-check, display-dn, display-san and default-san
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-13 14:26:03 +01:00
Richard T Bonhomme
aa38037570
Expose display_dn, display_san and default_server_san to command line
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-13 12:44:39 +01:00
Richard T Bonhomme
cdad3a7844
Expose 'sign-req' unique, random serial number check to command line
Problem:

EasyRSA uses SSL CA command parameter '-serial $serial_number',
to check if a serial-number exists within the database.

The primary function of the SSL CA command parameter '-serial'
is to check if a certificate is Valid or has been Revoked.

EasyRSA abuses the SSL output to infer that a serial-number must
be unique because that output contains the text 'not present in db'.

SSL CA command parameter '-serial' ALWAYS returns an error,
reagrdless of what-ever check it does. Likely, an SSL bug.

As a step-in-the-right direction:

To ease this needless-headache, expose the unique, random
serial-number check to the command line.

This helps to understand what is going on under-the-hood.

The command 'sign-req' remains the same; except the unique, random
serial-number check is moved to a separate, stand-alone function,
which is also exposed to the command line for validation.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-12 23:15:35 +01:00
Richard T Bonhomme
1ebf4a2f9c
Merge branch 'TinCanTech-minor-changes'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 19:42:10 +01:00
Richard T Bonhomme
febe0fd304
Merge branch 'minor-changes' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-minor-changes
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 19:41:19 +01:00
Richard T Bonhomme
3cb911ef2a
Very minor changes to comments, help/msg text, wrap lines, code
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 19:04:10 +01:00
Richard T Bonhomme
99809bc3bb
Merge branch 'TinCanTech-easyrsa-exit-with-error'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 16:24:18 +01:00
Richard T Bonhomme
28d4cae3a4
Merge branch 'easyrsa-exit-with-error' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-easyrsa-exit-with-error
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 16:23:42 +01:00
Richard T Bonhomme
b16596f9ec
cleanup: Rename $easyrsa_error_exit to $easyrsa_exit_with_error
This reduces a tiny, unnecessary complexity for exiting with an error.

Functions which use the new variable to exit with error:
* verify_cert() and confirm().

Also, allow verify-cert to support --silent-ssl.

Add more verbose messages.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-08 16:13:08 +01:00
Richard T Bonhomme
80ac745925
Merge branch 'TinCanTech-316-verify-ssl-lib'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-05 23:01:02 +01:00
Richard T Bonhomme
44e2696e46
Merge branch '316-verify-ssl-lib' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-316-verify-ssl-lib
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-05 23:00:32 +01:00
Richard T Bonhomme
91bb2cf8e9
verify_ssl_lib(): Minor style improvements
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-05 22:26:40 +01:00
Richard T Bonhomme
ac0d826272
Add command show-host to command list that does not require a PKI
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 22:59:39 +01:00
Richard T Bonhomme
268e8f59fd
vars_setup() and init-pki() 'vars' management improvements
The actual changes made are:

* Remove $old_vars_true, no longer required.

* Change a test of $found_vars from any-string to specific number 1.
  Which then tests for only one vars file is found.

* If vars-file is created during init-pki then also set $vars to file-name.
  The change here is that $vars is now ALWAYS set for this condition.

* Always print the names of conflicting vars files.
  Helps debugging for users.

* Expand short-circuits to full 'if; then; else; fi'.

* Add more verbose messages
  Help for debugging.

The combined effect is to show the correct messages regarding vars file,
during default status, help, init-pki and standard further commands.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 20:39:23 +01:00
Richard T Bonhomme
5350d50e03
Format: Correct indentation
See: git diff -w

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 02:35:19 +01:00
Richard T Bonhomme
9f752bde7a
vars_setup(): For EASYRSA_NO_VARS set found_vars to zero
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 02:14:08 +01:00
Richard T Bonhomme
7ec58cd64c
Status: Use variable for ca.crt name and correct found_vars value
'ca.crt' was hard-coded to 'pki/ca.crt', instead use '$EASYRSA_PKI/ca.crt'

Status incorrectly warns that there are multiple, conflicting vars files,
when vars is user-defined. Set '$found_vars' to 1, when vars is user-defined.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 01:56:18 +01:00
Richard T Bonhomme
1135efc148
Merge branch 'TinCanTech-expand-default-status'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 00:16:27 +01:00
Richard T Bonhomme
2edec49954
Merge branch 'expand-default-status' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-expand-default-status
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-04 00:15:47 +01:00
Richard T Bonhomme
8d5867a54f
ChangeLog: Expand default status to include vars-file and CA status
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 23:59:04 +01:00
Richard T Bonhomme
e2e2d1bfa1
Expand default status to include vars-file and CA status
For default command 'easyrsa', show the following:
* Show the location of vars-file.
* Show the status of the CA.
* If vars is not in the PKI then show the "Prefer pki/vars" warning.

Also, show the "Prefer pki/vars" warning for all commands except help.

Move the logic to show the "Prefer pki/vars" warning to the function.

Extensively, manually tested.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 23:32:28 +01:00
Richard T Bonhomme
5a0c7cd1f9
Merge branch 'TinCanTech-warn-no-vars'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 13:38:45 +01:00
Richard T Bonhomme
0a895027f0
Merge branch 'warn-no-vars' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-warn-no-vars
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 13:37:48 +01:00
Richard T Bonhomme
97b9a4c665
vars-file: Warn about EASYRSA_NO_VARS disabling vars-file use
Also, minor improvement to checking vars-file for 'export' and 'unset'.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 13:13:30 +01:00
Richard T Bonhomme
9872cc22c1
Merge branch 'TinCanTech-set_var-allow-empty'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 02:16:07 +01:00
Richard T Bonhomme
890780116a
Merge branch 'set_var-allow-empty' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-set_var-allow-empty
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-03 02:15:26 +01:00