OPENVPN_CIPHER variable (#100), refers to #94 and #59

This commit is contained in:
Quentin McGaw
2020-03-26 20:29:32 -04:00
committed by GitHub
parent d534f92432
commit 15a549be11
9 changed files with 37 additions and 11 deletions

View File

@@ -35,10 +35,13 @@ func (c *configurator) GetOpenVPNConnections(country models.MullvadCountry, city
return connections, nil
}
func (c *configurator) BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool) (err error) {
func (c *configurator) BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool, cipher string) (err error) {
if len(connections) == 0 {
return fmt.Errorf("at least one connection string is expected")
}
if len(cipher) == 0 {
cipher = "AES-256-CBC"
}
lines := []string{
"client",
"dev tun",
@@ -53,7 +56,6 @@ func (c *configurator) BuildConf(connections []models.OpenVPNConnection, verbosi
// Mullvad specific
"sndbuf 524288",
"rcvbuf 524288",
"cipher AES-256-CBC",
"tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA",
// Added constant values
@@ -67,6 +69,7 @@ func (c *configurator) BuildConf(connections []models.OpenVPNConnection, verbosi
fmt.Sprintf("verb %d", verbosity),
fmt.Sprintf("auth-user-pass %s", constants.OpenVPNAuthConf),
fmt.Sprintf("proto %s", string(connections[0].Protocol)),
fmt.Sprintf("cipher %s", cipher),
}
if !root {
lines = append(lines, "user nonrootuser")