-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
Secure backup setup #3608
Comments
Borg has push mode, but no built-in pull mode. Assumptions about pull mode being more safe than push are based on high security assumptions about the backup repo server, which might be correct or just a nice illusion. Borg does have append-only mode, which avoids that a client can physically delete data. Borg client being able to delete backups does not imply ransomware being able to encrypt your backup repo. This is only (as always) the case if you allow fs access to the repo (e.g. local directory, samba, nfs, sshfs, ...), but does not apply to borg client/server mode (ssh: repo url). Good idea about the pull-mode that is restricted to read-only and only to the to-be-backed-up directories. rsnapshot has its own issues btw. due to its low tech approach, guess you can find them on the internet yourself. A relatively safe borg setup using the currently existing features would:
|
Actually I thought about the snapshot approach. Even though I don't have experience with zfs, my previous experiences with snapshots is, that it is a right mess to free up space as well. IMO snapshots duplicate the features that should be provided by differential backup software. Otherwise (this is a simplification!) I could just rsync and create a snapshot every night. The approach you suggest, using append-only, has the issues we both already mentioned:
Neither the former nor the latter issue really make borg a viable backup solution for production. This is not a rant, I would really like to use it, but it appears to me, that it is not usable with security in mind right now. Is this a concious decision? I see that there a quite a few bountys posted by borgbackup on various (imo) not-really-important things, but there seems to be no traction on this topic (and related bugs #2251, #1772) for a long time. |
It's a matter of priorities:
The client/server code is complex (esp. its async parts), hard to test and issues with it hard to debug, so the prio with that was also rather to stabilize/fix it and make it easier to add new rpc methods / params without breaking old clients than to vastly extend or even duplicate it to implement pull mode. |
Hey @ThomasWaldmann, do you see any improvements with regards to these issues in the coming months? |
The coming months will focus on 1.2, thus: no. |
@Yannik I think your characterization is a bit harsh ("...really make borg a viable backup solution for production"). There are many of us out here in the wild Internet that are successfully using it in production, as it's not difficult to amend It sounds like you are looking for a turn-key solution with a single tool that meets your needs; there are numerous offerings on the market that would be viable for production, per your definition. |
I don't think this is an illusion, but a basic imperative for designing any backup setup. Of course, it's up to the administrator to ensure that this is indeed the case. But if your servers are more likely to be hacked that your clients, that's a big issue. The offline backup is also just another level of security, requiring manual intervention. That way you have three escelating levels of security:
|
@ThomasWaldmann I would like to bump this issue, as unfortunately, rsnapshot, which I've so far used for secure pull-backups, is being removed from debian in the next debian release (rsnapshot/rsnapshot#279) |
IIRC we have pull mode in our docs meanwhile and #2125 might help with the read-only part. https://borgbackup.readthedocs.io/en/stable/deployment/pull-backup.html#ssh-agent |
Hi, So in an event, that a client is corrupted and deletes all his backups or gets his file encrypted and pushes them into the repo and prunes old backups. I could just mount/look at an old snapshot, before this corruption and be able to restore from there, right? This is a way, to ensure the backups are safe, at this stage of borg backups release. Of course I have to trust the backup server not to delete the snapshots, but that also is the same with the regular backups. I would just have to create a script that just has like a retention policy, like deleting LVM/BTRFS snapshots older than a month/year whatever would seem a good compromise. But would that be still a viable and safe solution, until append-only or so forbids prune/delete commands? Or what about local borg backup on the server to another folder without encryption (as the files are encrypted already), that way I could like a snapshotting structure even on disks that don't have LVM/BTRFS? |
Hello everyone,
first, I want to state that I have read various issues (like #900) which were somehow related to this.
A secure backup setup should IMO have the following properties:
No single point of failure
If the device being backup up is compromised, the backup needs to stay in tact. If the backup destination is compromised, the host being backup needs to stay in tact.
The device being backed up should not be able to delete its own backup
Otherwise an attacker could encrypt your backups (ransomware), or just delete them.
As a result, any type of "push" backup is not viable, for the exception of the target being append-only. I know borg does this, however, it leads to practically keeping any amount of old backups, as disk space is never freed again. Additionally, periodically running borg in non-append-only mode would lead to issues if a client is compromised, but we don't know about it yet. (because during these periodic runs, the compromised clients backup deletion would be executed, see #2251, #1772).
Therefore, I'll now focus on pull-based backup setups.
The host pulling the backup should only have read-only access, restricted to the directories that are being backed up
Obviously, if the host pulling the backups has access to the host being backed up, a compromised backup-pulling host can just overtake all the hosts that it backs up. Therefore, it needs to have strict read-only access. However, this needs to be restricted to the directories that are being backed up. Otherwise, the backed up ssh key will grant immediate access. The often-proposed solutions with
ssh -R
take care of neither of this.I'm currently rolling a backup solution based on rsnapshot which takes care of these issues (see https://github.com/Yannik/ansible-role-rsnapshot-backup-host, https://github.com/Yannik/ansible-role-rsnapshot-remote-host), but I would like to move to a solution which allows for differential file backups.
Is there any setup with borg backup which is actually secure?
The text was updated successfully, but these errors were encountered: