Ejemplo n.º 1
0
def test_vpn():
    remotes = (  # XXX HACK picked manually from eip-service.json
        ("198.252.153.84", "1194"),
        ("46.165.242.169", "1194"),
    )

    prefix = os.path.join(get_path_prefix(),
                          "leap/providers/demo.bitmask.net/keys")
    cert_path = key_path = prefix + "/client/openvpn.pem"
    ca_path = prefix + "/ca/cacert.pem"

    extra_flags = {
        "auth": "SHA1",
        "cipher": "AES-128-CBC",
        "keepalive": "10 30",
        "tls-cipher": "DHE-RSA-AES128-SHA",
        "tun-ipv6": "true",
    }

    vpn = VPNManager(remotes, cert_path, key_path, ca_path, extra_flags)

    print("VPN: starting...")
    vpn_ok = vpn.start()
    if vpn_ok:
        print("VPN: started")
    else:
        print("VPN: Error starting.")
        return

    return
    wait(1)
    print "VPN: is up? -> " + str(vpn.is_up())
    wait(3)
    print("VPN: stopping...")
    vpn_ok = vpn.stop()
    print("VPN: stopped.")
    wait(1)
    print "VPN: is up? -> " + str(vpn.is_up())
Ejemplo n.º 2
0
 def __init__(self, remotes, cert, key, ca, flags):
     """
     """
     self._firewall = FirewallManager(remotes)
     self._vpn = VPNManager(remotes, cert, key, ca, flags)