Skip to content

Comments

sysutils: add autorollback plugin#5236

Open
mplind wants to merge 2 commits intoopnsense:masterfrom
mplind:add-autorollback-plugin
Open

sysutils: add autorollback plugin#5236
mplind wants to merge 2 commits intoopnsense:masterfrom
mplind:add-autorollback-plugin

Conversation

@mplind
Copy link

@mplind mplind commented Feb 18, 2026

Summary

New plugin: os-autorollback — Automatic configuration rollback with safe mode for OPNsense.

Inspired by Juniper JUNOS commit confirmed and MikroTik RouterOS Safe Mode, this plugin protects administrators from locking themselves out during configuration changes.

How it works

  1. Administrator activates Safe Mode before making changes
  2. A configurable countdown timer begins (default: 300 seconds)
  3. If the admin confirms before the timer expires, changes are kept
  4. If the timer expires (or connectivity is lost), configuration is automatically rolled back

Features

  • Safe mode with countdown timer — configurable timeout, extend on the fly
  • Three rollback triggers:
    • Timer expiry (primary)
    • Connectivity watchdog via cron (secondary — monitors configurable ping targets)
    • Early boot recovery via syshook (tertiary — detects crashed safe mode sessions)
  • Dashboard widget — real-time countdown with one-click confirm/revert
  • Global banner — persistent notification on every page during active safe mode
  • Atomic config restore — safety backup, path traversal protection, XML validation
  • Firmware-aware — blocks rollback during firmware upgrades
  • Full MVC architecture — API endpoints, configd backend, ACL, model, forms, views

Architecture

  • src/opnsense/scripts/autorollback/ — Python backend (safemode, timer, rollback, watchdog, status)
  • src/opnsense/mvc/ — MVC controllers, models, views, forms
  • src/opnsense/www/js/ — Dashboard widget + global banner JS
  • src/opnsense/service/conf/actions.d/ — configd action definitions
  • src/etc/rc.syshook.d/ — Config change hook + early boot recovery
  • src/etc/inc/plugins.inc.d/ — Plugin registration (cron, services, syslog)

Testing

Tested on OPNsense 25.1 (FreeBSD 14). All rollback paths verified:

  • Timer expiry rollback
  • Manual confirm/cancel
  • Connectivity watchdog trigger
  • Boot recovery after simulated crash
  • Concurrent rollback prevention (lock-based)
  • Path traversal protection
  • Firmware update blocking

Source

Development repository: https://github.com/mplind/os-autorollback

mplind and others added 2 commits February 18, 2026 09:42
New plugin: os-autorollback - Automatic configuration rollback with safe mode.

Inspired by Juniper JUNOS "commit confirmed" and MikroTik RouterOS Safe Mode,
this plugin provides automatic configuration rollback for OPNsense. When safe
mode is activated, a timer begins counting down. If the administrator does not
confirm the changes before the timer expires, the configuration is automatically
rolled back to the pre-change state.

Features:
- Safe mode with configurable countdown timer (default 300s)
- Three rollback triggers: timer expiry, connectivity watchdog, boot recovery
- Connectivity watchdog monitors configurable targets every minute via cron
- Early boot recovery via syshook detects crashed safe mode sessions
- Dashboard widget with real-time countdown and one-click confirm/revert
- Global banner on every page during active safe mode
- Atomic config restore with safety backup and path traversal protection
- Firmware update awareness (blocks rollback during upgrades)
- Full MVC architecture with API endpoints and configd backend integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… data

The dashboard widget's extend button was using JSON.stringify() to send
the seconds parameter, but the PHP controller reads it via getPost()
which expects form-encoded data. Changed to pass a plain object so
jQuery serializes it correctly as form data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant