402 Commits

Author SHA1 Message Date
Richard T Bonhomme
7227adcca2
Rigorously quote all use of "$EASYRSA_BATCH"
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-04-03 02:31:55 +01:00
Wharf in Ships Clothing
b25d74e6b7
Remove obsolete function copy_data_to_pki()
Signed-off-by: Wharf in Ships Clothing <wiscii@protonmail.com>
2022-04-01 16:03:52 +01:00
Richard T Bonhomme
0d29396070
General formatting corrections (NFC)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-31 23:00:47 +01:00
Richard T Bonhomme
14a29f9fca
Merge branch 'Antagonym-soft-reset'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-31 22:50:43 +01:00
Richard T Bonhomme
24a2b4fa77
Merge branch 'soft-reset' of ssh://github.com/Antagonym/easy-rsa into Antagonym-soft-reset
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-31 22:00:25 +01:00
Richard T Bonhomme
6759e87dd9
Merge branch 'patch-1' of ssh://github.com/pacija/easy-rsa into pacija-patch-1
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-31 19:54:22 +01:00
Richard T Bonhomme
dc2da4ed45
Merge branch 'master' of /TinCanTech/easy-rsa into TinCanTech-master
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-31 13:44:29 +01:00
IPv4v6
6bdbc8ef97
Add authority information access example (#307) 2022-03-30 21:43:25 +01:00
Richard T Bonhomme
ef59ea7dd9
copy_data_to_pki(): Immediate exit-with-error or 'shift' on success
This captures any copy errors and/or clears the excess second parameter.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 23:38:37 +01:00
Richard T Bonhomme
7690574315
Add notice to 'init-pki': 'vars' file has now moved to PKI above
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 23:02:14 +01:00
Richard T Bonhomme
672b56b6ba
Merge branch 'mxc5178-master'
Minor white-space and typo corrections.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 20:59:00 +01:00
Richard T Bonhomme
59cf4b50d3
Merge branch 'master' of mxc5178/easy-rsa into mxc5178-master (#67)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 20:53:10 +01:00
Richard T Bonhomme
d88ec8bea3
Improve install_data_to_pki(): Create pki/vars at 'init-pki'
Bug: '$1' is not cleared, therefore 'pki/vars' was always created.

Explicitly require 'context:$1' (init-pki or vars-setup), otherwise die.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 17:30:24 +01:00
Richard T Bonhomme
a6db7f496f
When initialising a new PKI, create "$EASYRSA_PKI/vars' from example
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 16:15:01 +01:00
Richard T Bonhomme
7c97dcd864
Do full shellcheck test. Wrap nasty long lines.
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 01:59:15 +01:00
Richard T Bonhomme
9e109cdd7d
Hard wrap excessively long lines
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-29 00:38:20 +01:00
Richard T Bonhomme
875dd27808
Improvements to shellcheck compliance
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-28 23:47:12 +01:00
Richard T Bonhomme
3f7c7df911
Merge branch 'master' of 'TinCanTech/easy-rsa' into TinCanTech-master
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-28 23:29:15 +01:00
Richard T Bonhomme
388aa0396e
Declare 'vars_file' without use
This is a deliberate misuse of shellcheck: Reminder to fix PKI/vars.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-28 22:57:51 +01:00
Richard T Bonhomme
a8a2171716
Optimize install_data_to_pki()
Thanks to excellent community feedback, this patch forces a single,
reliable list of sources for EasyRSA data-files.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-28 22:44:50 +01:00
Richard T Bonhomme
bc07187073
Change install_data_to_pki() failures to non-fatal warnings
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-28 13:40:28 +01:00
Richard T Bonhomme
5255d90b9a
Merge branch: 'safessl-patch' of github.com/Prouflon/easy-rsa-1
Change '$EASYRSA_SSL_CONF' to correct default value in example file.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-27 17:39:34 +01:00
Richard T Bonhomme
3222d17b5e
Introduce install_data_to_pki() - Copy data-files to PKI
The purpose here is to force EasyRSA find the required data-files:

* 'openssl-easyrsa.cnf' MUST be found.
* 'x509-types' MUST be found.
* 'vars.example' should be found.
* 'vars'
  The 'vars' file is more complicated due to user expectations.
  This patch does not copy 'vars', the code is included but DISABED.

The reasons are:

* Allow running 'easyrsa' from PATH.
* Make standard packaging work correctly.

Bug fixes:

* #499 and associated issues with missing files.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-27 14:16:32 +01:00
Richard T Bonhomme
ed7380bab8
Add SSL Library version 2 to easyrsa_openssl()
Closes: #504

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-25 18:52:23 +00:00
Richard T Bonhomme
8c2a09f374
Expand new verify_ssl_lib() to support LibreSSL version 2.x (again)
Changes made by a0dbc346bd92088ee481f5488ac53a7537b32073 result in
'ossl_major=2' and LibreSSL 2.x not being recognised.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-25 15:49:04 +00:00
Richard T Bonhomme
14d6e24377
Merge branch 'bugfix/spaces_in_path'
markus-t314-bugfix/spaces_in_path

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-23 20:45:33 +00:00
Richard T Bonhomme
5ece7ccb3d
Merge branch 'feature/custom-umask'
github.com/ccin2p3/easy-rsa into ccin2p3-feature/custom-umask

Fix typo: 'defúlts' -> 'default'

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-22 12:58:07 +00:00
Richard T Bonhomme
d0c8f30b66 Merge branch 'master' of github.com/a1346054/easy-rsa into a1346054-master 2022-03-22 12:00:10 +00:00
Richard T Bonhomme
4dfc380308
Merge branch 'TinCanTech-master' #496
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-22 01:52:32 +00:00
Richard T Bonhomme
753ea21e5f
OpenSSL Configuration: Add required white space separator
Closes: #431

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-21 23:39:50 +00:00
Richard T Bonhomme
0f80268337
Help: Add algorithm 'ed' to --use-algo text
Closes: #488

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-21 23:23:32 +00:00
Richard T Bonhomme
c56eee40bf
Remove spurious echo in upgrade process
Closes: #453

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-21 17:51:11 +00:00
Richard T Bonhomme
8e7bac695d
Quote $algo_opts
When EasyRSA is installed to a path with a space in it, gen_req() fails
for EC and ED crypto.  This is caused by the space in the file-name for
the parameters file $EASYRSA_CURVE.

To resolve this, '-newkey' must be removed from $algo_opts and inserted
into the OpenSSL command.  And $algo_opts must be quoted. (#494)

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-21 15:57:03 +00:00
Richard T Bonhomme
f64fef9af2
Replace needlessly complicated 'if/elif/else' with simple 'case'
Where 'if' is replaced with 'case', functionality is generaly maintained.

With the following exceptions:

* verify_curve_ed() does not need to identify the specific curve.
  Error status will provide the correct result for a curve name error.

* For Edwards curve crypto, the 'case' statement is further reduced to
  use the verified $EASYRSA_CURVE inside the OpenSSL command.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-20 21:55:12 +00:00
Richard T Bonhomme
a7e0b3fe69
Make easyrsa_openssl() aware of the SSL Library version
Commit a0dbc346bd92088ee481f5488ac53a7537b32073 leads to bug caused
by OpenSSL 'genpkey' inconsistency. OpenSSL version 1 'genpkey' does
not support option '-config' but OpenSSL version 3 does.
(Details can be found at: https://www.openssl.org/docs/manpages.html)

To use 'genpkey' option '-config', easyrsa_openssl() needs to be aware
of the SSL Library version and only set '-config' for version 3.

This patch sets OpenSSL version 3 ONLY option '-config' for 'genpkey'.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-20 21:20:20 +00:00
Richard T Bonhomme
7b3fdee224
Quote $out_key_tmp
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-19 17:59:01 +00:00
Richard T Bonhomme
4315356de0
Minor refactoring of build_ca() for OpenSSL version 1
* (1) Move definition of $crypto_opts inside 'case' for OSSLv1 (NFC)
  This defines $crypto_opts for the CA private key.

* Wrap long lines (NFC)

* (2) Expand definition of $crypto_opts to use $no_password.
  This defines $crypto_opts for the CA pair.

Note: Before this change (2), the command which EasyRSA uses
does not include '-nodes' when building an unencrypted CA.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-19 16:52:22 +00:00
Richard T Bonhomme
73cc4a62cc
Set 'build_ca()' specific $crypto_opts '-pass' for OpenSSL version 3
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-18 20:39:40 +00:00
Richard T Bonhomme
16f2d11f37
Use $crypto_opts to correctly set SSL '-noenc' ($no_password)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-18 17:23:55 +00:00
Richard T Bonhomme
a0dbc346bd
Introduce support for OpenSSL version 3
Required changes:

* Use 'verify_ssl_lib()' to determine SSL Library version.
  Returns '1', '3' OR error.
  Sets 'no_password' to either '-nodes' (SSLv1) or '-noenc' (SSLv3)

* Replace OpenSSL paramater '-nodes' [DEPRECATED], with '-noenc'.
  Ref: https://www.openssl.org/docs/man3.0/man1/openssl-req.html
  This effects All Easy-RSA CAs built using OpenSSL version 3.

* Replace OpenSSL command 'genrsa' [DEPRECATED], with 'genpkey'.
  Ref: https://www.openssl.org/docs/man3.0/man1/openssl-genrsa.html
  This effects Easy-RSA 'RSA' CAs built using OpenSSL version 3.
  OpenSSL advises using 'genpkey' over 'genrsa'.

* OpenSSL 'genpkey' does not accept the parameters defined by
  easyrsa $opts and $no_password when generating CA private keys.
  Do not use these variables for OpenSSL-v3 'genpkey'.

Optional changes:

* Use 'easyrsa_openssl()' wrapper function to build All CAs.

* Add 'genpkey' to easyrsa_openssl() wrapper, to include using the
  EasyRSA/OpenSSL Configuration file $EASYRSA_SAFE_CONF.

* Change EasyRSA Elliptic Curve (ec) CA's to also use OpenSSL 'genpkey',
  instead of OpenSSL 'ec'.  This change is not required, however, this
  means that all EasyRSA CA Private keys are created using 'genpkey'
  with OpenSSL v3.

* EasyRSA 'gen_req()' is the only other code which uses OpenSSL '-nodes'.
  Make 'gen_req()' aware of the SSL Library version and therefore the
  correct parameter for an unencrypted private key. (-noenc vs -nodes)
  Note: OpenSSL '-nodes' is only deprecated not removed.

* Indent OpenSSL version 1 code block to match. No functional changes.

Tests Passed:

Full extended unit tests, with both OpenSSL version 1.1.x and 3.0.1
(Includes standard test for Edwards Curve PKI)

Manual building of All OpenSSL *v3* CAs with passwords and subsequent
building and signing of a server or client certificate.

Manual building of OpenSSL *v1* EC CA with password and subsequent
building and signing of a server or client certificate.
Tested due to changing CA key from OpenSSL 'ec' to 'genpkey'.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-18 14:43:28 +00:00
Eric F Crist
4463e1d08f
Use openssl rand -hex 3 instead of mktemp
This removes our dependency on an external non-POSIX mktemp
implementation and uses openssl's built in rand function.

Addresses #478

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-03-15 19:16:28 -05:00
a1346054
212c18a83c
Trim excess whitespace 2021-10-21 14:21:00 +00:00
a1346054
67e3e6ae4a
Fix spelling 2021-10-21 14:08:50 +00:00
a1346054
8aaa13f73a
Remove mention of no longer used IRC network
The channels are active at libera.chat IRC network instead
2021-10-21 13:57:30 +00:00
Fᴀʙɪᴇɴ Wᴇʀɴʟɪ
1f7ef3663f
Add possibility to configure umask 2021-10-12 10:21:35 +02:00
patchhoernchen
6c5753348d
fixed renew filename confusion
fixed missing quotes leading to filename inconsistency in renew subcommand.
2021-05-04 16:51:43 +02:00
Markus Tillinger
aa925e18fa Fixed another issue of missing quotes where renewing would rename files
while moving them if filename contains spaces.
2021-01-22 17:19:14 +01:00
Markus Tillinger
74739844b4 Fixed space-related issues in export-pkcs 2021-01-22 16:30:17 +01:00
Markus Tillinger
0527385231 Minor re-formating replacing spaces with tabs for consistency 2021-01-22 13:55:00 +01:00
Markus Tillinger
e3f65e7905 Minor re-formating changing comparison order for consistency 2021-01-22 13:55:00 +01:00