Skip to main content

Tutorial: Configure Global Settings with a .ocfg File

Abstract

You can configure global settings in OpenVPN Connect on Windows by creating and deploying a .ocfg configuration file.

You can configure global settings in OpenVPN Connect by creating and deploying a .ocfg configuration file. This file allows administrators to control application behavior, set security preferences, restrict user actions, and preconfigure options like the app language, connection settings, or update behavior.

This tutorial outlines creating and using a .ocfg file with OpenVPN Connect for Windows or macOS, including where to place it and what values you can set. We also include examples and reference links for advanced use cases, like managing the app from the command line or combining the .ocfg file with deployment tools.

Global Configuration File Support

OpenVPN Connect supports global configuration files for macOS and Windows. This allows administrators to streamline application setup with a single configuration file. Refer to these topics for additional details:

Prerequisites

  • OpenVPN Connect installed on a Windows or macOS device.

  • Administrator privileges.

  • A text editor.

Step 1: Create the .ocfg file

  1. Open your preferred text editor and create a new file.

  2. Add JSON-formatted settings using the supported schema.

    Here's an example of a minimal .ocfg file:

    {
      "settings"1: {
        "vpn-protocol": "adaptive",
        "timeout": "30",
        "launch-options": "connect-latest",
        "seamless-tunnel": true,
        "captive-portal-detection": true,
        "software-update": "weekly",
        "theme": "system",
        "tray-icon-style": "colorful",
        "enable-dco": false,
        "confirmation-dialogs": "on-disconnect",
        "security-level": "preferred",
        "enforce-tls-1-3": true,
        "block-ipv6": "no",
        "google-dns-fallback": true
      },
      "proxies"2: [
        {
          "proxy_name": "proxy1",
          "proxy_host": "192.168.0.1",
          "proxy_port": 8080,
          "basic_auth": true
        },
        {
          "proxy_name": "proxy2",
          "proxy_host": "192.168.0.2",
          "proxy_port": 3129,
          "basic_auth": false
        }
      ],
      "profiles"3: [
        {
          "profile_name": "work_profile",
          "profile_path": "D:\\Profiles\\example.ovpn"
        }
      ]
    }
    

    1

    The settings section defines application-wide configurations.

    2

    The proxies section preconfigures proxy settings with up to ten defined.

    3

    The profiles section specifies VPN profiles to import with up to ten included.

    Tip

    You can customize these options. For a full list, refer to the schema for your OS:

  3. Save the file as the .ocfg extension.

    • Use a .ocfg extension (e.g., global.ocfg).

    • Follow the JSON format.

    • Adhere to the schema.

    • Ensure your editor doesn't add a .txt extension (e.g., global.ocfg.txt).

Step 2: Deploy the .ocfg file

  1. Copy the global.ocfg file to the OpenVPN Connect configuration directory:

    C:\Program Files\OpenVPN Connect\config\
    

    Tip

    This location ensures that OpenVPN Connect recognizes and applies the global settings upon startup.

  2. Close and reopen the application to restart OpenVPN Connect and apply the new configurations.

Step 3: Verify the configuration

  1. Launch OpenVPN Connect.

  2. Navigate to the settings to confirm that the configurations from the .ocfg file have been applied.

  3. Check for expected behaviors such as predefined proxy settings and imported profiles.