Skip to content

Feat/openvpn split tunnel - #5

Open
RezaMahdaviiDev wants to merge 4 commits into
devlifeX:mainfrom
RezaMahdaviiDev:feat/openvpn-split-tunnel
Open

Feat/openvpn split tunnel#5
RezaMahdaviiDev wants to merge 4 commits into
devlifeX:mainfrom
RezaMahdaviiDev:feat/openvpn-split-tunnel

Conversation

@RezaMahdaviiDev

Copy link
Copy Markdown

No description provided.

claude and others added 4 commits August 22, 2026 19:22
Start an optional OpenVPN profile right after Hiddify and before the Mihomo
generation, so a private or corporate network is reachable without the side
tunnel becoming the system gateway.

The tunnel is never allowed to touch the routing table: the helper passes
--route-noexec and installs only the routes it validated itself — the tunnel's
own network, the scoped routes parsed out of the server's PUSH_REPLY, and the
CIDRs the user listed. A default route is rejected in the config validator,
the IPC validator, and the helper. A dropped tunnel therefore costs the user
the networks behind it and nothing else.

A .ovpn file is untrusted input to a root process, so the helper refuses any
profile carrying up/down/route-up/plugin/script-security and pins
--script-security 0 after --config as a second barrier.

Selected traffic reaches the tunnel through a new OPENVPN route in the rules
table: Mihomo gains a direct outbound bound to the helper-owned device, marked
on Linux so the helper's policy table picks it up, bound by interface name on
Windows. The OpenVPN server's own address is pinned DIRECT above every other
rule so the tunnel's transport never loops back into the split TUN, and the
OpenVPN rule-sets sit above private-networks so an RFC1918 host behind the
tunnel is reachable.

The side tunnel fails alone: openvpn.required is off by default, so a tunnel
that will not start marks its own component degraded and Connect proceeds with
the existing DIRECT/Hiddify split.

See ADR 0067.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9AxX8DzAZVMn831eckyNb
env_clear() costs a Windows process SYSTEMROOT, without which it cannot
start, so the OpenVPN spawn now restores the same variables the Mihomo
spawn does and hides the console window. The Linux-only PATH it used to
set moves behind the same cfg. Also drops the interface_index lookup that
became dead when the Windows routes moved to netsh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9AxX8DzAZVMn831eckyNb
The Linux ip-addr parser is unused in the Windows lib target, which failed CI under -D warnings. Gate it to unix/tests, restore PATH after env_clear, and cover the netsh parser.

Co-authored-by: Cursor <cursoragent@cursor.com>
The dry-run workflow bundled the 0-byte Tauri placeholder instead of staging iran-split-helper, so Connect tried to elevate nothing and then showed a stale sharing-violation log. Stage the real helper, ignore empty placeholders, and retry locked copies.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants