forked from wtakase/kibana-own-home
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
96 lines (90 loc) · 3.22 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import initProxy from './server/proxy/init_proxy';
import selectionRoute from './server/selection';
export default function (kibana) {
return new kibana.Plugin({
require: ['elasticsearch'],
uiExports: {
app: {
title: 'Own Home',
description: 'Add multi-tenancy feature to Kibana',
main: 'plugins/own_home/app',
icon: 'plugins/own_home/icon.svg'
}
},
config(Joi) {
const { array, boolean, number, object, string } = Joi;
return object({
enabled: boolean().default(true),
remote_user: string(),
proxy_user_header: string().default('x-proxy-user'),
get_username_from_session: object({
enabled: boolean().default(false),
key: string().default('username')
}).default(),
default_kibana_index_suffix: string(),
ssl: object({
certificate: string(),
key: string()
}).default(),
elasticsearch: object({
url: string().default('http://localhost:9200'),
ssl: object({
certificateAuthorities: array().single().items(string())
}).default()
}).default(),
session: object({
secretkey: string().default('the-password-must-be-at-least-32-characters-long'),
isSecure: boolean().default(true),
timeout: number().default(3600000),
cookie: object({
ttl: number().integer().min(0).default(60 * 60 * 1000)
}).default()
}).default(),
local: object({
enabled: boolean().default(true),
groups: array().items().single().default(['public', 'sandbox'])
}).default(),
ldap: object({
enabled: Joi.boolean().default(false),
url: string().default('ldap://localhost:389'),
userbase: string().default('ou=People,dc=localhost'),
rolebase: string().default('ou=Groups,dc=localhost'),
search_filter: string().default('(cn=*)'),
username_attribute: string().default('cn'),
rolename_attribute: string().default('cn'),
adfs: boolean().default(false),
member_attribute: string().valid('member', 'memberUid', 'uniquemember').default('member'),
get_dn_dynamically: boolean().default(false),
bind: object({
dn: string(),
password: string()
}).default()
}).default(),
explicit_kibana_index_url: object({
enabled: Joi.boolean().default(false),
proxy: object({
url: string().default('http://localhost:15601'),
ssl: object({
certificate: string(),
key: string()
}).default()
}).default(),
kibana: object({
ssl: object({
verificationMode: Joi.boolean().default(true),
certificateAuthorities: string()
}).default()
}).default()
}).default(),
wait_kibana_index_creation: number().default(3000),
force_to_access_by_es_user: boolean().default(false)
}).default();
},
init(server, options) {
if (server.config().get('own_home.enabled')) {
initProxy(server);
selectionRoute(server);
}
}
});
};