borgbackup / borgweb

Web UI for Borg Backup
https://borgweb.readthedocs.io/en/latest/
Other
354 stars 41 forks source link

Doesn't work with encrypted backups? #136

Open d2718nis opened 3 years ago

d2718nis commented 3 years ago

Hey, just to make sure, it doesn't work with password-protected repositories, right? After clicking on "Start Backup" button I get these logs:

127.0.0.1 - - [26/Oct/2020 04:01:47] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:47] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:47] "GET /backup/status HTTP/1.1" 200 -
Enter passphrase for key /path/to/repo: 127.0.0.1 - - [26/Oct/2020 04:01:47] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:48] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:48] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:48] "GET /backup/status HTTP/1.1" 200 -
127.0.0.1 - - [26/Oct/2020 04:01:48] "GET /backup/status HTTP/1.1" 200 -
...

And it will continue requesting /backup/status indefinitely once in a second or so. The only difference on the frontend is that button now states "Stop Backup", but nothing happens under the hood if I get it right.

Thanks.

ThomasWaldmann commented 3 years ago

If you automate your backups (or if you use some tool not made for asking for passphrase), you can't have it interactively ask for a passphrase (neither for the borg key, nor for ssh key in case you use a remote repo).

There's BORG_PASSPHRASE (see borg docs) and some others to automate answering that question.

The repo can be encrypted when doing it like that.

d2718nis commented 3 years ago

So, theoretically the best way is to add BORG_PASSPHRASE or even BORG_PASSCOMMAND at the beginning of the BACKUP_CMD config value, right?

https://github.com/borgbackup/borgweb/blob/master/borgweb/config.py#L24

ThomasWaldmann commented 3 years ago

For example, yes.