Skip to content

Commit

Permalink
Integrate automatic TLS Key use into inline files
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Jul 7, 2024
1 parent 588042b commit a3eb4b2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dev/easyrsa-tools.lib
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ tls_key_gen() {
Cannot overwrite existing $tls_key_type Key:
* $tls_key_file
If this file is changed then it MUST be distributed to ALL servers
AND clients to be in effect. You should NOT change the existing file."
If this file is changed then it MUST be redistributed to ALL servers
AND clients, to be in effect. Do NOT change the existing file."
fi

# Generate TLS Key
Expand Down
17 changes: 17 additions & 0 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -2952,6 +2952,7 @@ inline_creds() {
crt_source="${EASYRSA_PKI}/issued/${1}.crt"
key_source="${EASYRSA_PKI}/private/${1}.key"
ca_source="$EASYRSA_PKI/ca.crt"
tls_source="${EASYRSA_PKI}"/inline/easyrsa-tls.inline
incomplete=0

# Generate data
Expand Down Expand Up @@ -3036,6 +3037,20 @@ $(cat "$ca_source")
fi
fi

# TLS auth|crypt key
if [ "$EASYRSA_AUTO_TLS_AUTH" ] || \
[ "$EASYRSA_AUTO_TLS_CRYPT" ]
then
if [ -f "$tls_source" ]; then
tls_data="$(cat "$tls_source")"
else
incomplete=1
tls_data="# Easy-RSA TLS Key not found!"
fi
else
tls_data="# Easy-RSA TLS Key not enabled!"
fi

# Print data
print "\
# Easy-RSA Type: $type_data
Expand All @@ -3047,6 +3062,8 @@ $crt_data
$key_data

$ca_data

$tls_data
"
# If inline file is incomplete then return error
return "$incomplete"
Expand Down

0 comments on commit a3eb4b2

Please sign in to comment.