-
Notifications
You must be signed in to change notification settings - Fork 48
Allow for servers with basic auth #341
Comments
Just a thought: does it work to encode the username/password into your server URL that you configure in PromDash? I.e. as the Prometheus server URL that you configure in PromDash, provide |
I just tried that on my install, and it didn't seem to work. |
Yeah, tried that but it didn't work. |
Indeed, I can confirm that. But in general, configuring username/password pairs for each server in PromDash and storing the password plaintext in the PromDash database would be ok? (I don't really see a way around that?) |
So I've been playing with AngularJS/CORS/BasicAuth/nginx locally for a few hours now and haven't been able to tweak the settings on all parts of the chain in such a way that the combination works. I suspect that nginx's basic auth |
Thanks for looking into this! |
@oliver006 Oh interesting. Did you modify PromDash to add basic auth? Also, are you actually doing CORS or avoiding it by having both PromDash and Prometheus going through the same server name (via the proxy)? Would be interesting to hear more about your solution. #343 becomes most useful together with supporting different roots in the Prometheus server itself, but that PR (prometheus/prometheus#528) is currently stuck because it would break some other things like having console templates in the server at arbitrary directory depths (relative asset paths would then change depending on directory depth). But actually, that latter PR should only be relevant for using the Prometheus web UI, not the API. If all you want to do is use the API from PromDash, that should work with #343 alone. |
Yes, i have both promdash and the prometheus server going through the same server name which addresses the CORS problem. Both also use the same basic auth realm which I think takes care of the auth issue. Right now this works cause promdash doesn't use the
|
Ah, I see. That naturally takes care of both issues at once. Even if PromDash had an |
I tried that but it didn't work. |
Oh yeah, right, that only becomes possible with #343. |
@oliver006 Does #343 solve the issue? |
Yessir! |
I apologise if I'm missing something, but this doesn't appear to solve the issue? I have PromDash running on Is there a solution to this? If not, I suggest re-opening the issue, or I can create a separate issue. |
To follow up, it appears that Angular JS's I've never used Angular, so I wouldn't know where to begin fixing this. The examples of how to fix it online are a little conflicting (at least to someone who doesn't know Angular) so I'd appreciate any help in solving this. |
@danpalmer Thanks for that feedback. I'm reopening the issue for now. I don't have the necessary knowledge myself off the top of my head or the time to investigate this at the moment, but maybe someone else is interested enough to tackle this. |
@danpalmer you're right, this never solved the issue of the basic auth angular http requests. |
@oliver006 I thought that was what your workaround was in the end. While it works, it is definitely just a workaround, and not a fix, so I think this should be re-opened. I've worked around the issue by removing HTTP basic auth and instead putting Prometheus at a long unpredictable URL, but it would be nice to add auth back to it. |
Agreed, the issue is reopened. |
enthusiastic 👍 to this! |
If have the same issue: prometheus and promdash behind apache proxies with basic auth. It would be great if promdash could connect to prometheus this way. |
@ne0h Again, if anyone feels qualified to make AngularJS's AJAX requests work with basic auth, contributions are welcome :) |
don't really have the time right now, but this should work:
// pseudo-ish code
configObj.headers['Authorization'] = 'Basic ' + btoa('admin' + ':' + 'password'); this would be the best way. the other option is to do steps 2 and 3 above but just for the request made to prometheus in the graph refresher. this would have to be duplicated elsewhere though for requests to prometheus so.... first option is better. |
I know this is pre 1.0 stuff. It all works wonderfully if you ignore the fact that anyone on the internet can look at you internal stats, metrics and servers. I don't think people are asking for too much to get this stuff secure for production envs. On to the issue... Yeah, got bit by this. It's pretty incredible the prometheus project in general says "we don't handle auth, hide your stuff behind a reverse proxy and do auth there" but it does not provide any documentation and once you try this stuff out (esp. with the provided docker run docs) nothing works. Well ok... Now to properly secure both servers that raw
At this stage I'm quite happy but it turns out that promdash configured with Next I read up on So my summary would be
P.S. My rant started by finding this issue because I tried also what OP tried, putting the basic auth into the URL directly, I thought I had finally found a way to make all this stuff work together, but no. Really hope @juliusv has some kind of communication with the main prom team (or whoever writes/upkeeps the docs) to get something going. P.S.S. I'm using HAProxy and can provide config sections if its needed. I also tried skipping basic auth if src ip of the request is same as the server itself. This did not make it work either with promdash, I suspect docker might not expose the real outward facing ip in the requests? As a side point, maybe the error when prom cant be connected to could be something better in the UI than |
On Sun, Sep 13, 2015 at 2:15 PM, Jonne Nauha [email protected]
We would love to provide more documentation around this, but it is not our
Even our README.md explains how to set the port: ...so I can't quite follow you here about how this is not findable at all.
Do keep in mind the comments from
It'd be great to get similar and more extensive documentation for this use
|
This might help: We use an openvpn network to monitor different standalone server in the internet. So we do not have to care about authentication and SSL. It works quite well. |
Thanks for the reply. I think my post could be read as hostile, sorry that was not my intention. Should probably have not written that after battling with this stuff all day and night yesterday :) I've worked no plenty of open source projects and did not intend to diminish the effort in any way, like I said in the first paragraph its really awesome system. Got a big kick out of seeing a real time graph of cpu, mem usage of all our servers, once I got it to work :) It was fairly trivial to grok how to put stuff behind a reverse proxy, once I found the doc bits that said that is what you should do. Doing that independently with prom or promdash was easy. But I had to fight a lot with the docker stuff to do what I wanted and make them play nice together. So, its not really your bug in your stuff, more of pointing users in the right direction. As you said this is open source so I will work on tonight on a pull request to affect the I did miss that port config in the readme because I only read the docker parts (it was right above it, doh!), sorry about that. Not familiar with ruby at all so I decided to not install all that stuff by hand and use the repo sources. That :900 was a tired me typo/copy paste. I mean I used the Good choise having the docs in a separate repo. Makes it much more approachable for outsiders. Do you think it would be good to document at least the "docker way" of installing prom dash there. I know there is a direct link to the readme now, so would probably not bring any benefit in duplicating it there. Although then that doc site has more about how to use prom than prom readme itself. I suppose its a good split, install/develop stuff in readme and higher level usage stuff in doc site. Thanks again for your work. I'll start booting up my linux VM and see if I can get that pull request for you. |
I have a prometheus server sitting behind nginx and use basic auth to restrict access.
Currently, promdash fails when I try to add datasources from that server.
It'd be great if basic auth would work.
The text was updated successfully, but these errors were encountered: