2021-05-11 17:10:51 +00:00
|
|
|
package vyprvpn
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-19 14:09:41 +00:00
|
|
|
func (v *Vyprvpn) BuildConf(connection models.Connection,
|
2021-09-13 11:30:14 -04:00
|
|
|
settings configuration.OpenVPN) (lines []string, err error) {
|
2021-05-11 17:10:51 +00:00
|
|
|
if settings.Cipher == "" {
|
|
|
|
|
settings.Cipher = constants.AES256cbc
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if settings.Auth == "" {
|
|
|
|
|
settings.Auth = constants.SHA256
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lines = []string{
|
|
|
|
|
"client",
|
2021-08-20 01:13:04 +00:00
|
|
|
"dev " + settings.Interface,
|
2021-05-11 17:10:51 +00:00
|
|
|
"nobind",
|
|
|
|
|
"persist-key",
|
|
|
|
|
"remote-cert-tls server",
|
|
|
|
|
"ping 10",
|
|
|
|
|
"ping-exit 60",
|
|
|
|
|
"ping-timer-rem",
|
|
|
|
|
"tls-exit",
|
|
|
|
|
|
|
|
|
|
// Vyprvpn specific
|
|
|
|
|
"comp-lzo",
|
|
|
|
|
// "verify-x509-name lu1.vyprvpn.com name",
|
|
|
|
|
"tls-cipher TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA", //nolint:lll
|
|
|
|
|
|
|
|
|
|
// Added constant values
|
|
|
|
|
"auth-nocache",
|
|
|
|
|
"mute-replay-warnings",
|
|
|
|
|
"pull-filter ignore \"auth-token\"", // prevent auth failed loops
|
|
|
|
|
"auth-retry nointeract",
|
|
|
|
|
"suppress-timestamps",
|
|
|
|
|
|
|
|
|
|
// Modified variables
|
|
|
|
|
"verb " + strconv.Itoa(settings.Verbosity),
|
|
|
|
|
"auth-user-pass " + constants.OpenVPNAuthConf,
|
2021-08-19 14:09:41 +00:00
|
|
|
connection.OpenVPNProtoLine(),
|
|
|
|
|
connection.OpenVPNRemoteLine(),
|
2021-05-11 17:10:51 +00:00
|
|
|
"auth " + settings.Auth,
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-23 17:40:14 +00:00
|
|
|
lines = append(lines, utils.CipherLines(settings.Cipher, settings.Version)...)
|
|
|
|
|
|
2021-05-11 17:10:51 +00:00
|
|
|
if !settings.Root {
|
2021-08-18 16:16:47 +00:00
|
|
|
lines = append(lines, "user "+settings.ProcUser)
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if settings.MSSFix > 0 {
|
|
|
|
|
lines = append(lines, "mssfix "+strconv.Itoa(int(settings.MSSFix)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lines = append(lines, utils.WrapOpenvpnCA(
|
|
|
|
|
constants.VyprvpnCertificate)...)
|
|
|
|
|
|
|
|
|
|
lines = append(lines, "")
|
|
|
|
|
|
2021-09-13 11:30:14 -04:00
|
|
|
return lines, nil
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|