hotfix(settings): openvpn encrypted key reading from file

This commit is contained in:
Quentin McGaw
2024-04-08 07:40:14 +00:00
parent 6709a248d6
commit 7b4befce61
2 changed files with 6 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ func (s *Source) Get(key string) (value string, isSet bool) {
// Special file handling
switch key {
// TODO timezone from /etc/localtime
case "client.crt", "client.key":
case "client.crt", "client.key", "openvpn_encrypted_key":
value, isSet, err := ReadPEMFile(path)
if err != nil {
s.warner.Warnf("skipping %s: parsing PEM: %s", path, err)
@@ -85,6 +85,8 @@ func (s *Source) KeyTransform(key string) string {
return "client.key"
case "OPENVPN_CERT":
return "client.crt"
case "OPENVPN_ENCRYPTED_KEY":
return "openvpn_encrypted_key"
default:
key = strings.ToLower(key) // HTTPROXY_USER -> httpproxy_user
return key

View File

@@ -54,7 +54,7 @@ func (s *Source) Get(key string) (value string, isSet bool) {
// Special file parsing
switch key {
// TODO timezone from /etc/localtime
case "openvpn_clientcrt", "openvpn_clientkey":
case "openvpn_clientcrt", "openvpn_clientkey", "openvpn_encrypted_key":
value, isSet, err := files.ReadPEMFile(path)
if err != nil {
s.warner.Warnf("skipping %s: parsing PEM: %s", path, err)
@@ -97,6 +97,8 @@ func (s *Source) KeyTransform(key string) string {
return "openvpn_clientkey"
case "OPENVPN_CERT":
return "openvpn_clientcrt"
case "OPENVPN_ENCRYPTED_KEY":
return "openvpn_encrypted_key"
default:
key = strings.ToLower(key) // HTTPROXY_USER -> httpproxy_user
return key