OPENVPN_AUTH variable, refers to #94

This commit is contained in:
Quentin McGaw
2020-03-29 16:22:21 -04:00
committed by GitHub
parent 3d6a580102
commit 643745d33e
11 changed files with 46 additions and 31 deletions

View File

@@ -16,6 +16,7 @@ type OpenVPN struct {
Root bool
TargetIP net.IP
Cipher string
Auth string
}
// GetOpenVPNSettings obtains the OpenVPN settings using the params functions
@@ -40,6 +41,10 @@ func GetOpenVPNSettings(params params.ParamsReader) (settings OpenVPN, err error
if err != nil {
return settings, err
}
settings.Auth, err = params.GetOpenVPNAuth()
if err != nil {
return settings, err
}
return settings, nil
}
@@ -55,6 +60,7 @@ func (o *OpenVPN) String() string {
"Run as root: " + runAsRoot,
"Target IP address: " + o.TargetIP.String(),
"Custom cipher: " + o.Cipher,
"Custom auth algorithm: " + o.Auth,
}
return strings.Join(settingsList, "\n|--")
}

View File

@@ -57,6 +57,11 @@ func GetAllSettings(params params.ParamsReader) (settings Settings, err error) {
default:
return settings, fmt.Errorf("cipher %q is not supported by Private Internet Access", settings.OpenVPN.Cipher)
}
switch settings.OpenVPN.Auth {
case "", "sha1", "sha256":
default:
return settings, fmt.Errorf("auth algorithm %q is not supported by Private Internet Access", settings.OpenVPN.Auth)
}
settings.PIA, err = GetPIASettings(params)
case "mullvad":
switch settings.OpenVPN.Cipher {
@@ -64,6 +69,11 @@ func GetAllSettings(params params.ParamsReader) (settings Settings, err error) {
default:
return settings, fmt.Errorf("cipher %q is not supported by Mullvad", settings.OpenVPN.Cipher)
}
switch settings.OpenVPN.Auth {
case "":
default:
return settings, fmt.Errorf("auth algorithm %q is not supported by Mullvad (not using auth at all)", settings.OpenVPN.Auth)
}
settings.Mullvad, err = GetMullvadSettings(params)
default:
return settings, fmt.Errorf("VPN service provider %q is not valid", settings.VPNSP)