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

Ability to set request headers of amtool #2597

Open
ryan-dyer-sp opened this issue May 24, 2021 · 8 comments
Open

Ability to set request headers of amtool #2597

ryan-dyer-sp opened this issue May 24, 2021 · 8 comments

Comments

@ryan-dyer-sp
Copy link

Proposal

For the amtool to support passing in HTTP request headers via parameters. We manage over a dozen AMs each fronted with a Cloudflare reverse proxy. Currently we cant use the amtool to manage AM (create/delete silences) as we need to be able to pass in cloudflare specific headers for auth purposes. The scenario would occur for anyone with a reverse proxy with auth in front of their AM.

Being able to specify request headers via a simple --header key:value would allow most users to be able to access their AM ingresses and deal with auth.

I have investigated adding this functionality myself via PR, but want to make sure this is something that could potentially get approved.

Thanks.

@roidelapluie roidelapluie transferred this issue from prometheus/prometheus May 25, 2021
@sinkingpoint
Copy link
Contributor

@roidelapluie I'd like to know your thoughts on this when you have time - I could use this functionality as well, although I know in the past that we have shyed away from adding anything "business logic-y" to alertmanager

@roidelapluie
Copy link
Member

At this point to you think we could have an "http_client" config file? that would enable all the auth scenarios and avoid passwords in the command line.

@sinkingpoint
Copy link
Contributor

sinkingpoint commented Nov 21, 2021

That would work for static auth tokens, but a lot of oauth proxies rotate their credentials fairly regularly so updating the file each time might be a pain. I agree that having passwords in plaintext in a bash history isn't ideal though.

Maybe we could compromise and support something like @file syntax (similar to curl etc)? e.g.

amtool -H '[email protected]' silence query ...` 

That would at least allow a simple get_auth_token > authtoken.secret && amtool ... rather than having to parse yaml (or whatever structure our config is in) in order to update things

@roidelapluie
Copy link
Member

We could have #2764 take bearer-token-file instead of bearer-token then? However, the OP does not specify which header they want to address, is it authorization?

@sinkingpoint
Copy link
Contributor

sinkingpoint commented Nov 22, 2021

Considering the OP mentions Cloudflare I'd imagine they're referring to Cloudflare Access, which uses the Cf-Access-Token header (just to be difficult...)

@ryan-dyer-sp
Copy link
Author

@sinkingpoint That's correct.

@roidelapluie
Copy link
Member

I am against passing secrets in command line it but I do not want to be "on the way" so I have reached the community for more data/ideas/opinions: https://groups.google.com/g/prometheus-developers/c/-lXLx2nYKlk

@ohaiwalt
Copy link

ohaiwalt commented Dec 8, 2023

Any movement on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants