Feature: Support none encryption preset for PIA
This commit is contained in:
@@ -13,16 +13,22 @@ import (
|
||||
func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
username string, settings configuration.OpenVPN) (lines []string) {
|
||||
var defaultCipher, defaultAuth, X509CRL, certificate string
|
||||
if settings.Provider.ExtraConfigOptions.EncryptionPreset == constants.PIAEncryptionPresetNormal {
|
||||
switch settings.Provider.ExtraConfigOptions.EncryptionPreset {
|
||||
case constants.PIAEncryptionPresetNormal:
|
||||
defaultCipher = constants.AES128cbc
|
||||
defaultAuth = constants.SHA1
|
||||
X509CRL = constants.PiaX509CRLNormal
|
||||
certificate = constants.PIACertificateNormal
|
||||
} else { // strong encryption
|
||||
case constants.PIAEncryptionPresetStrong:
|
||||
defaultCipher = constants.AES256cbc
|
||||
defaultAuth = constants.SHA256
|
||||
X509CRL = constants.PiaX509CRLStrong
|
||||
certificate = constants.PIACertificateStrong
|
||||
default: // no encryption preset
|
||||
defaultCipher = ""
|
||||
defaultAuth = ""
|
||||
X509CRL = constants.PiaX509CRLNormal
|
||||
certificate = constants.PIACertificateNormal
|
||||
}
|
||||
|
||||
if settings.Cipher == "" {
|
||||
@@ -57,10 +63,15 @@ func (p *PIA) BuildConf(connection models.OpenVPNConnection,
|
||||
"auth-user-pass " + constants.OpenVPNAuthConf,
|
||||
connection.ProtoLine(),
|
||||
connection.RemoteLine(),
|
||||
"auth " + settings.Auth,
|
||||
}
|
||||
|
||||
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
||||
if settings.Cipher != "" {
|
||||
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
||||
}
|
||||
|
||||
if settings.Auth != "" {
|
||||
lines = append(lines, "auth "+settings.Auth)
|
||||
}
|
||||
|
||||
if strings.HasSuffix(settings.Cipher, "-gcm") {
|
||||
lines = append(lines, "ncp-disable")
|
||||
|
||||
@@ -23,14 +23,14 @@ func getPort(tcp bool, encryptionPreset string, customPort uint16) (
|
||||
func getDefaultPort(tcp bool, encryptionPreset string) (port uint16) {
|
||||
if tcp {
|
||||
switch encryptionPreset {
|
||||
case constants.PIAEncryptionPresetNormal:
|
||||
case constants.PIAEncryptionPresetNone, constants.PIAEncryptionPresetNormal:
|
||||
port = 502
|
||||
case constants.PIAEncryptionPresetStrong:
|
||||
port = 501
|
||||
}
|
||||
} else {
|
||||
switch encryptionPreset {
|
||||
case constants.PIAEncryptionPresetNormal:
|
||||
case constants.PIAEncryptionPresetNone, constants.PIAEncryptionPresetNormal:
|
||||
port = 1198
|
||||
case constants.PIAEncryptionPresetStrong:
|
||||
port = 1197
|
||||
|
||||
Reference in New Issue
Block a user