1758 Commits

Author SHA1 Message Date
Luiz Angelo Daros de Luca
52befc623f
fix prog_vars when easyrsa is symlink or in $PATH
When easyrsa in in $PATH, $0 does not contain a directory, resulting
in an invalid prog_vars. prog_vars is used to get default vars
location, if $EASYRSA_VARS_FILE, $EASYRSA_PKI/vars and $PWD/pki/vars
does not exist.

$0 is also used to set $EASYRSA the same way prog_vars is defined.

$EASYRSA/openssl-easyrsa.cnf is used to set $EASYRSA_SSL_CONF initial
content if missing.

$EASYRSA/x509-types is used to for extensions dir if $EASYRSA_EXT_DIR
and $EASYRSA_PKI/x509-types are not found. However, if vars already
needs changes, it is better to set $EASYRSA_EXT_DIR and file locations
there.

Normally a symlink to /usr/bin will be used to put easyrsa in $PATH.
Following $PATH and symlink allows easyrsa to be located in a more
standard dir like /usr/lib/easy-rsa/easyrsa and vars at
/usr/{lib,libexec,share}/easyrsa/vars, which could be a symlink to
/etc/easy-rsa/vars. vars can be easily appended with the default
distribution values.

With this patch, a system-wide easyrsa package could use this file
structure without patching easyrsa:

 /etc/easy-rsa/openssl-easyrsa.cnf
 /etc/easy-rsa/pki/
 /etc/easy-rsa/vars
 /usr/bin/easyrsa -> /usr/lib/easy-rsa/easyrsa
 /usr/lib/easy-rsa/easyrsa
 /usr/lib/easy-rsa/openssl-easyrsa.cnf
 /usr/lib/easy-rsa/vars -> /etc/easy-rsa/vars
 /usr/lib/easy-rsa/x509-types

If following symlink fails (win32), the previous behavior is used.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 19:08:08 -03:00
Luiz Angelo Daros de Luca
9d2f2417e0 fix prog_vars when easyrsa is symlink or in $PATH
When easyrsa in in $PATH, $0 does not contain a directory, resulting
in an invalid prog_vars. prog_vars is used to get default vars
location, if $EASYRSA_VARS_FILE, $EASYRSA_PKI/vars and $PWD/pki/vars
does not exist.

$0 is also used to set $EASYRSA the same way prog_vars is defined.

$EASYRSA/openssl-easyrsa.cnf is used to set $EASYRSA_SSL_CONF initial
content if missing.

$EASYRSA/x509-types is used to for extensions dir if $EASYRSA_EXT_DIR
and $EASYRSA_PKI/x509-types are not found. However, if vars already
needs changes, it is better to set $EASYRSA_EXT_DIR and file locations
there.

Normally a symlink to /usr/bin will be used to put easyrsa in $PATH.
Following $PATH and symlink allows easyrsa to be located in a more
standard dir like /usr/lib/easy-rsa/easyrsa and vars at
/usr/{lib,libexec,share}/easyrsa/vars, which could be a symlink to
/etc/easy-rsa/vars. vars can be easily appended with the default
distribution values.

With this patch, a system-wide easyrsa package could use this file
structure without patching easyrsa:

 /etc/easy-rsa/openssl-easyrsa.cnf
 /etc/easy-rsa/pki/
 /etc/easy-rsa/vars
 /usr/bin/easyrsa -> /usr/lib/easy-rsa/easyrsa
 /usr/lib/easy-rsa/easyrsa
 /usr/lib/easy-rsa/openssl-easyrsa.cnf
 /usr/lib/easy-rsa/vars -> /etc/easy-rsa/vars
 /usr/lib/easy-rsa/x509-types

If following symlink fails (win32), the previous behavior is used.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 19:08:08 -03:00
Luiz Angelo Daros de Luca
58b095454c
Remove req/privkey in build_full when sign_req fails
build_full leave req/privkey ig sign fails (i.e. when CA pass was
incorrect). If build_full fails, it should remove everything it created.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 19:03:47 -03:00
Luiz Angelo Daros de Luca
ad2510dc91 Remove req/privkey in build_full when sign_req fails
build_full leave req/privkey ig sign fails (i.e. when CA pass was
incorrect). If build_full fails, it should remove everything it created.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 19:03:47 -03:00
Luiz Angelo Daros de Luca
c794d5ebaa
add --passin --passout for alternative pass src/dst
Batch operations cannot be automated if openssl keeps asking
for a password. These new options allow the user to specify
a new source for password, using any openssl password options
like pass:1234 or env:var

