Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vars: Prohibit use of export and unset in vars file #932

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 17 additions & 5 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -5021,24 +5021,36 @@ Using Easy-RSA configuration:
# Sanitize vars
if grep -q \
-e 'EASYRSA_PASSIN' -e 'EASYRSA_PASSOUT' \
-e '^[^#]*export *_*[[:alpha:]]*[[:alnum:]]*.*$' \
-e '[^(]`[^)]' "$vars"
-e '[^(]`[^)]' \
"$vars"
then
die "\
One or more of these problems has been found in your 'vars' file:

* Use of 'EASYRSA_PASSIN' or 'EASYRSA_PASSOUT':
Storing password information in the 'vars' file is not permitted.

* Use of 'export':
Remove 'export' or replace it with 'set_var'.

* Use of unsupported characters:
These characters are not supported: \` backtick

Please, correct these errors and try again."
fi

if grep -q \
-e '[[:blank:]]export[[:blank:]]' \
-e '[[:blank:]]unset[[:blank:]]' \
"$vars"
then
warn "\
One or more of these problems has been found in your 'vars' file:

* Use of 'export':
Remove 'export' or replace it with 'set_var'.

* Use of 'unset':
Remove 'unset' ('force_set_var' may also work)."
fi

# Enable sourcing 'vars'
# shellcheck disable=SC2034 # appears unused
EASYRSA_CALLER=1
Expand Down