Fix: PIA_ENCRYPTION default value outside Docker

- Defaults to `strong` instead of strong certificate string
- No impact on Docker images since variable is set to `strong` in Dockerfile
- Only read `PIA_ENCRYPTION` if service provider is PIA
This commit is contained in:
Quentin McGaw (desktop)
2021-09-09 21:36:14 +00:00
parent 65ace12def
commit 094de89a3e
2 changed files with 3 additions and 6 deletions

View File

@@ -158,14 +158,11 @@ func (settings *OpenVPN) read(r reader, serviceProvider string) (err error) {
return err return err
} }
settings.EncPreset, err = getPIAEncryptionPreset(r)
if err != nil {
return err
}
switch serviceProvider { switch serviceProvider {
case constants.Cyberghost: case constants.Cyberghost:
err = settings.readCyberghost(r) err = settings.readCyberghost(r)
case constants.PrivateInternetAccess:
settings.EncPreset, err = getPIAEncryptionPreset(r)
case constants.VPNUnlimited: case constants.VPNUnlimited:
err = settings.readVPNUnlimited(r) err = settings.readVPNUnlimited(r)
} }

View File

@@ -65,7 +65,7 @@ func getPIAEncryptionPreset(r reader) (encryptionPreset string, err error) {
encryptionPreset, err = r.env.Inside("PIA_ENCRYPTION", encryptionPreset, err = r.env.Inside("PIA_ENCRYPTION",
[]string{constants.PIAEncryptionPresetNone, constants.PIAEncryptionPresetNormal, constants.PIAEncryptionPresetStrong}, []string{constants.PIAEncryptionPresetNone, constants.PIAEncryptionPresetNormal, constants.PIAEncryptionPresetStrong},
params.RetroKeys([]string{"ENCRYPTION"}, r.onRetroActive), params.RetroKeys([]string{"ENCRYPTION"}, r.onRetroActive),
params.Default(constants.PIACertificateStrong), params.Default(constants.PIAEncryptionPresetStrong),
) )
if err != nil { if err != nil {
return "", fmt.Errorf("environment variable PIA_ENCRYPTION: %w", err) return "", fmt.Errorf("environment variable PIA_ENCRYPTION: %w", err)