OpenVPN / easy-rsa

easy-rsa - Simple shell based CA utility
Other
4k stars 1.19k forks source link

Improve vars auto load #1025

Closed TinCanTech closed 12 months ago

TinCanTech commented 1 year ago

This refines the automatic loading of a vars file.

TinCanTech commented 1 year ago

The FINAL stage:

TinCanTech commented 12 months ago

auto-load result is as follows:

If EASYRSA_VARS_FILE --vars=FILE is set then use it and no auto-load.

Reminder: easyrsa program location is no longer considered a viable place to keep a vars file.

Working directory:

Working directory Default PKI:

if EASYRSA_PKI --pki-dir=DIR is set then allow auto-load:

This allows --pki-dir=DIR to auto-load a vars file inside the user set PKI.

How to use vars with multiple PKI directories

Use --vars=FILE: This will always use ONLY the specified file, which is allowed to set the PKI.

Use --pki-dir=DIR If no default vars file exists then the PKI vars file will be used. This file cannot change the PKI in use.

Thus, for a multiple PKI installation with multiple vars files:

./pki-home/vars
./pki-work/vars

The SAFEST use is with --pki-dir=DIR, which can then differentiate between the two vars files shown.

To use --vars=FILE the following setup is required:

./vars.pki-home
./vars.pki-work
./pki-home/
./pki-work/

Use --vars=vars.pki-home to set EASYRSA_PKI to pki-home. etc. This is more prone to user error.


Add this to https://github.com/OpenVPN/easy-rsa/blob/master/doc/EasyRSA-Advanced.md