Commit Graph
734 Commits
Author SHA1 Message Date
Richard T Bonhomme 32071fc32f Merge branch 'TinCanTech-master'
Introduce support for OpenSSL version 3

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
2022-03-21 16:43:08 +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 a0dbc346bd 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 6ac2705eb4 Update ChangeLog to include notes for 3.0.9 release
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-03-15 21:40:03 -05:00
Eric F Crist 2155d2c95c Update OpenSSL to 1.1.1m for Windows
Using compiled binaries from Overbyte at:
 http://wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries_.28required_for_SSL-enabled_components.29

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-03-15 21:16:52 -05:00
Eric F Crist 86e8feccda Merge branch 'issue_478'
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2022-03-15 19:23:17 -05: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
Eric Crist 243bb708b0 Update README.md
add link to key
2021-05-09 20:10:31 -05:00
Eric Crist d227b0c9e7 Update README.md
Add signature verification example.
2021-05-09 20:01:21 -05:00
Eric F Crist 7adaf701c3 Merge branch 'patchhoernchen-patch-1'
Fixes #443

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2021-05-05 14:22:28 -05: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
Eric F Crist 41a6bc6845 Use $EASYRSA_OPENSSL instead of $PATH
Silly bug on my part.

Fixes #416

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-11-06 20:50:37 -06:00
Eric F Crist 19a20046ca Update OpenSSL to 1.1.1g (again)
Using another build of OpenSSL that appears to work fine in testing.

Long term, we should be building OpenSSL ourselves and shipping it on a
regular basis.  That's another project on the list.

Resolves #405.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-18 08:27:14 -05:00
Eric F Crist a9cecc747c Revert "Update Windows OpenSSL to 1.1.1g from 1.1.0j"
This reverts commit 5f3e5ca450.

There is an incompatibility in 1.1.1g with the EasyRSA script.  There
are no new features in 1.1.1g we are leveraging directly, so just going
to revert to support the OpenVPN 2.5 release process and get EasyRSA
v3.x into more hands.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-16 07:50:04 -05:00
Eric F Crist f12e00e53b Update ChangeLog for v3.0.8 release
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:55:36 -05:00
Eric F Crist 5791a732cc Add caution about setting global options in docs
Merge branch 'visuve-master'

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:44:39 -05:00
Eric F Crist 8ad3cd845c Add note in EasyRSA-Advanced about setting advanced options.
Merge branch 'master' of https://github.com/visuve/easy-rsa into visuve-master

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:42:56 -05:00
Eric F Crist 0ff79e5ea7 doc: Spelling, formatting, etc improvements
Various punctuation and grammatical corrections.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:35:33 -05:00
Eric F Crist bc1b04116e doc: Spelling, formatting, etc
Various grammatical and punctuation related changes.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:33:43 -05:00
Eric F Crist 5f3e5ca450 Update Windows OpenSSL to 1.1.1g from 1.1.0j
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 15:30:47 -05:00
Eric F Crist eaca0832fa fix --passin option for RSA keys
Commit 1e98ba8 introduced an issue with RSA keys (only ED keys were
tested).

Closes #403 and #395

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-09 14:38:49 -05:00
Daniel Iancu 08746ca179 Fix: build_ca() fails for rsa keys
This fixes an argument error I made in commit 1e98ba808c, sorry I have not tested RSA keys as I only use ED.
The argument is -passout for all openssl versions (tested on LibreSSL 2.8.3 and OpenSSL 1.1.1d).
2020-09-09 14:13:20 +03:00
Eric F Crist 8b0e302337 Print error and exit when vars not found on upgrade
When a vars file cannot be found, the up23_manage_upgrade_23() function
will now exit and print a message stating such.  Previously, it exited
silently.

Fixes #377.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-02 10:22:48 -05:00
Eric F Crist 2db812160e Clarify error messages
The word "offending" doesn't make sense.  Changed to "File Path".

Closes #384

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-09-02 09:31:30 -05:00
Eric F Crist 768b66cfdd Fix build_ca() always making non-encrypted keys
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-08-28 09:39:04 -05:00
Daniel Iancu 1e98ba808c Fix: build_ca() always makes non-encrypted ED private keys
This resolves a bug where build_ca ignores the nopass flag and always makes non-encrypted private keys when ALGO is "ed".
Also solves build_ca handling of EASYRSA_PASSOUT argument when generating private keys with ALGO set to "ed".
2020-08-28 12:13:28 +03:00
Nicolas Jeker 3d23b1bd01 doc: Spelling, formatting and setence structure improvements 2020-08-20 11:35:14 +02:00
visuve c7980daaa4 Add a note in EasyRSA-Advanced.md
- The global options need to be set before the actual commands
- https://github.com/OpenVPN/easy-rsa/blob/master/easyrsa3/easyrsa#L219
2020-06-28 16:33:45 +03:00
Eric F Crist e68faed0a3 Feature: --passin for update-db operations with CA
Merge branch 'madmajestro-use-passin-update-db'

Adds support for leveraging the --passin option for the CA private key
password when running the update-db command.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-05-12 22:25:53 -05:00
Eric F Crist eb370fe4cd Merge branch 'use-passin-update-db' of https://github.com/madmajestro/easy-rsa into madmajestro-use-passin-update-db 2020-05-12 22:24:51 -05:00
Eric F Crist 358fa06c15 Fix: Return in set_pass() always non-zero in batch
Merge branch 'madmajestro-setpass-never-returns-0-in-batchmode'

