- `OPENVPN_ENCRYPTED_KEY` environment variable - `OPENVPN_ENCRYPTED_KEY_SECRETFILE` environment variable - `OPENVPN_KEY_PASSPHRASE` environment variable - `OPENVPN_KEY_PASSPHRASE_SECRETFILE` environment variable - `PREMIUM_ONLY` environment variable - OpenVPN user and password not required for vpnsecure provider
35 lines
936 B
Go
35 lines
936 B
Go
package files
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
|
)
|
|
|
|
const (
|
|
// OpenVPNClientKeyPath is the OpenVPN client key filepath.
|
|
OpenVPNClientKeyPath = "/gluetun/client.key"
|
|
// OpenVPNClientCertificatePath is the OpenVPN client certificate filepath.
|
|
OpenVPNClientCertificatePath = "/gluetun/client.crt"
|
|
openVPNEncryptedKey = "/gluetun/openvpn_encrypted_key"
|
|
)
|
|
|
|
func (r *Reader) readOpenVPN() (settings settings.OpenVPN, err error) {
|
|
settings.Key, err = ReadFromFile(OpenVPNClientKeyPath)
|
|
if err != nil {
|
|
return settings, fmt.Errorf("client key: %w", err)
|
|
}
|
|
|
|
settings.Cert, err = ReadFromFile(OpenVPNClientCertificatePath)
|
|
if err != nil {
|
|
return settings, fmt.Errorf("client certificate: %w", err)
|
|
}
|
|
|
|
settings.EncryptedKey, err = ReadFromFile(openVPNEncryptedKey)
|
|
if err != nil {
|
|
return settings, fmt.Errorf("reading encrypted key file: %w", err)
|
|
}
|
|
|
|
return settings, nil
|
|
}
|