-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hardcode openvpn endpoints under ooni infra
changing the experiment as per request, to satisfy reqs for shipping the experiment in time for Aug 2024 release. Initially I had some concerns about this approach, but it seems to work as long it's ensured that the server has `duplicate-cn` key in its config. For what we saw from real-data, the order of magnitude of expected probes executing the experimental card is in the range of 100 per period of 5 minutes.
- Loading branch information
Showing
4 changed files
with
118 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package openvpn | ||
|
||
import ( | ||
"fmt" | ||
"math/rand" | ||
"net" | ||
) | ||
|
||
const defaultOpenVPNEndpoint = "openvpn-server1.ooni.io" | ||
|
||
// this is a safety toggle: it's on purpose that the experiment will receive no | ||
// input if the resolution fails. This also implies that we have no way of knowing if this | ||
// target has been blocked at the level of DNS. | ||
// TODO(ain,mehul): we might want to try resolving with other techniques (DoT etc), | ||
// and perhaps also transform DNS failure into a specific failure of the experiment, not | ||
// a skip. | ||
// TODO(ain): update the openvpn spec to reflect the CURRENT state of delivering the targets. | ||
func resolveTarget() (string, error) { | ||
ips, err := net.LookupIP(defaultOpenVPNEndpoint) | ||
if err != nil { | ||
return "", err | ||
} | ||
if len(ips) == 0 { | ||
return "", fmt.Errorf("cannot resolve %v", defaultOpenVPNEndpoint) | ||
} | ||
return ips[0].String(), nil | ||
} | ||
|
||
func defaultOONITargetURL(ip string) string { | ||
return "openvpn://oonivpn.corp/?address=" + ip + ":1194" | ||
} | ||
|
||
func defaultOONIOpenVPNTargetUDP() (string, error) { | ||
ip, err := resolveTarget() | ||
if err != nil { | ||
return "", err | ||
} | ||
return defaultOONITargetURL(ip) + "&transport=udp", nil | ||
} | ||
|
||
func defaultOONIOpenVPNTargetTCP() (string, error) { | ||
ip, err := resolveTarget() | ||
if err != nil { | ||
return "", err | ||
} | ||
return defaultOONITargetURL(ip) + "&transport=tcp", nil | ||
} | ||
|
||
func pickFromDefaultOONIOpenVPNConfig() *Config { | ||
idx := rand.Intn(len(defaultOONIOpenVPNConfig)) | ||
return defaultOONIOpenVPNConfig[idx] | ||
} | ||
|
||
var defaultCA = "-----BEGIN CERTIFICATE-----\nMIIDSzCCAjOgAwIBAgIUOPlwhp2s96qqGF5zgLOp0noN2uwwDQYJKoZIhvcNAQEL\nBQAwFjEUMBIGA1UEAwwLRWFzeS1SU0EgQ0EwHhcNMjQwNzMxMTc1MDI3WhcNMzQw\nNzI5MTc1MDI3WjAWMRQwEgYDVQQDDAtFYXN5LVJTQSBDQTCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBALfhmQ6YndIaq9K2ya1HNv9e3DiwKO8X7Ferh8KV\n/Yobs1jPJYfK/l1SZTO97FnIptqxPzGAWuxhS/+4n4ZB2RpszJKdu3sHYNY6lZCR\nw8dtxKYDIS5v/1by6AJk052wV3NWizw1QiawCOJl5cNN5Vb4OpLPvBzrx3IN7jvO\n0HxaaRYIiPdQy++cJ/wqQazTvPYpws0rIAF0A9jxzgsJZoWshg8MhQm9OYIMyZ2C\n4WeuBKU5bR7vqjAQnVH6ZsZ8ZX1UILq++PcuLeDYbg7M5YmT0v0SO+3ealgg48SO\nxqStAawEAXI2sOZqWTvFfXiq9l6Uw2uxPwXnzSO8hjjVqc0CAwEAAaOBkDCBjTAM\nBgNVHRMEBTADAQH/MB0GA1UdDgQWBBRyvhkgys8dIIzvcH7+TlcATT6bGTBRBgNV\nHSMESjBIgBRyvhkgys8dIIzvcH7+TlcATT6bGaEapBgwFjEUMBIGA1UEAwwLRWFz\neS1SU0EgQ0GCFDj5cIadrPeqqhhec4CzqdJ6DdrsMAsGA1UdDwQEAwIBBjANBgkq\nhkiG9w0BAQsFAAOCAQEAPpb2z/wBj9tULuzBQ1j6qkIUCkyH6e+QATHcCcJGWQsU\naeEc1w/qBXaJcRS0ahALXC3d/Tz8R2dAj1sO1HEsfjEs5fv1dKGgeVb1rNuZuUW8\n9xEtUdp3jL3xumcqfxKIwOv8Y1fz+AKGJbbPC3yoHptwMDW9zyaRTQ+McKE7Y497\nFZDF2RWQjgpxwCi7P3cScNBLNtt42TPnj6Up3D6Sj57YVDK9dXbrDj94bwmkQa8s\nl8Mp/PFaFeLNXXuGGVEbIlFuw9RY32vbJ1CrS9rrWlVq9Q17NrAmSYSBi9T19mDh\nMFslRMPBN4Jfd/45V26iW2XMpWCONY5aqAfx+2Oz2g==\n-----END CERTIFICATE-----" | ||
var defaultOONIOpenVPNConfig = []*Config{ | ||
{ | ||
Cipher: "AES-256-GCM", | ||
Auth: "SHA512", | ||
Compress: "stub", | ||
Provider: "oonivpn", | ||
Obfuscation: "none", | ||
// yes, github, I know this looks like a leaked certificate. That is exactly what it is. | ||
SafeCA: defaultCA, | ||
SafeCert: "-----BEGIN CERTIFICATE-----\nMIIDXjCCAkagAwIBAgIRALM/5njrVcneGXfmqnIX278wDQYJKoZIhvcNAQELBQAw\nFjEUMBIGA1UEAwwLRWFzeS1SU0EgQ0EwHhcNMjQwNzMxMTc1MjAxWhcNMjYxMTAz\nMTc1MjAxWjAaMRgwFgYDVQQDDA9jbGllbnQtY2VydC0wMDIwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQDfVfY+RK1Wl4Dw+KPJMOu7UT4g8VoWS0r5B3z8\nqzL/RAL9xEMaeJbeJPCkOCMaPiS5Xyuj2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X+8avCOJb9bDIWoXbp7F8JdQihf4cMHpKnupYzYYH6DDA\njmZS7TQmjVqbNMNj19+mAb0cU7UB3Kn6QI0O/71rES/T8hV/63ukLCidzQKBgGPJ\nEUXFPILfWXE6mTU+RWbcCNIAq4V/ZcYTtsxKrxPSOYpiQc7olzNz6VHe5dTNNu8t\nJeDobdbtAR7WXbaonzWjU71oEGIAzjA88xL3eLhn7BT6iOCz5fKknfnOh4CEBzv7\nN6BmdVNO1bnBCXzPHSdk209xPYYUcc834vIKv/QzAoGAaciaMwabaecjjZPgUtCq\n+0hE6yWg8YQ7t60+jA8IanU29vpXVFJKr/yTgnExde96sD3POxBln8F2R2tHZK0Z\nR+BFhw5TUzDuSgQJRmhskbcR7u70I39fgm5G0ed9Qt5tx7bl32r9OGxMiWY6yGb+\nabwHOfqbU+03upE8+Of17sg=\n-----END PRIVATE KEY-----", | ||
}, | ||
{ | ||
Cipher: "AES-256-GCM", | ||
Auth: "SHA512", | ||
Compress: "stub", | ||
Provider: "oonivpn", | ||
Obfuscation: "none", | ||
// yes, github, I know this looks like a leaked certificate. That is exactly what it is. | ||
SafeCA: defaultCA, | ||
SafeCert: "-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIQFiJOrUbahl4vlYa6xv7SmzANBgkqhkiG9w0BAQsFADAW\nMRQwEgYDVQQDDAtFYXN5LVJTQSBDQTAeFw0yNDA3MzExNzUyMDBaFw0yNjExMDMx\nNzUyMDBaMBoxGDAWBgNVBAMMD2NsaWVudC1jZXJ0LTAwMTCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBANXyxnIb9tLqe6di6xIJaCDm0Ue4D8Cy0XYQKnbB\n8Ko9xJiglUm4BXAkjkOHLfSB38hOx9exXTW4whMuYOEJoo26JcdbmLJhaxiVAwTQ\nzMROgCbpJi1lu5cQ8F0U4Sq1/+IZKIGfmiWtxa2YP4Kc4qgEESk+AZ6rtxuKUvQU\nY0rLO1J1FuH8CgYnPG/dkwek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