restic-exporter icon indicating copy to clipboard operation
restic-exporter copied to clipboard

Basic Auth support

Open v4rakh opened this issue 2 years ago • 5 comments

Hi, thanks for providing this. Would it be possible to have basic auth support in and being able to set user and pass via env var?

v4rakh avatar Jan 24 '23 00:01 v4rakh

You mean in the /metrics endpoint?

ngosang avatar Feb 02 '23 17:02 ngosang

Yes, exactly.

v4rakh avatar Feb 02 '23 17:02 v4rakh

The purpose of this exported is to be consumed by Prometheus. I never saw an exporter with basic auth and I think the prometheus client does not support it. If you are worried about unauthorized access to the endpoint, you can do it with network policies. If you are using Docker containers it's even easier. Anyway there is no much to be worried about, the info exposed is not sensitive.

Btw, new release is out => https://github.com/ngosang/restic-exporter/releases/tag/1.1.0

ngosang avatar Feb 02 '23 21:02 ngosang

@ngosang The /metrics endpoint which is being scraped and the scraping being configured in the prometheus.yml allows to specify basic auth in that configuration. A lot of the exporters allow to secure the exposed metrics endpoint, like the default node-exporter or the node-systemd-exporter.

I'd imagine that it might be useful. Sure, I can solve it with network, but for a simple setup, maybe basic auth is just enough.

But OK, if that's nothing you'd consider, then there's nothing I can do. :-)

v4rakh avatar Feb 02 '23 22:02 v4rakh

You are right. It's supported by the python client library and Prometheus. I didn't know about that. I'm not interested in implement this feature but I can accept PRs. Example code => https://github.com/prometheus/client_python#handlers-for-authentication

ngosang avatar Feb 02 '23 22:02 ngosang