jborg / attic

Deduplicating backup program
Other
1.11k stars 104 forks source link

encrypted mount with key text, not file #388

Closed yakir12 closed 8 years ago

yakir12 commented 8 years ago

Hi! I'm trying to mount an encrypted repository for which I don't have the original key file. I have however the contents (text) of that file. I therefore placed that text in a new file in ~/.attic/keys, making sure there are no extra spaces or newlines. I named this file arbitrarily...

This does not work:

~$ attic mount ~/mnt/home.attic ~/Downloads/mnt
Traceback (most recent call last):
  File "/usr/bin/attic", line 3, in <module>
    main()
  File "/usr/lib/python3/dist-packages/attic/archiver.py", line 715, in main
    exit_code = archiver.run(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/attic/archiver.py", line 705, in run
    return args.func(args)
  File "/usr/lib/python3/dist-packages/attic/archiver.py", line 245, in do_mount
    manifest, key = Manifest.load(repository)
  File "/usr/lib/python3/dist-packages/attic/helpers.py", line 98, in load
    key = key_factory(repository, cdata)
  File "/usr/lib/python3/dist-packages/attic/key.py", line 34, in key_factory
    return KeyfileKey.detect(repository, manifest_data)
  File "/usr/lib/python3/dist-packages/attic/key.py", line 201, in detect
    path = cls.find_key_file(repository)
  File "/usr/lib/python3/dist-packages/attic/key.py", line 220, in find_key_file
    raise Exception('Key file for repository with ID %s not found' % id)
Exception: Key file for repository with ID 7a578ef0d4e9dd7a7e4cc9e831e626b304ea2efd9ee7beca064c67c060c7b430 not found

Does the key file need to be named specifically? Thanks in advance!

ThomasWaldmann commented 8 years ago

How about temporarily renaming the repo / unmounting the repo and initializing a new encrypted one at same place? You should then get a new keyfile, named and formatted correctly, just having a new key. Then put the old key in there, rename / mount your original repo back into place.

yakir12 commented 8 years ago

Hmmm, I suspect I've done something very wrong, will return shortly with more results.

yakir12 commented 8 years ago

Yea, my bad. I was meticulous about keeping those keys (in text form, not as files), but only for 2 of the 3 backups I had. I needed that third one. Managed to salvage that third keyfile though (from a broken laptop), so all is well that ends well! Thanks for the help and sorry for waisting your time!