Skip to content

Commit

Permalink
Merge pull request #167 from MysteriumNetwork/feature/MYST-355-limit-…
Browse files Browse the repository at this point in the history
…openvpn-client-reconnects

MYST 355: limit openvpn client reconnects
  • Loading branch information
zolia committed Feb 21, 2018
2 parents cedbf08 + 0039575 commit 80125c4
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 169 deletions.
19 changes: 0 additions & 19 deletions bin/server_package/config/ca.crt

This file was deleted.

10 changes: 0 additions & 10 deletions bin/server_package/config/crl.pem

This file was deleted.

8 changes: 0 additions & 8 deletions bin/server_package/config/dh.pem

This file was deleted.

83 changes: 0 additions & 83 deletions bin/server_package/config/server.crt

This file was deleted.

28 changes: 0 additions & 28 deletions bin/server_package/config/server.key

This file was deleted.

21 changes: 0 additions & 21 deletions bin/server_package/config/ta.key

This file was deleted.

1 change: 1 addition & 0 deletions location/detector_test.go
Expand Up @@ -16,6 +16,7 @@ func TestDetectorDetectCountry(t *testing.T) {
{"95.85.39.36", "NL", ""},
{"127.0.0.1", "", ""},
{"8.8.8.8.8", "", "failed to parse IP"},
{"185.243.112.225", "", ""},
{"asd", "", "failed to parse IP"},
}

Expand Down
8 changes: 8 additions & 0 deletions openvpn/config.go
Expand Up @@ -60,6 +60,14 @@ func (c *Config) SetTLSCrypt(cryptFile string) {
c.AddOptions(OptionFile("tls-crypt", cryptFile))
}

// RestrictReconnects describes conditions which enforces client to close a session in case of failed authentication
func (c *Config) RestrictReconnects() {
c.setParam("connect-retry-max", "2")
c.setParam("remap-usr1", "SIGTERM")
c.setFlag("single-session")
c.setFlag("tls-exit")
}

func (c *Config) SetKeepAlive(interval, timeout int) {
c.setParam("keepalive", strconv.Itoa(interval)+" "+strconv.Itoa(timeout))
}
Expand Down
1 change: 1 addition & 0 deletions openvpn/factory.go
Expand Up @@ -40,6 +40,7 @@ func NewClientConfig(
config.SetClientMode(remote, 1194)
config.SetTLSCACertificate(caCertPath)
config.SetTLSCrypt(tlsCryptKeyPath)
config.RestrictReconnects()

config.SetDevice("tun")
config.setParam("cipher", "AES-256-GCM")
Expand Down

0 comments on commit 80125c4

Please sign in to comment.