TinCanTech / easy-tls

Manage and Inline OpenVPN TLS keys and Easy-RSA PKI credentials. Supports OpenVPN TLS-Crypt-V2 key system and OpenVPN Peer-Fingerprint mode.
GNU General Public License v2.0
87 stars 19 forks source link

Refactor inline functions to not need to pass unquoted `$cmd_opts` #266

Closed TinCanTech closed 2 years ago

TinCanTech commented 2 years ago

The variable cmd_opts found here: https://github.com/TinCanTech/easy-tls/blob/bf6dcb4e0d7295f345f7e1243b62759dc6aa7895/easytls#L3574 must be used unquoted, otherwise the elements are passed as one.

Rework this so that, cmd_opts is only processed from command line and not internally. When inline_xyz() calls inline_base() the elements of cmd_opts should only be set by the caller.

So inline_tls_auth() would setup variables for:

            no-key) no_x509_key=1 ;;
            add-dh) inline_dh_file=1 ;;

And not pass this: inline_base "${name}" ${cmd_opts} || die "Failed to create inline base file"

But instead pass this: inline_base "${name}" || die "Failed to create inline base file"

inline_base() does not have to re-interpret cmd_opts.

This could also allow to expose inline_base() for user use, by having inline_base() have two caller methods;

TinCanTech commented 2 years ago

Closed via https://github.com/TinCanTech/easy-tls/commit/e50c132309677ccd1d4fcaab02c7d353fd88de02