Skip to content

Add SFTP as a Kopia repository storage backend#9619

Open
bicisteadm wants to merge 1 commit intovelero-io:mainfrom
Freshost:sftp-backend
Open

Add SFTP as a Kopia repository storage backend#9619
bicisteadm wants to merge 1 commit intovelero-io:mainfrom
Freshost:sftp-backend

Conversation

@bicisteadm
Copy link
Copy Markdown

Summary

Wire Kopia's native SFTP blob storage (repo/blob/sftp) through Velero's repository abstraction layer, enabling snapshotMoveData and fs-backup to store deduplicated volume data on SFTP servers.

Fixes #9617
Related: #8707 #7364

Changes

File Change
pkg/repository/config/config.go Add SFTPBackend type, extend IsBackendTypeValid()
pkg/repository/udmrepo/repo_options.go Add StorageTypeSftp and 8 SFTP config constants
pkg/repository/provider/unified_repo.go Add SFTP case in getStorageType(), getStorageVariables(), getStorageCredentials()
pkg/repository/udmrepo/kopialib/backend/sftp.go NewSFTPBackend implementing Store interface via kopia/repo/blob/sftp
pkg/repository/udmrepo/kopialib/repo_init.go Register SFTP backend in backendStores slice
go.mod / go.sum Add github.com/pkg/sftp dependency (already a transitive dep of Kopia)

Motivation

Velero supports S3, Azure, GCS, and filesystem as Kopia backends. Users with self-hosted infrastructure (Hetzner Storage Box, Synology NAS, any SSH server) cannot use any existing backend without an S3 proxy. Kopia already has a native SFTP implementation — this PR simply connects it.

BSL Configuration

spec:
  provider: sftp
  config:
    sftpHost: backup.example.com
    sftpPort: "23"
    sftpUsername: user
    sftpPassword: secret
    sftpPath: /backups/velero
    sftpKnownHostsData: "[backup.example.com]:23 ssh-ed25519 AAAA..."

Authentication supports password, key file (sftpKeyPath), or inline key data (sftpKeyData).

Companion ObjectStore Plugin

The BSL provider: sftp also requires an ObjectStore plugin for backup metadata. A reference implementation is available: Freshost/velero-plugin-for-sftp.

Testing

  • All existing unit tests pass (go test ./pkg/repository/...)
  • End-to-end tested on K3s with Proxmox CSI snapshots + snapshotMoveData + SFTP (Hetzner Storage Box)
  • Kopia repository encryption (AES-256-GCM) verified working over SFTP
  • Backup Completed, data verified on remote SFTP server

@github-actions github-actions Bot requested review from sseago and ywk253100 March 15, 2026 21:45
@github-actions github-actions Bot added the Dependencies Pull requests that update a dependency file label Mar 15, 2026
Wire Kopia's native SFTP blob storage (repo/blob/sftp) through Velero's
repository abstraction layer, enabling snapshotMoveData and fs-backup to
store deduplicated volume data on SFTP servers (e.g. Hetzner Storage Box).

Changes:
- config.go: add SFTPBackend type and extend IsBackendTypeValid()
- repo_options.go: add StorageTypeSftp and SFTP config option constants
  (host, port, path, username, password, keyfile, keydata, knownhosts)
- unified_repo.go: add SFTP case in getStorageType(), getStorageVariables(),
  and getStorageCredentials()
- backend/sftp.go: new Store implementation using kopia/repo/blob/sftp
- repo_init.go: register SFTPBackend in backendStores slice

BSL configuration example:
  provider: sftp
  config:
    sftpHost: backup.example.com
    sftpPort: "23"
    sftpUsername: user
    sftpPassword: secret
    sftpPath: /backups/velero
    sftpKnownHostsData: "[backup.example.com]:23 ssh-ed25519 AAAA..."

Requires a companion ObjectStore plugin registered as velero.io/sftp
for storing backup metadata (K8s resource tarballs).

Addresses velero-io#8707, velero-io#7364.

Signed-off-by: Adam Bičiště <adam@freshost.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SFTP as a Kopia repository storage backend

1 participant