diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-09-17 19:42:27 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-11-23 21:51:04 +0100 |
commit | 7cdbe15b46a2c2ac94b10f27092b190147f2124f (patch) | |
tree | f1728d5576b6a88846e3e7db48b66419bd5ad8d8 /pkg/vpn/openvpn.go | |
parent | a8ab7bb56fd05bb0f193b10034057abaa88936e2 (diff) |
[bug] do not use port 53 for the time being
Diffstat (limited to 'pkg/vpn/openvpn.go')
-rw-r--r-- | pkg/vpn/openvpn.go | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/pkg/vpn/openvpn.go b/pkg/vpn/openvpn.go index fe10b69..e2695a3 100644 --- a/pkg/vpn/openvpn.go +++ b/pkg/vpn/openvpn.go @@ -149,6 +149,7 @@ func (b *Bitmask) startOpenVPN() error { arg = append(arg, "--route", gw.IPAddress, "255.255.255.255", "net_gateway") } else { arg = b.openvpnArgs + log.Println("args passed to bitmask-root:", arg) gateways, err := b.bonafide.GetGateways("openvpn") if err != nil { return err @@ -160,11 +161,12 @@ func (b *Bitmask) startOpenVPN() error { for _, gw := range gateways { for _, port := range gw.Ports { - - if os.Getenv("UDP") == "1" && port != "53" { - arg = append(arg, "--remote", gw.IPAddress, port, "udp4") - } else { - arg = append(arg, "--remote", gw.IPAddress, port, "tcp4") + if port != "53" { + if os.Getenv("UDP") == "1" { + arg = append(arg, "--remote", gw.IPAddress, port, "udp4") + } else { + arg = append(arg, "--remote", gw.IPAddress, port, "tcp4") + } } } } @@ -182,6 +184,7 @@ func (b *Bitmask) startOpenVPN() error { } func (b *Bitmask) getCert() (certPath string, err error) { + log.Println("Getting certificate...") failed := false persistentCertFile := filepath.Join(config.Path, strings.ToLower(config.Provider)+".pem") if _, err := os.Stat(persistentCertFile); !os.IsNotExist(err) && isValidCert(persistentCertFile) { @@ -302,12 +305,17 @@ func (b *Bitmask) ReloadFirewall() error { // GetStatus returns the VPN status func (b *Bitmask) GetStatus() (string, error) { - status, err := b.getOpenvpnState() - if err != nil { - status = Off - } - if status == Off && b.launch.firewallIsUp() { - return Failed, nil + status := Off + if b.isFailed() { + status = Failed + } else { + status, err := b.getOpenvpnState() + if err != nil { + status = Off + } + if status == Off && b.launch.firewallIsUp() { + return Failed, nil + } } return status, nil } |