1766 Commits

Author SHA1 Message Date
Richard T Bonhomme
b637e9b695
Move creating 'inline' folder from 'build-ca' to 'init-pki'
This allows a client that has not built a CA to use 'inline'.

The CA and signed client certificate can be sent to the client,
allowing the client to create a complete X509 based inline file,
without creating a redundant CA.

Also, add 'inline' command to the list of commands which do not
require a CA.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-05 15:58:56 +01:00
Richard T Bonhomme
98e9f43be6
renew: Use new ssl_cert_x509v3_eku()
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-05 15:58:25 +01:00
Richard T Bonhomme
77a0534347
New command inline: Inline available data for certificate
Expose 'inline' command to command line.
Inline available data and ignore missing files.

This function prints the available inline data to stdout.
To create inline files the data must be redirected to a file.
Internally, this redirection is taken care of.

Return 'soft' error when any data is missing but always print
available data.

This behaviour allows for incomplete inline files. For example,
when a CA signs a certificate but does not have the private key.
Any combination of missing files is allowed.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-05 15:57:52 +01:00
Richard T Bonhomme
fb3223fd5e
New command x509-eku: Extract X509v3 Extended Key Usage from cert
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-05 15:55:36 +01:00
Richard T Bonhomme
7332ae01d9
Merge branch 'dancerj-docs'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-03 00:09:40 +01:00
Junichi Uekawa
14e26c7473
Stylistic updates to documentation.
Add markdown links to documents referred to in README.md and
doc/EasyRSA-Readme.md

Signed-off-by: Junichi Uekawa <dancer@debian.org>
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-08-03 00:06:31 +01:00
Richard T Bonhomme
669ee43ea1
init-pki: Change notice for x509-types directory to verbose level
Now that easyrsa covers missing x509-types, the 'init-pki' message,
for the status of x509-types, is no longer required.

Improve and correct other messages and comments.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-26 21:51:47 +01:00
Richard T Bonhomme
ada4ccae1b
Remove debugging code
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2023-07-26 11:15:05 +01:00
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