1758 Commits

Author SHA1 Message Date
Richard T Bonhomme
a8083fdbf3
Export PKCS: export-p1, use -traditional not -legacy
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-26 11:09:38 +01:00
Richard T Bonhomme
d832d206d8
Merge branch 'TinCanTech-improve-export-pkcs'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-25 21:38:50 +01:00
Richard T Bonhomme
0f5689f8b2
Merge branch 'improve-export-pkcs' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-improve-export-pkcs
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-25 21:38:03 +01:00
Richard T Bonhomme
ef793f1629
Export PKCS: Improve user messages, re-arrange p12 command
Re-arranging the p12 command to follow the standard:
- In file
- out file

Followed by
- Conditional: -nokeys
- Unconditional: -inkey file

This is a reminder that '-inkey' is subordinate to '-nokeys' but
is ALWAYS required.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-25 20:06:34 +01:00
Richard T Bonhomme
e60b5e2f5f
Export PKCS: Rename variable $short_name to $file_name_base
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-25 17:10:46 +01:00
Richard T Bonhomme
aaa44558b2
Export PKCS: Expand usage for incomplete PKI
The current export functions only allow use on a complete PKI, with CA.

This change allows the following:
* Server - Export P12/P7 without client key
* Client - Export P12/P7 without CA, P8/P1 without PKI

Due to the relative obscurity of the command options 'noca' and 'nokey',
exporting P12/P7 with incorrect options can be adjusted on-the-fly with
confirmation from the user.

Correct behaviour of export-p1 with OpenSSL v3 by using -legacy option.
Otherwise, OpenSSL v3 outputs a PKCS#8 format file.

Minor improvements to comments.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-25 15:11:26 +01:00
Richard T Bonhomme
cc089ab008
Insert newline separator before confirmations
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-20 23:58:06 +01:00
Richard T Bonhomme
350c0c6cb8
Remove user warnings for missing X509 types
Minor alignment and wrap long lines

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-20 20:25:52 +01:00
Richard T Bonhomme
074d0706dd
Merge branch 'TinCanTech-remove-has_config'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-19 22:53:11 +01:00
Richard T Bonhomme
135d3da0a8
Merge branch 'remove-has_config' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-remove-has_config
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-19 22:52:27 +01:00
Richard T Bonhomme
82a52d1a9f
Always configure OPENSSL_CONF=/dev/null when there is no SSL config
This applies to all direct calls using EASYRSA_OPENSSL (Default: 'openssl'),
which bypass using easyrsa_openssl() wrapper function.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-19 21:51:45 +01:00
Richard T Bonhomme
e207f855eb
openeasy_easyrsa: Remove unused variable 'has_config'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-19 03:02:55 +01:00
Richard T Bonhomme
d4fa9bdb6d
easyrsa_openssl: Replace variable 'has_config' with OPENSSL_CONF
Variable 'has_config' was a way to minimize the need to fully expand the
SSL config file (ENV:OPENSSL_CONF) for use by LibreSSL. IE. Only expand
the SSL config file when the SSL command requires a config file.

LibreSSL Always requires the config file to be expanded, even when it
is Not used.

OpenSSL Never requires the config file to be expanded.

Changes follow.

The first part:
* Disable expanding the SSL config file for OpenSSL.
* Require expanding the SSL config file for LibreSSL.

LibreSSL will use the run-once mechanism to expand the SSL config file.

The second part:
Replace the use of SSL option '-config', by Always configuring the SSL
environment variable OPENSSL_CONF to point to the Easy-RSA generated
config file. This is supported by LibreSSL and OpenSSL.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-19 02:17:20 +01:00
Richard T Bonhomme
27fce22919
Merge branch 'TinCanTech-iss984-fix-verify_working_env'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-18 00:59:50 +01:00
Richard T Bonhomme
27da328c0d
Merge branch 'iss984-fix-verify_working_env' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-iss984-fix-verify_working_env
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-18 00:59:14 +01:00
Richard T Bonhomme
affb1e712b
Only verify working environment for recognised commands
Otherwise, unrecognised commands trigger missing PKI and CA errors,
instead of the correct 'unrecognised command' error.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 22:35:58 +01:00
Richard T Bonhomme
f0c6788413
Merge branch 'TinCanTech-rewrite-ssl-org-conf-files'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 20:23:05 +01:00
Richard T Bonhomme
6f7bd58cf2
Merge branch 'rewrite-ssl-org-conf-files' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-rewrite-ssl-org-conf-files
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 20:22:18 +01:00
Richard T Bonhomme
2dd1077a10
Rename 'conf_tmp' temp-file to 'raw_ssl_cnf_tmp'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 17:56:33 +01:00
Richard T Bonhomme
1f65bb2386
easyrsa_mktemp: Make verbose msg shorter, remove text 'temp-file'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-17 03:26:49 +01:00
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