Aborts build-ca if privkey generation fails.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:57:53 -03:00
Luiz Angelo Daros de Luca
132604f13f add --passin --passout for alternative pass src/dst
Batch operations cannot be automated if openssl keeps asking
for a password. These new options allow the user to specify
a new source for password, using any openssl password options
like pass:1234 or env:var

Aborts build-ca if privkey generation fails.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:57:53 -03:00
Luiz Angelo Daros de Luca
4ede9bf103
Add easyrsa_openssl as openssl wrap function
Most $EASYRSA_OPENSSL calls where replaced by easyrsa_openssl
calls. When OpenSSL config is needed, easyrsa_openssl generates
a temporary config in tempfiles, incorporating make_ssl_config and
$EASYRSA_EXTRA_EXTS usage.

vars_source_check and verify_ssl_lib use of make_ssl_config was
removed.

'export OPENSSL_CONF' was removed as every openssl call that might
need a conf now uses easyrsa_safessl.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:26:56 -03:00
Luiz Angelo Daros de Luca
0dd2bca711 Add easyrsa_openssl as openssl wrap function
Most $EASYRSA_OPENSSL calls where replaced by easyrsa_openssl
calls. When OpenSSL config is needed, easyrsa_openssl generates
a temporary config in tempfiles, incorporating make_ssl_config and
$EASYRSA_EXTRA_EXTS usage.

vars_source_check and verify_ssl_lib use of make_ssl_config was
removed.

'export OPENSSL_CONF' was removed as every openssl call that might
need a conf now uses easyrsa_safessl.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:26:56 -03:00
Luiz Angelo Daros de Luca
6ecb6f489e
use temporary directory instead of individual files
Manually managing temp files into fixes variables (EASYRSA_TEMP_FILE_*),
can result in errors like in build_ca that reused EASYRSA_TEMP_FILE_3.
A temporary directory simplify the cleanup.

A configurable directory for temp files (var EASYRSA_TEMP_DIR) also
allows the user to define a different temporary directory. This is
important for devices using flash disks that have limited number of
writes.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:26:56 -03:00
Luiz Angelo Daros de Luca
57f327b207 use temporary directory instead of individual files
Manually managing temp files into fixes variables (EASYRSA_TEMP_FILE_*),
can result in errors like in build_ca that reused EASYRSA_TEMP_FILE_3.
A temporary directory simplify the cleanup.

A configurable directory for temp files (var EASYRSA_TEMP_DIR) also
allows the user to define a different temporary directory. This is
important for devices using flash disks that have limited number of
writes.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:26:56 -03:00
Luiz Angelo Daros de Luca
d48618474b
cleanup and exit code when a signal is received
Merged clean_temp and prog_exit into cleanup, but removing
the exit call. Exit should not be called during EXIT as it will
overwrite the current exit code.

Trapped signals simply call "exit $((128+signal))" to force the
execution of EXIT (for non bash-shells).

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:23:53 -03:00
Luiz Angelo Daros de Luca
965165c99a cleanup and exit code when a signal is received
Merged clean_temp and prog_exit into cleanup, but removing
the exit call. Exit should not be called during EXIT as it will
overwrite the current exit code.

