How It Works

VPN Detection in Rust Without Inspecting Traffic: How Our Agent Works

How TIMO360 detects virtual VPN adapters, OS-wide proxies and browser-extension VPNs across Windows, macOS and Linux without reading network traffic.

TIMO360 logoTIMO360 Team3 min read
VPN Detection in Rust Without Inspecting Traffic: How Our Agent Works

Key takeaways

  • TIMO360 detects VPNs across three layers — virtual network interfaces, manual OS-wide proxies and browser-extension proxy settings — without ever reading network packets.
  • Virtual adapters only count when they hold a routable IPv4 or IPv6 address, preventing idle or disconnected adapters from triggering false alerts.
  • macOS utun interfaces and corporate PAC auto-config URLs are deliberately excluded so iCloud, Handoff and enterprise proxies do not cause false positives.
  • Stateless Rust OS reads are diffed in TypeScript every 10 seconds inside DeviceMonitor, keeping all pause and privacy gates cleanly testable.

Detecting whether an employee is connected to a VPN sounds simple until you try to implement it across Windows, macOS and Linux. Modern VPN tools do not behave the same way: desktop apps create virtual tunnel adapters, proxy tools configure OS-wide proxy settings and lightweight browser VPNs work entirely inside Chrome or Edge without touching a network interface.

Many endpoint agents solve this by installing kernel drivers or inspecting live network packets. In TIMO360, we chose an architecture that detects VPN connections across all three layers without ever reading network traffic, DNS queries or browsing history.

Layer 1: Virtual Network Interfaces With a Real Address

In our Rust module (device_signals.rs), the agent starts by listing active network interfaces via if_addrs and checking interface names against known tunnel prefixes (tun, tap, wg, ppp) and VPN adapter substrings (such as vpn, wireguard, nordlynx, wintun, mullvad, protonvpn, protun, anyconnect, globalprotect and forticlient).

Two practical edge cases matter here:

  • Ignore macOS utun interfaces: Apple keeps multiple utun interfaces permanently up on macOS for built-in services such as iCloud and Handoff. Flagging utun would alert on virtually every Mac user.
  • Require a usable IP address: Many VPN clients leave a virtual adapter installed when disconnected, with no IP or only a link-local address. Our is_usable_address check ignores loopback, unspecified, IPv4 link-local (169.254.x.x) and IPv6 link-local (fe80::/10) addresses so only active tunnels count.

Layer 2: Manual OS-Wide Proxy Detection

Some proxy-based VPN utilities route system traffic through a local or remote proxy port without creating a virtual adapter. To cover those consistently across desktop operating systems, the agent checks each OS's manual proxy configuration:

  • Windows: Reads ProxyEnable and ProxyServer from HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings.
  • macOS: Parses scutil --proxy for enabled HTTP, HTTPS or SOCKS hosts and ports.
  • Linux: Reads GNOME proxy settings via gsettings when org.gnome.system.proxy mode is set to manual.

Corporate PAC auto-config URLs are intentionally ignored so standard office network configurations never trigger false VPN alerts.

Layer 3: Browser-Extension VPNs Without Reading History

A browser-extension VPN adds neither an OS adapter nor a system proxy — it configures Chrome, Edge, Brave or Chromium directly inside the browser profile's Secure Preferences or Preferences file.

Our agent inspects only extensions.settings in those profile files and checks three fields:

  1. Whether preferences.proxy.mode is fixed_servers or pac_script.
  2. Whether disable_reasons is empty, confirming the extension is actually enabled.
  3. The extension's manifest name (such as Proton VPN (browser extension)).

Zero browsing data read

Reading the extension proxy preference never touches browser history, open tabs, cookies, bookmarks or passwords — only whether an enabled extension is routing browser traffic through a proxy and what that extension is called.

Stateless Rust Snapshots Paired in TypeScript

Rather than hiding state inside OS callbacks, Rust stays completely stateless: list_vpns() simply answers "what is connected right now?" Every 10 seconds, the frontend's DeviceMonitor diffs the current snapshot against the previous one to emit VPN_CONNECTED and VPN_DISCONNECTED events.

That split keeps privacy rules in one unit-tested class:

  • No guessing on OS errors: If a system call fails, DeviceMonitor treats the state as unknown rather than inventing a disconnect.
  • Clean pause boundaries: Unless the admin enabled always-on VPN monitoring, pausing for a break, meeting or punch-out closes open sessions immediately and marks re-appearances on resume with resumed: true so admins do not get flooded by duplicate connect alerts.

Want to see how USB pendrive detection and the backend alert pipeline complete this architecture? Read how pendrive and USB file-transfer detection is engineered or explore Employee Device Management.

Ready for Attendance & Presence Tracking That Respects Your Team?

Set up your organization, install the agent, and start seeing attendance and presence data in minutes — without a single keystroke or screenshot recorded.

Windows, macOS & Linux Pay per employee license Zero keystroke or screen capture
Chat with us