Skip to content

feat(ovpnrw): connections history from storage if available#1566

Open
m-dilorenzi wants to merge 1 commit intomainfrom
vpn_rw_conn_history_from_storage
Open

feat(ovpnrw): connections history from storage if available#1566
m-dilorenzi wants to merge 1 commit intomainfrom
vpn_rw_conn_history_from_storage

Conversation

@m-dilorenzi
Copy link
Collaborator

This pull request introduces several improvements and enhancements to the OpenVPN connections history section, primarily focused on supporting persistent storage for connection history databases, improving API functionality, and adding mechanisms to synchronize connection records when storage is mounted.
The changes ensure that connection history is preserved across reboots, provide more flexible API filtering and sorting, and add scripts to automate database migration.

Persistent storage and database path handling:

  • All relevant code now checks for the presence of /mnt/data/openvpn and uses it as the preferred location for connections.db, falling back to /var/openvpn if storage is not available. Helper functions like get_connections_db_path and get_ovpnrw_db_path were introduced to centralize this logic.
  • The documentation (README.md) was updated to clarify that connection history is stored in either /var/openvpn/<instance>/connections.db or /mnt/data/openvpn/<instance>/connections.db depending on storage configuration.

Database migration and archiving:

  • A new hotplug script (20-openvpn-merge-connections-db) and migration utility (openvpn-merge-connections-db) were added to synchronize connection records from /var to /mnt/data when storage is mounted, ensuring persistence across reboots.
  • When removing an OpenVPN instance, the connection history database is now archived before deletion to prevent data loss.

API enhancements and reporting improvements:

  • The connection_history API was refactored to support filtering (by time range, accounts, and search query), sorting (including manual sorting for IP addresses), and pagination, returning richer metadata for frontend use.
  • All reporting functions now use the new database path resolution logic, ensuring data is pulled from the correct location regardless of storage configuration.

These changes collectively improve reliability, flexibility, and maintainability of the OpenVPN connections history section.

Closes: #1404

@m-dilorenzi m-dilorenzi requested a review from Tbaile March 12, 2026 15:59
@m-dilorenzi m-dilorenzi self-assigned this Mar 12, 2026
@Tbaile Tbaile changed the title feat(ovpn-rw-conn-history): connections history from storage if available feat(ovpnrw): connections history from storage if available Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show full OpenVPN RW in the UI connection history from stored logs instead of RAM

1 participant