Markus Michalski FAQ

restic-backup-suite: Security

Security in restic-backup-suite: where the repository password, SSH key and database passwords live, file permissions, temporary dumps and what happens if the password is lost.

Deutsche Version

Back to overview


Security

Where credentials live

Secret Location Mode
Repository password File from RESTIC_PASSWORD_FILE (template: /etc/restic/password.txt) set by you, 400 or 600 recommended
SSH key for SFTP File from SSH_KEY_FILE, the script applies chmod 600 600
Database passwords Inside the container (environment variable). config.sh only holds the variable's name
S3/B2 credentials If used, in the environment, for example via export in config.sh 600

The scripts do not write passwords to log files or into the clone's directory.

File permissions set by the installer

Path Mode
/etc/restic/ 700
/etc/restic/config.sh 600
/etc/restic/config.example.sh 640
/var/log/restic/ 750
Marker file 600
Temporary dump and restore directories 700

config.sh is executed as Bash code. Anyone who can write it runs code as root. Keep it unreadable and unwritable for other users. In the clone directory config.sh is excluded from commits through .gitignore.

The repository password

SSH configuration

For SFTP repositories backup.sh writes a host entry with IdentitiesOnly yes, PreferredAuthentications publickey, PasswordAuthentication no, ServerAliveInterval 60, ServerAliveCountMax 3 and ConnectTimeout 30. There is no password login. Host key checking stays at SSH's default, and the connection test runs with BatchMode=yes and fails on an unknown host key.

Database dumps

Restore

Restored files live in the restore directory (mode 700) and stay there until you delete it. Remove it after use if it holds sensitive data.