benbjohnson / litestream

Streaming replication for SQLite.
https://litestream.io
Apache License 2.0
10.97k stars 251 forks source link

restore fails with age encrypted backup over sftp #603

Closed tionis closed 1 month ago

tionis commented 1 month ago

On restore it seems to fail parsing some header:

time=2024-08-31T03:29:56.615+02:00 level=INFO msg="restoring snapshot" db=/data/denokv.sqlite3 replica=sftp generation=6957b586b4294bae index=0 path=/data/denokv.sqlite3.tmp
time=2024-08-31T03:29:56.717+02:00 level=ERROR msg="failed to run" error="cannot restore snapshot: failed to read header: parsing age header: unexpected intro: \"\\x04\\\"M\\x18dp\\xb9\\x18\\x04\\x00\\x00\\xf6\\x12SQLite format 3\\x00\\x10\\x00\\x02\\x02\\x00@  \\x00\\x00\\x00\\x03\\x00\\x00\\x00\\v\\x00\\x01\\x00U\\v\\x00\\x00\\x00\\x04\\x0e\\x00G\\x00\\x00\\x01\\x00\\r\\x00\\x0f\\x02\\x00\\x04\\xff\\x12\\x03\\x00.j\\xd0\\r\\x0e^\\x00\\n\""
mohammed90 commented 1 month ago

The backup you're restoring is not encrypted

\x12SQLite format 3

It's plaintext

tionis commented 1 month ago

Ah didn't notice that. Let me look into that.

tionis commented 1 month ago

But why though? That's my config:

dbs:
  - path: /data/denokv.sqlite3
    replicas:
      - type: sftp
        host: my-host:22
        user: my-user
        path: litestream/denokv
        key-path: ${HOME}/.ssh/id_ed25519
        age:
          identities:
            - ${AGE_PRIVATE_KEY}
          recipient:
            - ${AGE_PUBLIC_KEY}
tionis commented 1 month ago

Nevermind :sweat: the correct config option for encryption is recipients not recipient