192 |
- |
1 |
Easy-RSA Advanced Reference
|
|
|
2 |
=============================
|
|
|
3 |
|
|
|
4 |
This is a technical reference for advanced users familiar with PKI processes. If
|
|
|
5 |
you need a more detailed description, see the `EasyRSA-Readme` or `Intro-To-PKI`
|
|
|
6 |
docs instead.
|
|
|
7 |
|
|
|
8 |
Configuration Reference
|
|
|
9 |
-----------------------
|
|
|
10 |
|
|
|
11 |
#### Configuration Sources
|
|
|
12 |
|
|
|
13 |
There are 3 possible ways to perform external configuration of Easy-RSA,
|
|
|
14 |
selected in the following order where the first defined result wins:
|
|
|
15 |
|
|
|
16 |
1. Commmand-line option
|
|
|
17 |
2. Environmental variable
|
|
|
18 |
3. 'vars' file, if one is present (see `vars Autodetection` below)
|
|
|
19 |
4. Built-in default
|
|
|
20 |
|
|
|
21 |
Note that not every possible config option can be set everywhere, although any
|
|
|
22 |
env-var can be added to the 'vars' file even if it's not shown by default.
|
|
|
23 |
|
|
|
24 |
#### vars Autodetection
|
|
|
25 |
|
|
|
26 |
A 'vars' file is a file named simply `vars` (without an extension) that
|
|
|
27 |
Easy-RSA will source for configuration. This file is specifically designed
|
|
|
28 |
*not* to replace variables that have been set with a higher-priority method
|
|
|
29 |
such as CLI opts or env-vars.
|
|
|
30 |
|
|
|
31 |
The following locations are checked, in this order, for a vars file. Only the
|
|
|
32 |
first one found is used:
|
|
|
33 |
|
|
|
34 |
1. The file referenced by the --vars CLI option
|
|
|
35 |
2. The file referenced by the env-var named `EASYRSA_VARS_FILE`
|
|
|
36 |
3. The directory referenced by the `EASYRSA_PKI` env-var
|
|
|
37 |
4. The default PKI directory at $PWD/pki
|
|
|
38 |
4. The directory referenced by the `EASYRSA` env-var
|
|
|
39 |
5. The directory containing the easyrsa program
|
|
|
40 |
|
|
|
41 |
Defining the env-var `EASYRSA_NO_VARS` will override the sourcing of the vars
|
|
|
42 |
file in all cases, including defining it subsequently as a global option.
|
|
|
43 |
|
|
|
44 |
#### OpenSSL Config
|
|
|
45 |
|
|
|
46 |
Easy-RSA is tightly coupled to the OpenSSL config file (.cnf) for the
|
|
|
47 |
flexibility the script provides. It is required that this file be available,
|
|
|
48 |
yet it is possible to use a different OpenSSL config file for a particular
|
|
|
49 |
PKI, or even change it for a particular invocation.
|
|
|
50 |
|
|
|
51 |
The OpenSSL config file is searched for in the following order:
|
|
|
52 |
|
|
|
53 |
1. The env-var `EASYRSA_SSL_CONF`
|
|
|
54 |
2. The 'vars' file (see `vars Autodetection` above)
|
|
|
55 |
3. The `EASYRSA_PKI` directory with a filename of `openssl-easyrsa.cnf`
|
|
|
56 |
4. The `EASYRSA` directory with a filename of `openssl-easyrsa.cnf`
|
|
|
57 |
|
|
|
58 |
Advanced extension handling
|
|
|
59 |
---------------------------
|
|
|
60 |
|
|
|
61 |
Normally the cert extensions are selected by the cert type given on the CLI
|
|
|
62 |
during signing; this causes the matching file in the x509-types subdirectory to
|
|
|
63 |
be processed for OpenSSL extensions to add. This can be overridden in a
|
|
|
64 |
particular PKI by placing another x509-types dir inside the `EASYRSA_PKI` dir
|
|
|
65 |
which will be used instead.
|
|
|
66 |
|
|
|
67 |
The file named `COMMON` in the x509-types dir is appended to every cert type;
|
|
|
68 |
this is designed for CDP usage, but can be used for any extension that should
|
|
|
69 |
apply to every signed cert.
|
|
|
70 |
|
|
|
71 |
Additionally, the contents of the env-var `EASYRSA_EXTRA_EXTS` is appended with
|
|
|
72 |
its raw text added to the OpenSSL extensions. The contents are appended as-is to
|
|
|
73 |
the cert extensions; invalid OpenSSL configs will usually result in failure.
|
|
|
74 |
|
|
|
75 |
Environmental Variables Reference
|
|
|
76 |
---------------------------------
|
|
|
77 |
|
|
|
78 |
A list of env-vars, any matching global option (CLI) to set/override it, and a
|
|
|
79 |
possible terse description is shown below:
|
|
|
80 |
|
|
|
81 |
* `EASYRSA` - should point to the Easy-RSA top-level dir, where the easyrsa script is located.
|
|
|
82 |
* `EASYRSA_OPENSSL` - command to invoke openssl
|
|
|
83 |
* `EASYRSA_SSL_CONF` - the openssl config file to use
|
|
|
84 |
* `EASYRSA_PKI` (CLI: `--pki-dir`) - dir to use to hold all PKI-specific files, defaults to $PWD/pki.
|
|
|
85 |
* `EASYRSA_DN` (CLI: `--dn-mode`) - set to the string `cn_only` or `org` to
|
|
|
86 |
alter the fields to include in the req DN
|
|
|
87 |
* `EASYRSA_REQ_COUNTRY` (CLI: `--req-c`) - set the DN country with org mode
|
|
|
88 |
* `EASYRSA_REQ_PROVINCE` (CLI: `--req-st`) - set the DN state/province with
|
|
|
89 |
org mode
|
|
|
90 |
* `EASYRSA_REQ_CITY` (CLI: `--req-city`) - set the DN city/locality with org
|
|
|
91 |
mode
|
|
|
92 |
* `EASYRSA_REQ_ORG` (CLI: `--req-org`) - set the DN organization with org mode
|
|
|
93 |
* `EASYRSA_REQ_EMAIL` (CLI: `--req-email`) - set the DN email with org mode
|
|
|
94 |
* `EASYRSA_REQ_OU` (CLI: `--req-ou`) - set the DN organizational unit with org
|
|
|
95 |
mode
|
|
|
96 |
* `EASYRSA_KEY_SIZE` (CLI: `--key-size`) - set the keysize in bits to generate
|
|
|
97 |
* `EASYRSA_ALGO` (CLI: `--use-algo`) - set the crypto alg to use: rsa or ec
|
|
|
98 |
* `EASYRSA_CURVE` (CLI: `--curve`) - define the named EC curve to use
|
|
|
99 |
* `EASYRSA_EC_DIR` - dir to store generated ecparams
|
|
|
100 |
* `EASYRSA_CA_EXPIRE` (CLI: `--days`) - set the CA expiration time in days
|
|
|
101 |
* `EASYRSA_CERT_EXPIRE` (CLI: `--days`) - set the issued cert expiration time
|
|
|
102 |
in days
|
|
|
103 |
* `EASYRSA_CRL_DAYS` (CLI: `--days`) - set the CRL 'next publish' time in days
|
|
|
104 |
* `EASYRSA_NS_SUPPORT` (CLI: `--ns-cert`) - string 'yes' or 'no' fields to
|
|
|
105 |
include the deprecated Netscape extensions
|
|
|
106 |
* `EASYRSA_NS_COMMENT` (CLI: `--ns-comment`) - string comment to include when
|
|
|
107 |
using the deprecated Netscape extensions
|
|
|
108 |
* `EASYRSA_TEMP_FILE` - a temp file to use when dynamically creating req/cert
|
|
|
109 |
extensions
|
|
|
110 |
* `EASYRSA_REQ_CN` (CLI: `--req-cn`) - default CN, necessary to set in BATCH
|
|
|
111 |
mode
|
|
|
112 |
* `EASYRSA_DIGEST` (CLI: `--digest`) - set a hash digest to use for req/cert
|
|
|
113 |
signing
|
|
|
114 |
* `EASYRSA_BATCH` (CLI: `--batch`) - enable batch (no-prompt) mode; set
|
|
|
115 |
env-var to non-zero string to enable (CLI takes no options)
|
|
|
116 |
* `EASYRSA_PASSIN` (CLI: `--passin`) - allows to specify a source for password;
|
|
|
117 |
using any openssl password options like pass:1234 or env:var
|
|
|
118 |
* `EASYRSA_PASSOUT` (CLI: `--passout`) - allows to specify a source for password;
|
|
|
119 |
using any openssl password options like pass:1234 or env:var
|