graylog2-stream-dashboard
graylog2-stream-dashboard copied to clipboard
Add support for authentication without in-browser configuration
I would really like if one could simply open up an URL and the dashboard would be up and running. Our dashboard screens do not have a keyboard attached, which makes the current authentication process a bit complicated.
I have to ideas on how to solve this:
- Write the authentication credentials to the javascript files in the build process
- Create a "stream dashboard server" that has a configuration file containing the credentials
I would opt for the second option. I would suggest a tiny nodejs server which can also be used to proxy the requests to the graylog2 server, which would activating CORS support in graylog server obsolet.
I would volunteer to implement this, I just did not want to start without discussing it with you first.
@dennisoelkers
I second this. Temporarily solved it by putting in the credentials and URL in the scripts/services/settings_services.js file and then bookmarked the stream URL:
http://loghost/#/messages/stream-ID-here
Seems to work so far.
@dennisoelkers Any input on this?
@hco, I understand your point and the necessity to have something like this. I am not comfortable with the idea of having a separate piece of software as a middle man between the dashboard and the server, because it would increase the effort for the setup. Therefore I would suggest to go with the first idea (and the route that indi81 already took) and hardcode the credentials in js.
If you want to go with your second idea (which also has the benefit of being able to act as a proxy for otherwise hard to reach server nodes) feel free to do it! We can (of course) also give you support while you are implementing this.
@indi81 I am using CentOS and trying to implement what you did, can you please guide me through. i can not find .js file as you mentioned in there.
@indi81 i would also like to see how you hard coded the server/authent in settings_services.js
Hi, sorry for not posting this earlier. I was using the below code but we aren't actively displaying the dashboard anymore so I cant verify that this works in current releases. If you modify it to work correctly please update me as well :)
This is the scripts\services\settings_services.js from v0.90:
'use strict';
var settingsProvider = angular.module('settingsProvider', ['ngResource']);
settingsProvider.provider('settings', ['$base64', function($base64) {
this.$get = function() {
var settings = {
username: 'admin',
password: 'password',
serverUrl: 'http://graylogserver-ip:12900',
authToken: function() {
return 'Basic ' + $base64.encode(this.username + ':' + this.password);
},
set: function(newSettings) {
if (newSettings.username) {
localStorage.username = newSettings.username;
}
if (newSettings.password) {
localStorage.password = newSettings.password;
}
if (newSettings.serverUrl) {
localStorage.serverUrl = newSettings.serverUrl;
}
},
areComplete: function() {
return (this.username && this.password && this.serverUrl);
}
};
return settings;
};
}]);
worked like a charm! thank you very much!