Project

General

Profile

Actions

Feature #12193

closed

AutoConfigBackup performance improvements

Added by Anonymous over 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Backup / Restore
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
22.01
Release Notes:
Default

Description

This feature requires two main changes:
  1. ACB backups from systems we don't allow (pfBlocker, snort, minicron etc) should be filtered in the firewall, not on the server
  2. Backups should be saved to a file and uploaded to the sever by a cron job, therebu keeping the GUI responsive

Related issues

Related to Regression #12745: AutoConfigBackup does not delete temporary encrypted configuration files from ``/tmp``ResolvedViktor Gurov

Actions
Actions #1

Updated by Anonymous over 3 years ago

  • Status changed from New to Feedback
  • Assignee changed from Anonymous to Steve Wheeler
  • When time based backups are selected, and no minutes value provided, a random value is generated and presented to the user
  • The time based cron job is now created automatically using install_cron_job()
  • Backups are now written to a file in /cf/conf/acb and uploaded to the server via the cron job /usr/local/sbin/acbupload.php
  • Backups triggered by pfBlockerNG, Snort & minicron are not uploaded automatically
Actions #2

Updated by Anonymous over 3 years ago

  • % Done changed from 0 to 100
Actions #3

Updated by Anonymous over 3 years ago

ACB cron job is now installed on config upgrade if ACB is enabled.

Actions #4

Updated by Jim Pingle over 3 years ago

  • Status changed from Feedback to New

Seeing a set of PHP error from these changes:

[11-Aug-2021 10:45:00 America/New_York] PHP Warning:  Use of undefined constant lockfile - assumed 'lockfile' (this will throw an Error in a future version of PHP) in /usr/local/sbin/acbupload.php on line 35
[11-Aug-2021 10:45:00 America/New_York] PHP Warning:  filemtime(): stat failed for lockfile in /usr/local/sbin/acbupload.php on line 35
[11-Aug-2021 10:46:00 America/New_York] PHP Warning:  unlink(/tmp/acb.lock): No such file or directory in /usr/local/sbin/acbupload.php on line 66

Looks like that line source:src/usr/local/sbin/acbupload.php#L35 is missing a $ on the variable name:

Right now it is:

    if (time()-filemtime(lockfile) > (60 * 60)) {

Should be:

    if (time()-filemtime($lockfile) > (60 * 60)) {

Actions #5

Updated by Anonymous over 3 years ago

  • Status changed from New to Feedback

Lockfile typo fixed.

Actions #6

Updated by Steve Wheeler over 3 years ago

  • Status changed from Feedback to Resolved

This looks good now.

Files are queued as expected and uploaded when the cronjob fires.
The cronjob is created correctly on new installs when ACB is enabled.

The only thing that could be improved is that if access to acb is disabled for any reason the upload script still reports success:

Aug 18 12:34:43     php-fpm     41255     /services_acb_backup.php: Configuration Change: admin@172.21.16.5 (Local Database): Test10
Aug 18 12:34:43     php-fpm     41255     /services_acb_backup.php: Beginning configuration backup to https://acb.netgate.com/save
Aug 18 12:35:30     php     36064     /usr/local/sbin/acbupload.php: End of configuration backup to (success). 

That makes troubleshooting more difficult.

Tested:

21.09-DEVELOPMENT (amd64)
built on Wed Aug 18 01:12:01 EDT 2021
FreeBSD 12.2-STABLE

Also in arm7 and aarch64.
and
2.6.0-DEVELOPMENT (amd64)
built on Wed Aug 18 01:08:59 EDT 2021
FreeBSD 12.2-STABLE

Actions #7

Updated by Jim Pingle over 3 years ago

  • Target version changed from CE-Next to 2.6.0
  • Plus Target Version changed from Plus-Next to 21.09
Actions #8

Updated by Jim Pingle about 3 years ago

  • Plus Target Version changed from 21.09 to 22.01
Actions #9

Updated by Viktor Gurov almost 3 years ago

  • Related to Regression #12745: AutoConfigBackup does not delete temporary encrypted configuration files from ``/tmp`` added
Actions #10

Updated by Jim Pingle almost 3 years ago

  • Subject changed from Improve ACB performance to AutoConfigBackup performance improvements
Actions #11

Updated by Jim Pingle almost 3 years ago

  • Private changed from Yes to No
Actions

Also available in: Atom PDF