Skip to content

Commit 23b92eb

Browse files
slipNETclaude
andcommitted
Remove SNI spoofing — not viable without CDN fronting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5341d0e commit 23b92eb

3 files changed

Lines changed: 7 additions & 30 deletions

File tree

app/src/main/java/app/slipnet/presentation/profiles/EditProfileScreen.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,6 @@ fun EditProfileScreen(
296296
visualTransformation = PasswordVisualTransformation(),
297297
modifier = Modifier.fillMaxWidth()
298298
)
299-
OutlinedTextField(
300-
value = uiState.naiveSni,
301-
onValueChange = { viewModel.updateNaiveSni(it) },
302-
label = { Text("SNI Hostname (Optional)") },
303-
placeholder = { Text("Leave empty for direct connections") },
304-
supportingText = { Text("Only for CDN-fronted setups (e.g. Cloudflare). Leave empty if connecting directly to your server.") },
305-
singleLine = true,
306-
modifier = Modifier.fillMaxWidth()
307-
)
308299
Surface(
309300
onClick = {
310301
val intent = android.content.Intent(

app/src/main/java/app/slipnet/service/SlipNetVpnService.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ class SlipNetVpnService : VpnService() {
933933
serverPort = profile.naivePort,
934934
username = profile.naiveUsername,
935935
password = profile.naivePassword,
936-
sni = profile.naiveSni
937936
)
938937
}
939938
if (naiveResult.isFailure) {
@@ -1027,8 +1026,7 @@ class SlipNetVpnService : VpnService() {
10271026
serverHost = profile.domain,
10281027
serverPort = profile.naivePort,
10291028
username = profile.naiveUsername,
1030-
password = profile.naivePassword,
1031-
sni = profile.naiveSni
1029+
password = profile.naivePassword
10321030
)
10331031
}
10341032
if (naiveResult.isFailure) {
@@ -2258,8 +2256,7 @@ class SlipNetVpnService : VpnService() {
22582256
serverPort = profile.naivePort,
22592257
username = profile.naiveUsername,
22602258
password = profile.naivePassword,
2261-
sni = profile.naiveSni
2262-
)
2259+
)
22632260
}
22642261
if (naiveResult.isFailure) {
22652262
Log.e(TAG, "Failed to restart NaiveProxy after network change", naiveResult.exceptionOrNull())

app/src/main/java/app/slipnet/tunnel/NaiveBridge.kt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ object NaiveBridge {
3636
* @param serverPort Caddy HTTPS port (naivePort, default 443)
3737
* @param username HTTP proxy auth username
3838
* @param password HTTP proxy auth password
39-
* @param sni SNI hostname for spoofing (empty = use serverHost)
4039
*/
4140
fun start(
4241
context: Context,
@@ -45,14 +44,12 @@ object NaiveBridge {
4544
serverHost: String,
4645
serverPort: Int,
4746
username: String,
48-
password: String,
49-
sni: String
47+
password: String
5048
): Result<Unit> {
5149
Log.i(TAG, "========================================")
5250
Log.i(TAG, "Starting NaiveProxy")
5351
Log.i(TAG, " Listen: socks://$listenHost:$listenPort")
5452
Log.i(TAG, " Server: $serverHost:$serverPort")
55-
Log.i(TAG, " SNI: ${sni.ifBlank { "(none, using server hostname)" }}")
5653
Log.i(TAG, "========================================")
5754

5855
stop()
@@ -75,7 +72,7 @@ object NaiveBridge {
7572
"--log"
7673
)
7774

78-
// Always pre-resolve server IP to avoid ISP DNS poisoning.
75+
// Pre-resolve server IP to avoid ISP DNS poisoning.
7976
// NaiveProxy (Chromium) would otherwise use its own DNS resolver,
8077
// which goes through ISP DNS since the app is excluded from VPN.
8178
val resolvedIp = try {
@@ -85,17 +82,9 @@ object NaiveBridge {
8582
return Result.failure(RuntimeException("Cannot resolve server hostname '$serverHost'"))
8683
}
8784

88-
if (sni.isNotBlank() && sni != serverHost) {
89-
// SNI spoofing: connect to SNI hostname but resolve it to the real server IP
90-
args.add("--proxy=https://$username:$password@$sni:$serverPort")
91-
args.add("--host-resolver-rules=MAP $sni $resolvedIp")
92-
Log.i(TAG, "SNI spoofing: $sni -> $resolvedIp")
93-
} else {
94-
// No SNI: connect to serverHost, but still use pre-resolved IP
95-
args.add("--proxy=https://$username:$password@$serverHost:$serverPort")
96-
args.add("--host-resolver-rules=MAP $serverHost $resolvedIp")
97-
Log.i(TAG, "Pre-resolved: $serverHost -> $resolvedIp")
98-
}
85+
args.add("--proxy=https://$username:$password@$serverHost:$serverPort")
86+
args.add("--host-resolver-rules=MAP $serverHost $resolvedIp")
87+
Log.i(TAG, "Pre-resolved: $serverHost -> $resolvedIp")
9988

10089
val pb = ProcessBuilder(args)
10190
pb.redirectErrorStream(true)

0 commit comments

Comments
 (0)