Skip to main content

Overview

The management interface is the primary communication channel between the Mullvad daemon (system service) and the various frontends (GUI, CLI, Android app, iOS app). It uses gRPC with Protocol Buffers for efficient, type-safe, bidirectional communication. Reference: mullvad-management-interface/proto/management_interface.proto

Architecture

Transport Layer

The management interface uses different transport mechanisms depending on the platform:
  • Desktop (Windows, Linux, macOS): Unix domain socket or named pipe
  • Android: JNI (Java Native Interface) bridge
  • iOS: Direct integration (standalone implementation)

Protocol

The interface uses Protocol Buffers v3 with gRPC for:
  • Type safety and schema validation
  • Efficient binary serialization
  • Language-agnostic interface definitions
  • Automatic client/server code generation
  • Built-in streaming support

Service Definition

Reference: mullvad-management-interface/proto/management_interface.proto:10-153

Core RPC Categories

1. Tunnel Control

Manage VPN tunnel state and configuration:
TunnelState message includes:
  • Current state (Disconnected, Connecting, Connected, Disconnecting, Error)
  • Relay information (endpoint, location, protocol)
  • Feature indicators (quantum resistance, multihop, obfuscation, etc.)
  • Error details if applicable
Reference: management_interface.proto:290-313

2. Event Streaming

Frontends subscribe to real-time daemon events:
DaemonEvent streams:
  • Tunnel state changes
  • Settings updates
  • Relay list updates
  • Version information
  • Device events (login, logout, revoked)
  • Access method changes
  • Leak detection alerts
Reference: management_interface.proto:729-740

3. Settings Management

Comprehensive settings configuration:
Reference: management_interface.proto:40-56

4. Relay Configuration

Relay and tunnel constraint management:
RelaySettings supports:
  • Location constraints (country, city, hostname)
  • Provider filtering
  • Ownership constraints (Mullvad-owned vs rented)
  • WireGuard-specific constraints (IP version, multihop, entry location)
  • Custom relay configurations
Reference: management_interface.proto:551-583

5. Account Management

Account and authentication operations:
Reference: management_interface.proto:58-66

6. Device Management

Multi-device account management:
DeviceState tracks:
  • Current state (LoggedIn, LoggedOut, Revoked)
  • Device ID and name
  • WireGuard public key
  • Creation timestamp
Reference: management_interface.proto:68-72, 807-815

7. WireGuard Key Management

Automatic key rotation and management:
Reference: management_interface.proto:75-78

8. Custom Lists

User-defined relay groupings:
CustomList allows:
  • Named relay collections
  • Geographic location specifications
  • Quick access to favorite relay combinations
Reference: management_interface.proto:80-84, 435-446

9. API Access Methods

Censorship circumvention configuration:
Supports:
  • Direct TLS connections
  • Mullvad bridges (Shadowsocks)
  • Encrypted DNS proxy
  • Custom SOCKS5/Shadowsocks proxies
See API Communication for details. Reference: management_interface.proto:86-94

10. Split Tunneling

Platform-specific split tunneling control: Linux (process-based):
Windows, macOS, Android (app-based):
Reference: management_interface.proto:99-115

11. App Upgrade

In-app update management:
Upgrade events include:
  • Download starting/progress
  • Verifying installer
  • Completion or errors
Reference: management_interface.proto:145-149, 155-182

Communication Patterns

Request-Response

Most operations use simple request-response:
  1. Frontend sends RPC request
  2. Daemon processes asynchronously
  3. Daemon returns response when complete
Example: Connecting to tunnel

Server Streaming

Long-lived connections for real-time updates: EventsListen provides continuous state updates:
Multiple clients can subscribe simultaneously, allowing GUI, CLI, and other tools to monitor daemon state concurrently.

Error Handling

Tunnel Errors

The ErrorState message provides detailed error information:
Reference: management_interface.proto:207-288

Authentication Errors

Reference: management_interface.proto:231-236

Relay Selection Errors

Reference: management_interface.proto:238-245

Feature Indicators

The management interface tracks active features:
These indicators are included in tunnel state messages, allowing frontends to display active features to users. Reference: management_interface.proto:332-349

Platform-Specific Operations

Android

Reference: management_interface.proto:117-119

macOS

Reference: management_interface.proto:121-122

Windows

Reference: management_interface.proto:124-126

Settings Persistence

Settings can be managed individually or via JSON patches:
This allows bulk settings updates and configuration import/export. Reference: management_interface.proto:128-132

Implementation

Server Side

The daemon implements the ManagementService in Rust:
Reference: mullvad-daemon/src/management_interface.rs

Client Side

Desktop GUI (Electron/TypeScript):
CLI (Rust):
Reference: mullvad-cli/src/cmds/

Asynchronous Design

Non-Blocking Operations

The management interface is designed to never block:
  • All RPC handlers run asynchronously
  • Commands are queued to the daemon’s actor system
  • Responses are sent when operations complete
  • No RPC can block another RPC from being processed
This prevents deadlocks and ensures responsive frontend behavior even during long-running operations. Reference: From architecture.md:21-33

Actor System

The daemon uses an actor-based architecture:
  • Each component runs independently
  • Communication via message passing
  • No shared mutable state between actors
  • Management interface acts as entry point for external commands

Security Considerations

Access Control

Desktop: Socket permissions restrict access to appropriate user/group
  • Unix domain socket with restrictive file permissions
  • Only local processes can connect
Android: JNI bridge provides isolation
  • No network exposure
  • App sandbox prevents unauthorized access

Input Validation

All RPC inputs are validated:
  • Protocol Buffers ensures type safety
  • Additional validation in RPC handlers
  • Malformed requests rejected before processing

Debugging and Monitoring

Logging

Allows runtime log level adjustment and log streaming. Reference: management_interface.proto:151-152

Relay Override

For testing and debugging:
Reference: management_interface.proto:54-55, 138-139