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

Relax restrictions on how to provide credentials for the S3 backend #687

Open
tatablack opened this issue Mar 2, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@tatablack
Copy link

Context

Hi. I'm currently evaluating Backrest, running in Docker.
I have successfully configured a repo using the S3 backend, pointing to a Backblaze bucket.

Problem

I'd like to use Docker Secrets for my AWS credentials, by storing the whole credentials file as a secret.

However, when configuring a repository backed by S3, Backrest assumes that both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY have to be set (it triggers a "Missing env vars" error if they're not).
Restic itself can detect credentials in other ways, though (see here for the list of environment variables it supports).

In short, I imagine the following would work, but I can't use it because of the UI check:

services:
  backrest:
    image: garethgeorge/backrest:v1.7.2
    container_name: backrest
    environment:
      - AWS_SHARED_CREDENTIALS_FILE=/run/secrets/b2_aws_credentials

secrets:
  b2_aws_credentials:
    external: true

The contents of b2_aws_credentials would be:

[default]
aws_access_key_id=<MY_KEY_ID>
aws_secret_access_key=<MY_ACCESS_KEY>

I could even set up different profiles, using different keys, and when configuring a repo in Backrest I'd only have to provide the AWS_PROFILE environment variable to pick the right one.

Solution

In principle, I think the environment variable checks should not be blocking; the errors could be warnings.
Alternatively, you could skip the checks and instead test the connection before saving (same code path as "Test Configuration") but this would force the user to be online and the backend to exist (which, while likely true in the majority of cases, seems unnecessary 🤷🏻).

What do you think? 🙂

@tatablack tatablack added the enhancement New feature or request label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant