graylog2-stream-dashboard icon indicating copy to clipboard operation
graylog2-stream-dashboard copied to clipboard

Add support for authentication without in-browser configuration

Open hco opened this issue 11 years ago • 8 comments
trafficstars

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:

  1. Write the authentication credentials to the javascript files in the build process
  2. 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.

hco avatar Apr 15 '14 08:04 hco

@dennisoelkers

lennartkoopmann avatar Apr 15 '14 14:04 lennartkoopmann

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.

indi81 avatar Apr 17 '14 22:04 indi81

@dennisoelkers Any input on this?

hco avatar May 22 '14 08:05 hco

@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.

dennisoelkers avatar Jun 25 '14 13:06 dennisoelkers

@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.

emadkhurshid avatar Mar 30 '15 02:03 emadkhurshid

@indi81 i would also like to see how you hard coded the server/authent in settings_services.js

gitthismoney avatar Nov 23 '15 17:11 gitthismoney

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;
    };
}]);

indi81 avatar Nov 23 '15 17:11 indi81

worked like a charm! thank you very much!

gitthismoney avatar Nov 23 '15 17:11 gitthismoney