summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2024-06-10 17:27:39 +0200
committerDavid Lönnhager <david.l@mullvad.net>2024-09-02 12:04:36 +0200
commit8583d55f9c33fece9e0a39824799234ad6375b9d (patch)
treebf60996575c9d06e08869c5b33404dca3107f6df
parentf0e2c485907729653c11772ec3b2fa5c246fe9a6 (diff)
downloadmullvadvpn-8583d55f9c33fece9e0a39824799234ad6375b9d.tar.xz
mullvadvpn-8583d55f9c33fece9e0a39824799234ad6375b9d.zip
Add integration tests for WG over Shadowsocks
-rw-r--r--test/test-manager/src/tests/tunnel.rs95
1 files changed, 93 insertions, 2 deletions
diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs
index c671f28966..f8ba47d1ca 100644
--- a/test/test-manager/src/tests/tunnel.rs
+++ b/test/test-manager/src/tests/tunnel.rs
@@ -17,8 +17,8 @@ use mullvad_types::{
constraints::Constraint,
relay_constraints::{
self, BridgeConstraints, BridgeSettings, BridgeType, OpenVpnConstraints, RelayConstraints,
- RelaySettings, SelectedObfuscation, TransportPort, Udp2TcpObfuscationSettings,
- WireguardConstraints,
+ RelaySettings, SelectedObfuscation, ShadowsocksSettings, TransportPort,
+ Udp2TcpObfuscationSettings, WireguardConstraints,
},
states::TunnelState,
wireguard,
@@ -203,6 +203,49 @@ pub async fn test_udp2tcp_tunnel(
Ok(())
}
+/// Use Shadowsocks obfuscation. This tests whether the daemon can establish a Shadowsocks tunnel.
+/// Note that this doesn't verify that Shadowsocks is in fact being used.
+#[test_function]
+pub async fn test_wireguard_over_shadowsocks(
+ _: TestContext,
+ rpc: ServiceClient,
+ mut mullvad_client: MullvadProxyClient,
+) -> anyhow::Result<()> {
+ mullvad_client
+ .set_obfuscation_settings(relay_constraints::ObfuscationSettings {
+ selected_obfuscation: SelectedObfuscation::Shadowsocks,
+ shadowsocks: ShadowsocksSettings {
+ port: Constraint::Any,
+ },
+ ..Default::default()
+ })
+ .await
+ .context("Failed to enable shadowsocks")?;
+
+ let relay_settings = RelaySettings::Normal(RelayConstraints {
+ tunnel_protocol: Constraint::Only(TunnelType::Wireguard),
+ ..Default::default()
+ });
+
+ set_relay_settings(&mut mullvad_client, relay_settings)
+ .await
+ .context("Failed to update relay settings")?;
+
+ log::info!("Connect to WireGuard via shadowsocks endpoint");
+
+ connect_and_wait(&mut mullvad_client).await?;
+
+ // Verify that we have a Mullvad exit IP
+ //
+
+ assert!(
+ helpers::using_mullvad_exit(&rpc).await,
+ "expected Mullvad exit IP"
+ );
+
+ Ok(())
+}
+
/// Test whether bridge mode works. This fails if:
/// * No outgoing traffic to the bridge/entry relay is observed from the SUT.
/// * The conncheck reports an unexpected exit relay.
@@ -604,6 +647,54 @@ pub async fn test_quantum_resistant_multihop_udp2tcp_tunnel(
Ok(())
}
+/// Test Shadowsocks, PQ, and WireGuard combined.
+///
+/// # Limitations
+///
+/// This is not testing any of the individual components, just whether the daemon can connect when
+/// all of these features are combined.
+#[test_function]
+pub async fn test_quantum_resistant_multihop_shadowsocks_tunnel(
+ _: TestContext,
+ rpc: ServiceClient,
+ mut mullvad_client: MullvadProxyClient,
+) -> anyhow::Result<()> {
+ mullvad_client
+ .set_quantum_resistant_tunnel(wireguard::QuantumResistantState::On)
+ .await
+ .context("Failed to enable PQ tunnels")?;
+
+ mullvad_client
+ .set_obfuscation_settings(relay_constraints::ObfuscationSettings {
+ selected_obfuscation: SelectedObfuscation::Shadowsocks,
+ shadowsocks: ShadowsocksSettings {
+ port: Constraint::Any,
+ },
+ ..Default::default()
+ })
+ .await
+ .context("Failed to enable obfuscation")?;
+
+ let relay_constraints = RelayQueryBuilder::new()
+ .wireguard()
+ .multihop()
+ .into_constraint();
+
+ mullvad_client
+ .set_relay_settings(RelaySettings::Normal(relay_constraints))
+ .await
+ .context("Failed to update relay settings")?;
+
+ connect_and_wait(&mut mullvad_client).await?;
+
+ assert!(
+ helpers::using_mullvad_exit(&rpc).await,
+ "Expected Mullvad exit IP"
+ );
+
+ Ok(())
+}
+
/// Try to connect to an OpenVPN relay via a remote, passwordless SOCKS5 server.
/// * No outgoing traffic to the bridge/entry relay is observed from the SUT.
/// * The conncheck reports an unexpected exit relay.