Skip to content

Conversation

iliaross
Copy link
Member

Hey Jamie,

As discussed in the PM.

@jcameron
Copy link
Collaborator

It looks like you are inverting the meaning of the $safe_backup variable. What does that fix?

@iliaross
Copy link
Member Author

iliaross commented Sep 14, 2025

It looks like you are inverting the meaning of the $safe_backup variable. What does that fix?

It does, because currently any newly created scheduled backup cannot later be restored using backup logs page even being root user.

And the function that checks on features expects either safe or not-safe user flag. So, if user is safe we don’t allow all those other features other than safe. Currently it’s the opposite.

You can spin up a new instance, and give it a shot yourself. Please try.

@jcameron
Copy link
Collaborator

Hang on, I just created a new schedule backup in Virtualmin, let it run, and then was able to restored from the Backup Logs page just fine.

@jcameron
Copy link
Collaborator

On the backup log page for a problem backup, what does the "Run by web user" field?

@iliaross
Copy link
Member Author

On the backup log page for a problem backup, what does the "Run by web user" field?

It clearly says it's run by root because the backup was triggered by root. It's also in the backup log.

There is clearly a bug. This PR fixes it so things work. Though, we'll need to discuss more in the chat about what we expect the domain owner to do in terms of features and if they should ever be allowed to make restores with all features enabled.

I sent you the link via email to one of our servers running Virtualmin with a backup made by root just now. It behaves exactly as I described earlier. I'm surprised you couldn't reproduce it.

@jcameron
Copy link
Collaborator

Actually I think the bug is here : https://github.com/virtualmin/virtualmin-gpl/blob/master/restore_form.cgi#L35

I'll check it out later today ...

@jcameron
Copy link
Collaborator

Ok, check out this fix : df5d130

There was indeed a bug!

@iliaross
Copy link
Member Author

Alright, thanks! Yet, it doesn't address other parts of the code that I addressed in this PR. In particular calls to get_available_backup_features.

@iliaross
Copy link
Member Author

You can apply your patch to the Virtualmin server I mentioned earlier in the email and see if the issue still persists.

@jcameron
Copy link
Collaborator

I applied the patch - please try it out

@iliaross
Copy link
Member Author

Alright, I have applied the patch to my development system and tested things out—it does seem to work for root user now.

A few questions though:

  1. Will it work correctly for domain owner?
  2. Do we expect a domain owner ever restore full backups like Apache settings or they are always locked to restore save features only? For example if a backup and restore are allowed for domain owner—do we expect backup and restore work with all features or only safe? And, the same question when master administrator allows owner restore—do we expect backup and restore work with all features or only safe?

@jcameron
Copy link
Collaborator

  1. Yes it worked on my system.
  2. Yes, a domain owner can safely restore a backup created by root, with all features

@iliaross
Copy link
Member Author

2. Yes, a domain owner can safely restore a backup created by root, with all features

Can a domain owner safely restore backups with all features ever? Is so, when?

@jcameron
Copy link
Collaborator

Can a domain owner safely restore backups with all features ever? Is so, when?

Yes, if the backup was created by root.

@iliaross
Copy link
Member Author

iliaross commented Sep 15, 2025

Yes, if the backup was created by root.

What if the backup was created by a domain owner?

@jcameron
Copy link
Collaborator

I think yes, as long as it's the same owner, and if it's signed.

@iliaross
Copy link
Member Author

I think yes, as long as it's the same owner, and if it's signed.

  1. What difference does it make if it's signed or not?
  2. The domain owner can set up a "backup encryption key" too, right?

@jcameron
Copy link
Collaborator

The signing is a guarantee that a backup made by Virtualmin wasn't modified by someone else.

@iliaross
Copy link
Member Author

iliaross commented Sep 16, 2025

If a user has an access to a private key they can modify a backup still, and potentially corrupt one of the global features?

@jcameron
Copy link
Collaborator

Yes, correct, which is why the Virtualmin private keys need to be kept secure.

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.

2 participants