App to VPN Mapping

When setting up a cross-device VPN, all device data is routed through the private network. Sometimes, a company may want to set up a VPN only for their enterprise applications. Apple allows VPN connections to be set up for iPhones, iPads and Macs on an app-by-app basis. Here, administrators can control exactly what data flows through the VPN. The policy configuration of an app-to-VPN mapping helps organizations keep app-level traffic apart, allowing for the separation of personal and corporate data.


Prerequisite

An app-to-VPN mapping can be set up directly through Relution. On macOS, Relution includes the mapping with the signing identifier and designated requirement of the app directly in the VPN profile (see the section “macOS specifics”). On iOS and iPadOS, this only works for apps that are installed and managed by the MDM on the devices.

Relution supports the following connection types for establishing a per-app VPN connection on iOS and macOS devices:

  • IPSec
  • JuniperSSL
  • SonicWALL
  • AnyConnect Legacy
  • AnyConnect
  • IKEv2
  • Custom SSL

For other VPN types, the VPN configuration points to the supported types; for the IKEv2 Always On type, the option is not available.


Configuring app-to-VPN mapping for iOS and macOS devices

  1. Per-app VPN requires two configurations in the same policy:

    • VPN
    • App to VPN Mapping
  2. Within the VPN configuration, the option Per App and Account VPN has to be activated and depending on the VPN type, all necessary fields have to be filled in.

  3. Within the App to VPN Mapping configuration, apps are assigned to a VPN configuration of the same policy. The configuration can be added once per policy, and each app can only be assigned to one VPN configuration. Via Add, the VPN configuration (Configuration) is selected first, followed by the Source of the app: Relution App Store app, Apple App Store App, iOS System or built-in app, App Compliance or Manually add app. The app itself is selected in the last step.

  4. Once Per App and Account VPN is activated, the VPN configuration shows the Per account VPN section. There, Automatically connect to the VPN, if an associated app requests a network connection defines that the connection is established automatically when needed. In addition, Associated domains, Excluded domains, Safari domains and SMB domains can be specified. Under Select configurations, account configurations of the same policy can be assigned to the VPN; on macOS, these are email, CalDAV and CardDAV configurations.

The list of mappings shows in the columns Name and Configuration the app and the connection name of the assigned VPN configuration, and in the columns Enabled and Per App VPN enabled whether the assigned VPN configuration is active and whether Per App and Account VPN is switched on there. The mapping only takes effect if both apply. In macOS policies, the columns Signing identifier and Designated requirement follow with the values of the respective app.

Adding apps

Add opens the Select an app dialog. It guides through the mapping in three steps. Next is only available once a VPN configuration has been selected; Add transfers the selected apps to the list.

StepDescription
ConfigurationVPN configuration to which the apps are assigned; exactly one is selected. All VPN configurations of the same policy are offered with their connection name, including disabled ones and those without Per App and Account VPN. The mapping only takes effect once both are enabled.
SourceOrigin of the app, see the following table. Relution App Store app is preselected.
AppSelection of one or more apps from the chosen source, or entry of the app for Manually add app. All selected apps are assigned to the VPN configuration from the first step.

In macOS policies, the sources offer the following in the App step:

SourceSelection in the App step
Relution App Store appNative apps and App Store apps for macOS from the Relution App Store that have a version in the Release status.
Apple App Store AppSearch for Mac apps in the public Apple App Store by the name of the app or via the link to the app. Country determines which country’s store is searched; the country of the organization’s default language is preselected.
iOS System or built-in appSelection from the list of known iOS system and built-in apps. The list contains the bundle IDs of the iOS apps; the corresponding Mac apps partly use different ones, e.g. Safari com.apple.Safari instead of com.apple.mobilesafari.
App ComplianceThe selection remains empty, as the source only evaluates the iOS app compliance configuration, not the App compliance → configuration for macOS.
Manually add appEntry of Name (display name in the list) and Internal name (bundle ID of the app, e.g. com.example.intranet); both fields are required.

Editing and deleting mappings

Edit and Delete are available in the three-dot menu next to Add for the mappings selected in the list, and in the context menu of each row. Edit is only possible with exactly one selected mapping and opens the App to VPN Mapping dialog with the fields Signing identifier and Designated requirement (see the section “macOS specifics”). Delete removes the mappings from the list. The VPN configuration of a mapping cannot be edited. If an app that is already mapped is added again via Relution App Store app, Apple App Store App or iOS System or built-in app, the new mapping replaces the existing one; for Manually add app, the existing mapping has to be removed via Delete first. If a VPN configuration is deleted from the policy, Relution removes the apps assigned to it from the list.


macOS specifics

In macOS policies, each assigned app additionally has the required fields Signing identifier and Designated requirement. When an app is added, Relution initially fills both fields with the bundle ID of the app; the values can be adjusted via Edit. The signing identifier is shown by codesign -dv /Applications/Safari.app in the Identifier line, the designated requirement by codesign -d --requirements - /Applications/Safari.app.

Confirm in the App to VPN Mapping dialog applies the changed values to the list; they are saved with the configuration. If an app that is already mapped is added again, Relution resets both fields to its bundle ID.

On macOS devices, Relution transfers the mappings with the profile of the VPN configuration they are assigned to, as an additional com.apple.vpn.managed.appmapping payload. For each app, it contains the bundle ID, the signing identifier and the designated requirement. This only applies to VPN configurations in which Per App and Account VPN is enabled; Relution does not install a separate profile for the App to VPN Mapping configuration.

Example: intranet app via the company VPN

An intranet app on the Mac is to route its traffic through the company VPN, while all other apps are not. For this purpose, the policy contains a VPN → configuration of the type IKEv2 with the connection name Company-VPN, in which Per App and Account VPN and Automatically connect to the VPN, if an associated app requests a network connection are enabled. In the App to VPN Mapping configuration, the following is selected via Add:

  • Configuration: Company-VPN
  • Source: Manually add app
  • Name: Intranet
  • Internal name: com.example.intranet

Afterwards, the values that codesign outputs on a Mac with the app installed are entered via Edit:

  • Signing identifier: com.example.intranet (line Identifier in the output of codesign -dv /Applications/Intranet.app)
  • Designated requirement: the expression after designated => in the output of codesign -d --requirements - /Applications/Intranet.app, for an app signed with a Developer ID for example:
identifier "com.example.intranet" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = ABCDE12345

Once the policy is installed on the Mac, the profile of the VPN configuration Company-VPN contains the mapping. macOS establishes the VPN connection as soon as the intranet app requests a network connection; the traffic of other apps does not use this VPN.

How helpful was this article?