easy-rsa/534f673.patch
2017-09-09 07:58:43 +00:00

73 lines
2.7 KiB
Diff

From 534f67345997603e3b1fbf6b673bbaa65937019e Mon Sep 17 00:00:00 2001
From: Olav Reinert <seroton10@gmail.com>
Date: Mon, 5 Jun 2017 23:30:57 +0200
Subject: [PATCH] Make $PWD/pki the default PKI location
---
doc/EasyRSA-Advanced.md | 3 ++-
easyrsa3/easyrsa | 14 ++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/doc/EasyRSA-Advanced.md b/doc/EasyRSA-Advanced.md
index 64b29ae..1bd8c29 100644
--- a/doc/EasyRSA-Advanced.md
+++ b/doc/EasyRSA-Advanced.md
@@ -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
diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa
index 088faeb..8adc8fc 100755
--- a/easyrsa3/easyrsa
+++ b/easyrsa3/easyrsa
@@ -989,13 +989,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"
@@ -1013,9 +1015,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"
@@ -1225,4 +1227,4 @@ case "$cmd" in
;;
esac
-# vim: ft=sh nu ai sw=8 ts=8
+# vim: ft=sh nu ai sw=8 ts=8 noet