Skip to content

feat: add OpenVPN/WireGuard configuration importer, VPN settings editor, compact tray menu, and connection toast notifications - #134

Merged
ericbsd merged 19 commits into
ghostbsd:masterfrom
mbnunes:imports
Nov 20, 2026
Merged

ericbsd merged 19 commits into
ghostbsd:masterfrom
mbnunes:imports

Conversation

@mbnunes

@mbnunes mbnunes commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR introduces full OpenVPN (.ovpn / .conf) and WireGuard (.conf) configuration import and management to networkmgr (modeled after Linux's NetworkManager-openvpn), alongside a redesigned compact single-row Tray Menu UI and non-blocking desktop popup notifications when connecting or disconnecting networks.

Key Features & Changes

1. OpenVPN & WireGuard Configuration Importer and Editor

  • New OpenVPN Backend (NetworkMgr/openvpn_api.py):
  • Full parser and exporter for OpenVPN .ovpn and .conf profiles (parse_openvpn_config, save_openvpn_config,
    delete_openvpn_config, openvpn_dictionary, enable_openvpn, disable_openvpn).
  • Automatic detection between OpenVPN and WireGuard configuration files (detect_vpn_file_type).
  • Extracts inline PEM blocks (<ca>, <cert>, <key>, <pkcs12>, <tls-auth>, <tls-crypt>, <tls-crypt-v2>,
    <secret>, <extra-certs>, <http-proxy-user-pass>) and <connection> blocks, storing certificates and keys safely with
    0600 permissions under /usr/local/etc/openvpn/certs/<profile_id>/.
  • Supports all four authentication modes (tls, password, tls-password, static-key) and prompts for credentials via
    OpenVPNAuthDialog when needed.
  • Supports Manual/Static IPv4 (ifconfig, route-gateway), Manual/Static IPv6 (ifconfig-ipv6, pull-filter ignore), and custom Static Routes (IPv4 & IPv6) (route, route-ipv6).
  • Preserves and updates custom connection display names (# networkmgr-name:) and handles profile renaming cleanly when
    importing or editing a profile.
  • Checks whether security/openvpn is installed (is_openvpn_installed) and shows a clear warning dialog
    (show_openvpn_not_installed_alert) instead of raising FileNotFoundError when /usr/local/sbin/openvpn is missing.
  • WireGuard Importer & Editor Enhancements (NetworkMgr/wg_api.py):
  • Added parse_wireguard_config, save_wireguard_config, delete_wireguard_config, and default_wireguard_config to
    import, create, edit, and remove WireGuard profiles in /usr/local/etc/wireguard/.
  • Guarded wg and wg-quick subprocess calls against missing binaries (OSError / FileNotFoundError).
  • Tabbed VPN Configuration Dialog (NetworkMgr/vpn_dialog.py):
  • Added import_vpn_file_dialog and VPNConnectionDialog with 6 tabs for OpenVPN (VPN, IPv4 Settings, IPv6
    Settings
    , Advanced, Security & TLS, Proxies) plus WireGuard profile editing.
  • VPN Settings Tab in Network Configuration Window (NetworkMgr/configuration.py):
  • Added a VPN Settings tab to NetCardConfigWindow allowing users to view, Import VPN..., create New OpenVPN,
    Edit, Connect / Disconnect, and Delete VPN profiles directly from the configuration window.

2. Compact Single-Row Tray Menu UI/UX (NetworkMgr/trayicon.py)

  • Consolidated the 3-row menu structure per connection (<Name> Connected + Disable <Name> + Configure <Name>) into a
    clean, single-row layout for OpenVPN, WireGuard, and Ethernet (Wired) connections:
    ● <Connection Name> [Connect / Red X Disconnect] [⚙ Configure]
  • Uses inline SVG icons rendered via GdkPixbuf.PixbufLoader:
  • Status indicator dot (emerald green when connected, neutral outline when disconnected).
  • Action button 1: Green play/connect icon when disconnected; Red ✕ icon when connected.
  • Action button 2: Gear (⚙) icon to open the profile or interface configuration window.
  • Added Import VPN Configuration... directly to the tray menu.

3. Desktop Popup Toast Notifications (NetworkMgr/vpn_dialog.py,

NetworkMgr/trayicon.py, NetworkMgr/configuration.py)

  • Added show_connection_notification(name, connected) using a non-blocking GTK3 Gdk.WindowTypeHint.NOTIFICATION popup toast
    in the top-right corner of the primary monitor:
  • [✓] <Connection Name> Connected (green checkmark icon)
  • [✕] <Connection Name> Disconnected (red X icon)
  • Works out of the box across all GhostBSD desktop environments (MATE, XFCE, Openbox, etc.) without requiring external
    notification daemons, never steals keyboard focus, and auto-dismisses after 3 seconds (or on click).

Files Changed


Testing

  • Imported .ovpn and WireGuard .conf profiles (with both external and inline <ca>, <cert>, <key>, <tls-auth>,
    <tls-crypt> blocks) and verified generated configurations in /usr/local/etc/openvpn/ and /usr/local/etc/wireguard/.
  • Verified profile renaming on import/edit and static IPv4/IPv6 addresses and static routes persistence.
  • Verified warning alert on GhostBSD systems where openvpn is not yet installed.
  • Verified single-row tray menu actions (Connect/Disconnect and Configure buttons) and popup toast notifications across VPN, Wired, and Wi-Fi connections.

@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Sorry @mbnunes, your pull request is larger than the review limit of 150,000 diff characters

Comment thread NetworkMgr/ipsec_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/wg_api.py Resolved
Comment thread NetworkMgr/trayicon.py Resolved
Comment thread NetworkMgr/trayicon.py Resolved
Comment thread NetworkMgr/configuration.py Resolved
Comment thread NetworkMgr/ipsec_api.py Resolved
@github-project-automation github-project-automation Bot moved this from To triage to In review in NetworkMGR Issue Traker Nov 10, 2026
@ericbsd ericbsd linked an issue Nov 10, 2026 that may be closed by this pull request
@ericbsd
ericbsd self-requested a review November 11, 2026 18:35
Comment thread NetworkMgr/configuration.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/trayicon.py Resolved
Comment thread NetworkMgr/ipsec_api.py Resolved
@mbnunes
mbnunes requested a review from ericbsd November 13, 2026 19:49
ericbsd
ericbsd previously approved these changes Nov 19, 2026
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/openvpn_api.py Resolved
Comment thread NetworkMgr/trayicon.py Resolved
Comment thread NetworkMgr/logger.py Resolved
Comment thread networkmgr_configuration Resolved
Comment thread networkmgr_configuration Resolved
Comment thread networkmgr_configuration Resolved
@ericbsd
ericbsd merged commit 39d72bf into ghostbsd:master Nov 20, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Nov 20, 2026
@github-project-automation github-project-automation Bot moved this from In review to Done in NetworkMGR Issue Traker Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature] NetworkMgr needs VPN support

2 participants