Trapped signals simply call "exit $((128+signal))" to force the
execution of EXIT (for non bash-shells).

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2019-05-02 18:23:53 -03:00
Eric F Crist
38c42b22d6
neuter SC, WIP
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:50:57 -05:00
Eric F Crist
5e1fc4941a neuter SC, WIP
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:50:57 -05:00
Eric F Crist
b8676b7842
Merge branch 'TinCanTech-master'
Clean up usage of make_ssl_config

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:48:48 -05:00
Eric F Crist
5024a1c1b1 Merge branch 'TinCanTech-master'
Clean up usage of make_ssl_config

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:48:48 -05:00
Eric F Crist
80e09e6bdc
Merge branch 'master' of https://github.com/TinCanTech/easy-rsa into TinCanTech-master 2019-04-18 06:46:19 -05:00
Eric F Crist
52a399877a Merge branch 'master' of https://github.com/TinCanTech/easy-rsa into TinCanTech-master 2019-04-18 06:46:19 -05:00
Eric F Crist
57a7db99ed
Merge branch 'xavierba-fix_upgrade'
Fixes for upgrade from v3.0.5 to v3.0.6

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:43:26 -05:00
Eric F Crist
4de3848f0c Merge branch 'xavierba-fix_upgrade'
Fixes for upgrade from v3.0.5 to v3.0.6

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-04-18 06:43:26 -05:00
Xavier Bachelot
30d1c95e68
Simplify
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:15:08 +01:00
Xavier Bachelot
c41bdc9b11 Simplify
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:15:08 +01:00
Xavier Bachelot
8075dbbded
Don't die on missing req on revoke/renew
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:52 +01:00
Xavier Bachelot
c1c29edf20 Don't die on missing req on revoke/renew
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:52 +01:00
Xavier Bachelot
9715751815
Automatically create missing renewed dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:34 +01:00
Xavier Bachelot
7b9f97414d Automatically create missing renewed dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:34 +01:00
Xavier Bachelot
b3b3623de9
Automatically create missing revoked dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:18 +01:00
Xavier Bachelot
7f96d2a680 Automatically create missing revoked dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:14:18 +01:00
Xavier Bachelot
0198f07eda
verify_ca_init has no business checking the revoked and renewed dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:13:52 +01:00
Xavier Bachelot
1a139d3620 verify_ca_init has no business checking the revoked and renewed dirs
Signed-off-by: Xavier Bachelot <xavier@bachelot.org>
2019-03-22 18:13:52 +01:00
Eric F Crist
ca33f84aa2
Add win32 OpenSSL binaries, update build
New build script changes to handle win32/win64 openssl binaries.
There's more to do here with copying out the README files and such, but
this should be a good working start.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-07 18:08:39 -06:00
Eric F Crist
eb00c2ea51 Add win32 OpenSSL binaries, update build
New build script changes to handle win32/win64 openssl binaries.
There's more to do here with copying out the README files and such, but
this should be a good working start.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-07 18:08:39 -06:00
Eric F Crist
4501c904b9
Fix typos in openssl-easyrsa.cnf
Merge branch 'IPv4v6-fix-typo'

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-07 17:21:26 -06:00
Eric F Crist
45fd23ee69 Fix typos in openssl-easyrsa.cnf
Merge branch 'IPv4v6-fix-typo'

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-07 17:21:26 -06:00
Stefan Pietsch
4ce6e9c8e4 Fix typo 2019-02-08 00:11:08 +01:00
Stefan Pietsch
7bf7afce1f Fix typo 2019-02-08 00:11:08 +01:00
Richard Bonhomme
cedd50e01e
Prune make_ssl_config
Signed-off-by: Richard Bonhomme <tincanteksup@gmail.com>
2019-02-06 20:05:42 +00:00
Richard Bonhomme
7d46e8ff9e Prune make_ssl_config
Signed-off-by: Richard Bonhomme <tincanteksup@gmail.com>
2019-02-06 20:05:42 +00:00
Richard Bonhomme
205510bfab
Improve verify_ssl_lib
Signed-off-by: Richard Bonhomme <tincanteksup@gmail.com>
2019-02-06 19:57:01 +00:00
Richard Bonhomme
a5887b64bd Improve verify_ssl_lib
Signed-off-by: Richard Bonhomme <tincanteksup@gmail.com>
2019-02-06 19:57:01 +00:00
Eric F Crist
9621e2626c
make op_test.sh executable
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:35:48 -06:00
Eric F Crist
9eb5f57112 make op_test.sh executable
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:35:48 -06:00
Eric F Crist
3d808dff94
Update changelog
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:26:29 -06:00
Eric F Crist
28ea02d7ed Update changelog
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:26:29 -06:00
Eric F Crist
be93f45f1e
No uname on Windows
Since there's no uname command on Windows, send STDERR to /dev/null.
This just prevents an error from showing on the console but doesn't
actually change any system behavior.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:24:35 -06:00
Eric F Crist
f451a20a4a No uname on Windows
Since there's no uname command on Windows, send STDERR to /dev/null.
This just prevents an error from showing on the console but doesn't
actually change any system behavior.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:24:35 -06:00
Eric F Crist
e5d46199c9
Distribute OpenSSL 1.1.0j instead of 1.1.1a
There are runtime issues with 1.1.1a at this time I've yet to track
down.  This is referenced in the docker-openvpn project issue 437
with a link in #261.  I've been able to reproduce it on Windows 10.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:21:58 -06:00
Eric F Crist
a42d83da05 Distribute OpenSSL 1.1.0j instead of 1.1.1a
There are runtime issues with 1.1.1a at this time I've yet to track
down.  This is referenced in the docker-openvpn project issue 437
with a link in #261.  I've been able to reproduce it on Windows 10.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:21:58 -06:00
Eric F Crist
37edb7d1d7
Remove RANDFILE var from openssl-easyrsa.cnf
This fixes #261.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:01:09 -06:00
Eric F Crist
a67e13a9d9 Remove RANDFILE var from openssl-easyrsa.cnf
This fixes #261.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
2019-02-04 13:01:09 -06:00