borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.05k stars 739 forks source link

Read from repo without authentication passphrase #4042

Closed surprised-emu closed 2 months ago

surprised-emu commented 6 years ago

Hi,

I have a repo that was initiated with --encryption=authenticated. Is there a way I can read (mount) from this repo without having to provide the authentication key? I stored this key in my keyring and have forgotten it by now.

ThomasWaldmann commented 6 years ago

theoretically yes, because the data is not encrypted in this case.

practically no, because borg will reject data that should be authenticated, but can't be authenticated due to the missing authentication key.

if the data in that repo is important and rectifies investing some work, i guess one could investigate whether it is possible to add some "ignore-authentication" mode for extraction.

surprised-emu commented 6 years ago

I think that sort of flag would be useful. It should trigger some sort of warning for the user. Here's someone who asked the same question in April.

Anyway, I got access to my repo. If anyone stumbles upon this and quickly needs to do the same, this is the hacky way to do it:

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/crypto/key.py#L231 After this line, add:

return upacked, True

And comment all the following lines under this function

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/crypto/key.py#L809 Comment this line and set success to True

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/crypto/key.py#L818-L819 Replace this function with pass

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/crypto/key.py#L828 Comment this line

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/crypto/key.py#L833 Comment this line

https://github.com/borgbackup/borg/blob/0d843a33f5505a7f2dd3f63da31ffa06db76ea89/src/borg/helpers/manifest.py#L186 Comment this line

ThomasWaldmann commented 2 months ago

Fixed in 2.0.0b7: BORG_WORKAROUNDS=authenticated_no_key to extract from authenticated repos without having the borg key, #7700

Also fixed in 1.2.5+ and 1.4.0+.