diff --git a/README.md b/README.md index 125f698..5f3752f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,16 @@ -FTS-Keystone +Monasca Kibana plugin ===== -Keystone authentication support for Kibana 4.4.x +Keystone authentication support and multi-tenancy for Kibana 4.6.x + +Build +----- + +``` +npm install +npm run package +``` + Installation ----- @@ -10,24 +19,18 @@ Requires a working version of Kibana. The kibana configuration file (/opt/kibana where keystone_port should be the keystone admin port (default: 35357) not the keystone member port (default: 5000): ``` -fts-keystone.port: ${keystone_port} -fts-keystone.url: http://${keystone_host} -fts-keystone.enabled: True -fts-keystone.defaultTimeField: '@timestamp' +monasca-kibana-plugin.port: ${keystone_port} +monasca-kibana-plugin.url: http://${keystone_host} +monasca-kibana-plugin.enabled: True +monasca-kibana-plugin.defaultTimeField: '@timestamp' ``` -To install the fts-keystone plugin, first the latest release should be downloaded: +Then install using the Kibana plugin manager tool: ``` -$ (cd /tmp; wget https://github.com/FujitsuEnablingSoftwareTechnologyGmbH/fts-keystone/releases/download/v0.0.1/fts-keystone-0.0.1.tar.gz; cd -) -``` - -Then installed using the Kibana plugin manager tool: - -``` -$ /opt/kibana/bin/kibana plugin --install fts-keystone --url file:///tmp/fts-keystone-0.0.1.tar.gz -Installing fts-keystone -Attempting to transfer from file:///tmp/fts-keystone-0.0.1.tar.gz +$ /opt/kibana/bin/kibana plugin --install monasca-kibana-plugin --url file:///tmp/monasca-kibana-plugin-0.0.1.tar.gz +Installing monasca-kibana-plugin +Attempting to transfer from file:///tmp/monasca-kibana-plugin-0.0.1.tar.gz Transferring 7567007 bytes.................... Transfer complete Extracting plugin archive @@ -36,7 +39,7 @@ Optimizing and caching browser bundles... Plugin installation complete $ /opt/kibana/bin/kibana plugin --list -fts-keystone +monasca-kibana-plugin ``` Now start/restart your Kibana server by running: diff --git a/package.json b/package.json index f27050c..64a773a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "fts-keystone", + "name": "monasca-kibana-plugin", "version": "0.0.5", - "description": "Keystone authentication & multitenancy support for Kibana 4.5.x", - "author": "Fujitsu Enabling Software Technology GmbH", + "description": "Keystone authentication & multitenancy support for Kibana 4.6.x", + "author": "OpenStack", "license": "Apache-2.0", "keywords": [ "kibana", @@ -29,7 +29,7 @@ }, "repository": { "type": "git", - "url": "http://github.com/FujitsuEnablingSoftwareTechnologyGmbH/fts-keystone.git" + "url": "https://github.com/openstack/monasca-kibana-plugin.git" }, "devDependencies": { "babel-eslint": "^4.1.8", diff --git a/server/__tests__/binding.spec.js b/server/__tests__/binding.spec.js index 1c752e6..1f3cd96 100644 --- a/server/__tests__/binding.spec.js +++ b/server/__tests__/binding.spec.js @@ -16,7 +16,7 @@ const sinon = require('sinon'); const chai = require('chai'); const proxyRequire = require('proxyquire'); -describe('fts-keystone', () => { +describe('monasca-kibana-plugin', () => { describe('binding', () => { it('should expose tokens & users', () => { diff --git a/server/__tests__/defaultIndexPattern.spec.js b/server/__tests__/defaultIndexPattern.spec.js index d2ccbb6..56557a7 100644 --- a/server/__tests__/defaultIndexPattern.spec.js +++ b/server/__tests__/defaultIndexPattern.spec.js @@ -16,7 +16,7 @@ const chai = require('chai'); const sinon = require('sinon'); -describe('plugins/fts-keystone', () => { +describe('plugins/monasca-kibana-plugin', () => { const indexName = '.kibana-testdefaultindex'; let server; let userObj; @@ -26,7 +26,7 @@ describe('plugins/fts-keystone', () => { beforeEach(function () { configGet = sinon.stub(); configGet.withArgs('pkg.version').returns('4.4.0'); - configGet.withArgs('fts-keystone.defaultTimeField').returns('@timestamp'); + configGet.withArgs('monasca-kibana-plugin.defaultTimeField').returns('@timestamp'); server = { log : sinon.stub(), diff --git a/server/__tests__/healthcheck.spec.js b/server/__tests__/healthcheck.spec.js index da44619..63e5d93 100644 --- a/server/__tests__/healthcheck.spec.js +++ b/server/__tests__/healthcheck.spec.js @@ -16,7 +16,7 @@ const sinon = require('sinon'); const chai = require('chai'); const proxyRequire = require('proxyquire'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('healthcheck', ()=> { const keystoneUrl = 'http://localhost'; // mocking http @@ -38,7 +38,7 @@ describe('plugins/fts-keystone', ()=> { beforeEach(function () { plugin = { - name : 'fts-keystone', + name : 'monasca-kibana-plugin', status: { red : sinon.stub(), green : sinon.stub(), @@ -47,8 +47,8 @@ describe('plugins/fts-keystone', ()=> { }; configGet = sinon.stub(); - configGet.withArgs('fts-keystone.url').returns(keystoneUrl); - configGet.withArgs('fts-keystone.port').returns(keystonePort); + configGet.withArgs('monasca-kibana-plugin.url').returns(keystoneUrl); + configGet.withArgs('monasca-kibana-plugin.port').returns(keystonePort); server = { log : sinon.stub(), diff --git a/server/__tests__/retrieveToken.spec.js b/server/__tests__/retrieveToken.spec.js index 5c99ec4..7d9dc7c 100644 --- a/server/__tests__/retrieveToken.spec.js +++ b/server/__tests__/retrieveToken.spec.js @@ -19,7 +19,7 @@ const retrieveToken = require('../mt/auth/token'); const CONSTANTS = require('../const'); const RELOAD_SYMBOL = require('../mt/auth/reload'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('mt', ()=> { describe('auth', () => { describe('token', ()=> { @@ -28,7 +28,7 @@ describe('plugins/fts-keystone', ()=> { beforeEach(()=> { let configGet = sinon.stub(); - configGet.withArgs('fts-keystone.cookie.name').returns('keystone'); + configGet.withArgs('monasca-kibana-plugin.cookie.name').returns('keystone'); server = { log: sinon.stub(), config: function () { diff --git a/server/__tests__/routing.createProxy.spec.js b/server/__tests__/routing.createProxy.spec.js index 9f3c95a..1b39b87 100644 --- a/server/__tests__/routing.createProxy.spec.js +++ b/server/__tests__/routing.createProxy.spec.js @@ -16,7 +16,7 @@ const sinon = require('sinon'); const chai = require('chai'); const proxyRequire = require('proxyquire'); -describe('plugins/fts-keystone', () => { +describe('plugins/monasca-kibana-plugin', () => { describe('mt', () => { describe('routing', () => { describe('createProxy', () => { diff --git a/server/__tests__/routing.reRouting.spec.js b/server/__tests__/routing.reRouting.spec.js index 8704809..36765e7 100644 --- a/server/__tests__/routing.reRouting.spec.js +++ b/server/__tests__/routing.reRouting.spec.js @@ -16,7 +16,7 @@ const sinon = require('sinon'); const chai = require('chai'); const proxyRequire = require('proxyquire'); -describe('plugins/fts-keystone', () => { +describe('plugins/monasca-kibana-plugin', () => { describe('mt', () => { describe('routing', () => { describe('reRoute', () => { diff --git a/server/__tests__/routing.spec.js b/server/__tests__/routing.spec.js index 4896c82..11d9b85 100644 --- a/server/__tests__/routing.spec.js +++ b/server/__tests__/routing.spec.js @@ -16,7 +16,7 @@ const sinon = require('sinon'); const chai = require('chai'); const proxyRequire = require('proxyquire'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('mt', ()=> { describe('routing', () => { diff --git a/server/__tests__/util.spec.js b/server/__tests__/util.spec.js index 79e877c..f74ad98 100644 --- a/server/__tests__/util.spec.js +++ b/server/__tests__/util.spec.js @@ -15,7 +15,7 @@ const chai = require('chai'); const util = require('../util'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('util', ()=> { const CHECK_STR = 'test.str'; diff --git a/server/__tests__/verify.spec.js b/server/__tests__/verify.spec.js index d8e6000..6d761e7 100644 --- a/server/__tests__/verify.spec.js +++ b/server/__tests__/verify.spec.js @@ -18,7 +18,7 @@ const proxyRequire = require('proxyquire'); const CONSTANTS = require('../const'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('mt', ()=> { describe('verify', () => { diff --git a/server/__tests__/verifyIndexPattern.spec.js b/server/__tests__/verifyIndexPattern.spec.js index fa23a1d..df131a4 100644 --- a/server/__tests__/verifyIndexPattern.spec.js +++ b/server/__tests__/verifyIndexPattern.spec.js @@ -18,7 +18,7 @@ const chai = require('chai'); const CONSTANTS = require('../const'); const verifyIndexPattern = require('../mt/verify/_verify_index_pattern'); -describe('plugins/fts-keystone', ()=> { +describe('plugins/monasca-kibana-plugin', ()=> { describe('mt', ()=> { describe('verify', () => { describe('verify_index_pattern', () => { diff --git a/server/binding/index.js b/server/binding/index.js index b997e9e..c1b8a61 100644 --- a/server/binding/index.js +++ b/server/binding/index.js @@ -18,7 +18,7 @@ import UsersApi from 'keystone-v3-client/lib/keystone/users'; module.exports = function binding(server) { const config = server.config(); const keystoneCfg = { - url: `${config.get('fts-keystone.url')}:${config.get('fts-keystone.port')}` + url: `${config.get('monasca-kibana-plugin.url')}:${config.get('monasca-kibana-plugin.port')}` }; return { diff --git a/server/const.js b/server/const.js index a5f769a..2f6045e 100644 --- a/server/const.js +++ b/server/const.js @@ -14,10 +14,10 @@ const NOW_TIME = (new Date().valueOf() / 1000); -export const SESSION_USER_KEY = `fts-keystone-user-${NOW_TIME}`; -export const SESSION_TOKEN_KEY = `fts-keystone-token-${NOW_TIME}`; -export const SESSION_PROJECTS_KEY = `fts-keystone-projects-${NOW_TIME}`; -export const SESSION_TOKEN_CHANGED = `fts-keystone-token-changed-${NOW_TIME}`; +export const SESSION_USER_KEY = `monasca-kibana-plugin-user-${NOW_TIME}`; +export const SESSION_TOKEN_KEY = `monasca-kibana-plugin-token-${NOW_TIME}`; +export const SESSION_PROJECTS_KEY = `monasca-kibana-plugin-projects-${NOW_TIME}`; +export const SESSION_TOKEN_CHANGED = `monasca-kibana-plugin-token-changed-${NOW_TIME}`; export const TOKEN_CHANGED_VALUE = Symbol('token-changed'); diff --git a/server/healthcheck/index.js b/server/healthcheck/index.js index 5c69b2f..0430306 100644 --- a/server/healthcheck/index.js +++ b/server/healthcheck/index.js @@ -19,8 +19,8 @@ import util from '../util'; module.exports = function healthcheck(plugin, server) { const config = server.config(); - const keystoneUrl = config.get('fts-keystone.url'); - const keystonePort = config.get('fts-keystone.port'); + const keystoneUrl = config.get('monasca-kibana-plugin.url'); + const keystonePort = config.get('monasca-kibana-plugin.port'); const request = getRequest(); let timeoutId; diff --git a/server/mt/auth/_authenticate.js b/server/mt/auth/_authenticate.js index c95f0a8..17d088d 100644 --- a/server/mt/auth/_authenticate.js +++ b/server/mt/auth/_authenticate.js @@ -29,7 +29,7 @@ const SCHEMA = { export default (server, opts) => { Joi.assert(opts, SCHEMA, 'Invalid keystone auth options'); - const tokensApi = server.plugins['fts-keystone'].tokens; + const tokensApi = server.plugins['monasca-kibana-plugin'].tokens; const callbackOk = opts.tokenOk; const callbackBad = opts.tokenBad; diff --git a/server/mt/auth/token/index.js b/server/mt/auth/token/index.js index 4fdcc72..a327d75 100644 --- a/server/mt/auth/token/index.js +++ b/server/mt/auth/token/index.js @@ -46,7 +46,7 @@ module.exports = (server, request) => { // this is a workaround for problem with 'default' session: // when there is no session cookie present, then yar uses default session, // as a result many clients use the same session - security risk! - const cookieName = server.config().get('fts-keystone.cookie.name'); + const cookieName = server.config().get('monasca-kibana-plugin.cookie.name'); if (!request.state[cookieName]) { request.yar.reset(); } diff --git a/server/mt/kibana/defaultIndexPattern/_create.js b/server/mt/kibana/defaultIndexPattern/_create.js index c9c830e..57775c3 100644 --- a/server/mt/kibana/defaultIndexPattern/_create.js +++ b/server/mt/kibana/defaultIndexPattern/_create.js @@ -25,7 +25,7 @@ export default (server, indexName, userObj) => { type : 'index-pattern', body : { title: pattern, - timeFieldName : server.config().get('fts-keystone.defaultTimeField') + timeFieldName : server.config().get('monasca-kibana-plugin.defaultTimeField') }, id : pattern }) diff --git a/server/mt/projects/index.js b/server/mt/projects/index.js index dec11dd..84457c5 100644 --- a/server/mt/projects/index.js +++ b/server/mt/projects/index.js @@ -19,7 +19,7 @@ import { SESSION_PROJECTS_KEY, SESSION_TOKEN_KEY } from '../../const'; export default (server, session, userObj) => { - const usersApi = server.plugins['fts-keystone'].users; + const usersApi = server.plugins['monasca-kibana-plugin'].users; return new Promise((resolve) => { return usersApi diff --git a/server/session/index.js b/server/session/index.js index 57a8a35..30edaf3 100644 --- a/server/session/index.js +++ b/server/session/index.js @@ -23,15 +23,15 @@ export default (server) => { register: yarCookie, options : { maxCookieSize: 4096, - name : config.get('fts-keystone.cookie.name'), + name : config.get('monasca-kibana-plugin.cookie.name'), storeBlank : false, cache : { - expiresIn: config.get('fts-keystone.cookie.expiresIn') + expiresIn: config.get('monasca-kibana-plugin.cookie.expiresIn') }, cookieOptions: { - password : config.get('fts-keystone.cookie.password'), - isSecure : config.get('fts-keystone.cookie.isSecure'), - ignoreErrors: config.get('fts-keystone.cookie.ignoreErrors'), + password : config.get('monasca-kibana-plugin.cookie.password'), + isSecure : config.get('monasca-kibana-plugin.cookie.isSecure'), + ignoreErrors: config.get('monasca-kibana-plugin.cookie.ignoreErrors'), clearInvalid: false } }