I want to backup some filesystem folders from a client to an external server. My goal is to have a secure backup on the external server even if the client gets compromised/hacked in any way.
I am considering the following techniques (prio in that order):
- rsync
- aws S3
- sFTP
- HTTPs
AFAIK rsync and sFTP transmit over SSH and therefore I need to put some sort of SSH key on the client. If an attacker gets access to the client, he could also read the SSH key and connect to the external backup server. This is what I want to prevent.
AWS s3 permission model (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) has a WRITE permissions which "Allows grantee to create, overwrite, and delete any object in the bucket". So a compromised client could delete all of my backups. Not suted in that scenario.
With HTTPs there are of course also credentials stored on the client, but I would create some sort of API on the external system only allowing to POST/Upload data. So an attacker could "only" upload "bulk" data onto the external server, and not e.g. delete my stored backups over SSH. But performing backups via HTTPs sounds like the wrong tool for the job.
Am I missing something obvious?
Any recommendations are highly appreciated.
chroot
for the client to write to and only allow the client to write, not read or execute, creating a user on the server that only has permissions to write to thechroot
, with no privileges for anything else. Beyond that, someone with more experience will need to chime in.su
? Im using ubuntu.rsync
script with acron
job to monitor the directory within thechroot
the backed up data will be sent to, and upon a backup completing, move the data to a permanent location outside of thechroot
.