Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysutils/auto-recovery: a new plugin to rollback configuration changes #3321

Closed
wants to merge 1 commit into from

Conversation

fraenki
Copy link
Member

@fraenki fraenki commented Feb 22, 2023

Preface

This new community plugin tries to immitate the reload in 5 feature found in some routers/switches. It will start a countdown and restore all configuration changes if the countdown is not aborted. This is especially useful when working on remote devices.

This PR implements the feature request #2976 using an extremely simplified approach. The main feature is implemented, but it may not be sufficient for production environments.

DISCLAIMER: Auto Recovery is a community plugin without support or guarantees. Auto Recovery can only restore the OPNsense system configuration to a previous state. It does not restore any other files, packages or revert any filesystem modification. It certainly is not meant to replace a backup, nor does it protect against failed software upgrades.

Testing

This plugin is expected to be able to reliably restore a working system configuration. Hence we need more people to test it's features, before this plugin can be released.

Adding the development version of the plugin on OPNsense 23.1 is simple:

opnsense-patch -c plugins ae2ff84b
service configd restart

Please let me know if it works for you, or if you experience any issues.

Screenshots

Configuration screen:

autorecovery_1

When the countdown is on:

autorecovery_2

Log messages in System: Log Files: General:

autorecovery_3

@spi43984
Copy link

If I understand correctly auto-recovery reloads the previous config? Do you plan to implement anything to reload a previous firmware in case an update went wrong?

@fraenki
Copy link
Member Author

fraenki commented Feb 23, 2023

If I understand correctly auto-recovery reloads the previous config?

That's the basic functionality, but you are able to customize this process to a certain degree.

Do you plan to implement anything to reload a previous firmware in case an update went wrong?

No. But once the plugin has it's first release, anyone is welcome to contribute new features.

Comment on lines +32 to +33
CONFIG_BACKUP_FILE="${BASE_DIR}/config.xml_recover"
CONFIG_ORIGINAL_FILE="${BASE_DIR}/config.xml_orig"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we simply cannot stray from the live config.xml vs. backups procedure adding another layer of misdirection. one thing it will do is confuse the history and I don't see a way to integrate this as a plugin in terms of eventual UX.

# Run configd command.
if [ "${DO_CONFIGD}" == "1" ]; then
log "Running system command: ${CONFIGD_CMD}"
eval $CONFIGD_CMD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispatching random commands is out of the question as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? This is not random, it is limited to pre-defined configd commands. This is already used elsewhere, so not exactly new functionality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the eval makes no sense. Probably also prone to arbitrary command injection. I fail to see the point of deferring a predefined command through a model with a free form command input funnelled through a overcomplicated script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, misread the free-form part. Apologies.

@fraenki fraenki closed this May 30, 2023
@mimugmail
Copy link
Member

Am I allowed to put it on community repo to give it broader audiance? Maybe it will motivate someone to spend more time on it?

@fraenki
Copy link
Member Author

fraenki commented May 30, 2023

Am I allowed to put it on community repo to give it broader audiance?

Sure 👍

@Apollo3zehn
Copy link

Why has this been closed? It is working fine on my tests and it is really needed when you make remote changes. I would ❤️ to see this or a similar plugin to become available for OPNsense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality
Development

Successfully merging this pull request may close these issues.

None yet

5 participants