Similar bug to what was fixed in 2953817, with the same fix.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-05-12 22:22:19 -05:00
Eric F Crist d2f2735f6a Merge branch 'setpass-never-returns-0-in-batchmode' of https://github.com/madmajestro/easy-rsa into madmajestro-setpass-never-returns-0-in-batchmode 2020-05-12 22:20:50 -05:00
Eric F Crist 2953817e45 Fix: notice() and warn() returned error in batch
Merge branch 'madmajestro-imrove-returncode-notice-and-warn'

This resolves a bug where the warn() and notice() functions would
produce a non-zero exit during batch mode operations.  This bug was
introduced by me in 09e2c3b.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-05-12 22:17:44 -05:00
Arndt Kaiser 0044e1dc7c Functions notice() and warn() return with success now
The functions notice() and warn() allways exited with an return-code !=
0 if called in batch-mode, which can cause unexpected behavior in the
calling code. Now it is ensured that they return with succes.

Additinally, the Script will now terminate if the printf command in the
function print() fails. This ensures that errors during
output-generation will not be ignored.
2020-05-12 08:49:07 +02:00
Arndt Kaiser cd69645b32 Function set_pass() now returns 0 on success in batch-mode
If changing passwords in batch-mode, the commands set-rsa-pass and
set-ec-pass allways returned with an exit code != 0 on success.

The origin for this is the implementation of the function notice() which
allway returns an return-code != 0 if called in batch-mode.

This patch fixes the bug by adding a return 0 at the end of set_pass(),
because this is the way this behaviour is fixed in other functions. I
will provide an additional pull-request to improve the functions
notice() and warn().
2020-05-11 08:20:04 +02:00
Arndt Kaiser 09637e3243 Don't ask for ca-password during update-db if EASYRSA_PASSIN is set
Now it is possible to run the command update-db without being asked for
the ca-password, if the option --passin is provided at the command line.
2020-05-10 20:04:48 +02:00
Eric F Crist c505a14be5 op_test.sh will now exit with status of unit tests
Fixed an issue where op_test.sh would exit with the status of the rm
command from cleanup, rather than from the unit tests it was running.

Closes #355

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 22:07:14 -05:00
Eric F Crist 2d0e10144f Update ChangeLog for v3.0.8
Update coming soon.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 22:00:16 -05:00
Eric F Crist 9827c7dc3f Add support for export-p8
Merge branch 'nkakouros-pkcs8' (#340)

Closes #339

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 21:06:18 -05:00
Eric F Crist 2189cc6f99 Merge branch 'pkcs8' of https://github.com/nkakouros/easy-rsa into nkakouros-pkcs8 2020-04-14 20:52:06 -05:00
Eric F Crist fc608b0f2d Merge branch 'InsaneScientist-fix-ed25519'
When Edwards curves are currently specified, they will be used for the
signature algorithm, but the actual public/private keypair will fall
back to defaults (RSA2048), which is likely not what the user intends.

This commit modifies the code so that requesting Edwards curves will
result in their use for the Public Key Algorithm (new behavior) in
addition to the Signature Algorithm (current behavior)

Examples of fixed and current (broken) behavior given below. Note the
Public Key Algorithm in the middle of the certificate and the message
from openssl of the private key type that's being generated

==> This still doesn't appear to fix the issue when generating
    certificates on macOS with LibreSSL.  I haven't looked too far into
    this, though.

Address OpenSSL in #350, needs more attention.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 20:28:57 -05:00
Eric F Crist 8eeb0d2628 Use same algorithm for signature as pub/priv keys
When Edwards curves are currently specified, they will be used for the
signature algorithm, but the actual public/private keypair will fall
back to defaults (RSA2048), which is likely not what the user intends.

This commit modifies the code so that requesting Edwards curves will
result in their use for the Public Key Algorithm (new behavior) in
addition to the Signature Algorithm (current behavior)

Examples of fixed and current (broken) behavior given below. Note the
Public Key Algorithm in the middle of the certificate and the message
from openssl of the private key type that's being generated:

Merge branch 'fix-ed25519' of https://github.com/InsaneScientist/easy-rsa into InsaneScientist-fix-ed25519
2020-04-14 20:19:38 -05:00
Eric F Crist 0fdd390c11 Check for dh.pem before overwriting
gen-dh would overwrite dh.pem without warning

In batch mode, easyrsa now exits 1 if dh.pem exists.

In interactive move, the user is prompted if dh.pem exists.

Fixes #373

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 19:36:14 -05:00
Eric F Crist 3e93f925d3 Add version output option and info
Now supports both --version and "version and outputs detailed version
information.  Tested on FreeBSD, macOS, and Windows 10 64-bit.

Sample Output:

EasyRSA Version Information
Version:     git-development
Generated:   Tue Apr 14 18:54:42 CDT 2020
SSL Lib:     OpenSSL 1.1.1a-freebsd  20 Nov 2018
Git Commit:  f0129cfe62
Source Repo: https://github.com/OpenVPN/easy-rsa

This closes #372

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2020-04-14 19:10:07 -05:00