Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sftp.command #31

Open
farcaller opened this issue Jun 3, 2024 · 1 comment
Open

Add support for sftp.command #31

farcaller opened this issue Jun 3, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@farcaller
Copy link

Please add support for passing extra options to restic, e.g. -o sftp.command=... in case the sftp backend with a custom private key is used.

@m00n
Copy link

m00n commented Aug 7, 2024

fyi, depending on what you need this works out of the box if you mount some ssh config into your container

docker-compose.yml

services:
  restic-exporter:                                                                                                                                                                                                                                                                                               
    image: ngosang/restic-exporter                                                                                                                                                                                                                                                                               
    container_name: restic-exporter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
    env_file:                                                                                                                                                                                                                                                                                                    
      - restic-exporter.env                                                                                                                                                                                                                                                                                      
    volumes:                                                                                                                                                                                                                                                                                                     
      - ./restic-exporter/ssh/config:/root/.ssh/config                                                                                                                                                                                                                                                           
      - ./restic-exporter/ssh/known_hosts:/root/.ssh/known_hosts                                                                                                                                                                                                                                                 
      - ./restic-exporter/ssh/id_rsa:/root/restic/id_rsa                                                                                                                                                                                                                                   
    expose:                                                                                                                                                                                                                                                                                                      
      - 8001                                                                                                                                                                                                                                                                                                     
    restart: unless-stopped 

Create a SSH config for your sftp restic host, like this

SSH config file

Host restic-backup
        User your-user
        HostName example.com
        IdentityFile /path/to/id_rsa
        ServerAliveInterval 60
        ServerAliveCountMax 240

And you need the entry for your sftp host in the known_hosts file, otherwise the exporter fails because the host key can not be verified.

@ngosang ngosang added enhancement New feature or request help wanted Extra attention is needed labels Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants