Merge pull request #128 from oreinert/contrib

Make $PWD/pki the default PKI location
This commit is contained in:
Eric Crist 2017-06-30 18:18:37 -05:00 committed by GitHub
commit 0fcdc33783
2 changed files with 10 additions and 7 deletions

View File

@ -34,6 +34,7 @@ Configuration Reference
1. File referenced by the --vars CLI option
2. The file referenced by the env-var named `EASYRSA_VARS_FILE`
3. The `EASYRSA_PKI` directory
4. The default PKI directory at $PWD/pki (usually will be the same as above)
4. The `EASYRSA` directory
5. The location of the easyrsa program (usually will be the same as above)
@ -80,7 +81,7 @@ possible terse description is shown below:
* `EASYRSA` - should point to the Easy-RSA top-level dir, normally $PWD
* `EASYRSA_OPENSSL` - command to invoke openssl
* `EASYRSA_SSL_CONF` - the openssl config file to use
* `EASYRSA_PKI` (CLI: `--pki-dir`) - dir to use to hold all PKI-specific files
* `EASYRSA_PKI` (CLI: `--pki-dir`) - dir to use to hold all PKI-specific files, normally $PWD/pki.
* `EASYRSA_DN` (CLI: `--dn-mode`) - set to the string `cn_only` or `org` to
alter the fields to include in the req DN
* `EASYRSA_REQ_COUNTRY` (CLI: `--req-c`) - set the DN country with org mode

View File

@ -1015,13 +1015,15 @@ vars_setup() {
# set up program path
local prog_vars="${0%/*}/vars"
# set up PKI path
local pki_vars="${EASYRSA_PKI:-$PWD/pki}/vars"
# command-line path:
if [ -f "$EASYRSA_VARS_FILE" ]; then
vars="$EASYRSA_VARS_FILE"
# EASYRSA_PKI, if defined:
elif [ -n "$EASYRSA_PKI" ] && [ -f "$EASYRSA_PKI/vars" ]; then
vars="$EASYRSA_PKI/vars"
# PKI location, if present:
elif [ -f "$pki_vars" ]; then
vars="$pki_vars"
# EASYRSA, if defined:
elif [ -n "$EASYRSA" ] && [ -f "$EASYRSA/vars" ]; then
vars="$EASYRSA/vars"
@ -1039,9 +1041,9 @@ Note: using Easy-RSA configuration from: $vars"
fi
# Set defaults, preferring existing env-vars if present
set_var EASYRSA "$PWD"
set_var EASYRSA "${0%/*}"
set_var EASYRSA_OPENSSL openssl
set_var EASYRSA_PKI "$EASYRSA/pki"
set_var EASYRSA_PKI "$PWD/pki"
set_var EASYRSA_DN cn_only
set_var EASYRSA_REQ_COUNTRY "US"
set_var EASYRSA_REQ_PROVINCE "California"
@ -1251,4 +1253,4 @@ case "$cmd" in
;;
esac
# vim: ft=sh nu ai sw=8 ts=8
# vim: ft=sh nu ai sw=8 ts=8 noet