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

View File

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