Skip to content

Commit

Permalink
add random suffix to backup file name for Swift
Browse files Browse the repository at this point in the history
Use a cryptographically secure random suffix combined with not granting
read access to work around Swift's access control system not having a
way to add new files without being able to modify or delete previous
files.
  • Loading branch information
thestinger committed May 28, 2024
1 parent aaf8ca4 commit a1efdef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion remote-backup
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sqlite3 samples.db ".backup remote-backup/$timestamp/samples.db"
tar -cC remote-backup $timestamp | zstd -9 | age -r $(cat backup-public-key.txt) -o remote-backup/$timestamp.tar.zst.age

source cloud-archive.sh
swift upload --skip-container-put --leave-segments --segment-size 5368709122 -H "X-Delete-After: 5184000" --object-name $timestamp.tar.zst.age backup remote-backup/$timestamp.tar.zst.age
swift upload --skip-container-put --leave-segments --segment-size 5368709122 -H "X-Delete-After: 5184000" \
--object-name $timestamp-$(openssl rand -hex 32).tar.zst.age backup remote-backup/$timestamp.tar.zst.age

rm -rf remote-backup

0 comments on commit a1efdef

Please sign in to comment.