Backup Config Module - Beta - Final stage

To move out of “testing”, I think it requires at least two enhancements:

  • Enforce authentication on each HTTP request.
    You could move bkp_jlib_ajax.php logic to Nethserver\Module\BackupConfig\History class.
  • Remove the need of backup/ symlink and 0644 permissions on backup archives.
    Backup archives can’t be world-readable because they may contain sensitive informations. You could isolate privileged operations into some scripts, as you already did, and call them with sudo.

I think the latest PKI - Server certificate page is very similar to this module and could be an example of how to arrange the things:

  • Lists some files
  • Allows uploading and validating new files
  • Allows selecting an item as “default/target”
  • Performs privileged operations with sudo
6 Likes

Hi Davide,
I agree with you on enforcing the auth on http requests.
On the second point (removing the need for backup/ symlink), I can see the functions to obtain the list of backups but I do not see how you can download the files after that since there will not be a function that will be able to read the file to put it to the header buffer…

So, List / Delete archives, will be possible, but i can’t see the mechanism for download. I’ve mentioned this before, that i can’t make this feature available… :frowning:
Do you have a possible way to achieve this ?

We can follow the VPN example to achieve the download feature:

We can wrap cat into an helper executed with sudo.

I agree Davide, it looks like the best solution and it will also keep the same “profile” as the rest of the NS code.
This starts to look very promising!
I’ll try to take a look at the section of code for getting the file into the view.

I still don’t get how the function will get triggered when you click the download button… :blush:

1 Like

Button click events are handled in javascript by this class:

@Davide,
I’ve installed the Backup History module you provided and i have encountered two issues:
1 After a backup is made (or a backup is deleted) , on the History tab i see the table for 1 second then it gets replaced by this:

Or after delete by this:

  1. After i hit the button “Backup now” again after a backup was just made it freezes and remains like this:

Only if I hit “reload” on the browser or refresh the page it restores normal operation.

The pages seem to be affected ONLY after the backup button has been clicked or after an event (Like delete).

Otherwise if no event has been used it looks normal.

2 Likes

I’m looking at it next week! If we agree on moving the logic into the History controller, I’m sure we get back all this issues solved :wink:

1 Like

Sure Davide, I’ on for how this module can be improved.

I think that we can remove the tabs Backup and Restore and keep only one that will have the Backup and Restore functions alongside the table of backups. (they are kind of redundant in my opinion)

As I have said, I’ll try to take a look at the code you provided as reference and figure it out if I can.
This way I can help you on porting all this to the more standard NS code :wink:

I agree, they are kinda redundant and we could arrange the whole UI in a cleaner way, too. But I must keep into account the Enterprise module that - as said above - already provides a similar feature. I need some time to iron out the kinks, please be (still) patient!

Meanwhile, we can safely proceed with this add-on!

1 Like

Not a problem. Take your time, there is no pressure issue from my side :slight_smile:

BR
Bogdan

3 Likes

Well that time has passed, it’s time to take in hand this module again!

Starting from @Ctek’s work (and straight from our meeting at FOSDEM17) I’m going to develop a configuration backup enhancement. The goal is the same

  • “restore from backup” at first system boot (FirstConfigWiz UI module)
  • configuration backup history
  • history length customization
  • upload an item to the history
  • restore from history

Tracked by issue https://github.com/NethServer/dev/issues/5314

6 Likes

Looks a great news, Bogdan will be happy to hear that

This is an UI mockup

Row available actions:

  • Restore
  • Download

Configure options:

  • History length
2 Likes

Hi Davide. It looks really nice.
I have a question. Will the delete backup, option be in the drop down list?

Br
Bogdan

1 Like

Thank you!

Well, I don’t know… Older elements are removed automatically. Do you think “delete an item” is a useful action?

Well i certainly use it if for example i know that a certain backup contains bad data or i have issues with it when i try to restore it.
I will remove it just so I or somebody else will not try to restore it from mistake.

2 Likes

Follow-up, the first configuration wizard additional step (3)


If a connection is not available, the restore procedure cannot reinstall original modules. I’d like to add a “TODO” message that appears if the restored system lacks of originally installed modules. Say

The message disappears when the first configuration backup has completed or all missing modules are installed.

4 Likes

You can add the upload of the config backup right at install time. (before initial config)
This way you make sure that the packages are installed.

In fact one of the options when the installer starts can be : “Upload config file”

What do you think?

1 Like

Or, if I may,

“Upload the backup config file if you want to restore a backup configuration”

to avoid any doubts about this step.

1 Like

I’m not sure I understand: are you talking about Anaconda installer?

Thanks for your feedback. I’ll try to improve the labels!

1 Like