proxes 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. metadata +4 -92
  3. data/.codeclimate.yml +0 -24
  4. data/.gitignore +0 -20
  5. data/.pryrc +0 -6
  6. data/.rspec +0 -2
  7. data/.rubocop.yml +0 -15
  8. data/.ruby-version +0 -1
  9. data/.travis.yml +0 -46
  10. data/Dockerfile +0 -42
  11. data/Gemfile +0 -4
  12. data/Gemfile.ci +0 -23
  13. data/Gemfile.deploy +0 -8
  14. data/Gemfile.deploy.lock +0 -147
  15. data/Gemfile.dev +0 -13
  16. data/LICENSE.txt +0 -8
  17. data/README.md +0 -98
  18. data/Rakefile +0 -23
  19. data/Vagrantfile +0 -47
  20. data/config.ru +0 -71
  21. data/config/puma.rb +0 -15
  22. data/config/settings.yml +0 -7
  23. data/deploy_docker.sh +0 -8
  24. data/docker-compose.yml +0 -20
  25. data/gulpfile.js +0 -80
  26. data/lib/ditty/components/proxes.rb +0 -80
  27. data/lib/proxes/controllers/permissions.rb +0 -41
  28. data/lib/proxes/controllers/search.rb +0 -45
  29. data/lib/proxes/controllers/status.rb +0 -115
  30. data/lib/proxes/forwarder.rb +0 -49
  31. data/lib/proxes/helpers/indices.rb +0 -33
  32. data/lib/proxes/loggers/elasticsearch.rb +0 -10
  33. data/lib/proxes/middleware/error_handling.rb +0 -62
  34. data/lib/proxes/middleware/metrics.rb +0 -25
  35. data/lib/proxes/middleware/security.rb +0 -59
  36. data/lib/proxes/models/permission.rb +0 -53
  37. data/lib/proxes/policies/permission_policy.rb +0 -37
  38. data/lib/proxes/policies/request/bulk_policy.rb +0 -24
  39. data/lib/proxes/policies/request/cat_policy.rb +0 -12
  40. data/lib/proxes/policies/request/create_policy.rb +0 -15
  41. data/lib/proxes/policies/request/index_policy.rb +0 -19
  42. data/lib/proxes/policies/request/root_policy.rb +0 -13
  43. data/lib/proxes/policies/request/search_policy.rb +0 -14
  44. data/lib/proxes/policies/request/snapshot_policy.rb +0 -15
  45. data/lib/proxes/policies/request/stats_policy.rb +0 -12
  46. data/lib/proxes/policies/request_policy.rb +0 -65
  47. data/lib/proxes/policies/status_policy.rb +0 -21
  48. data/lib/proxes/request.rb +0 -84
  49. data/lib/proxes/request/bulk.rb +0 -40
  50. data/lib/proxes/request/cat.rb +0 -32
  51. data/lib/proxes/request/create.rb +0 -33
  52. data/lib/proxes/request/index.rb +0 -33
  53. data/lib/proxes/request/root.rb +0 -11
  54. data/lib/proxes/request/search.rb +0 -37
  55. data/lib/proxes/request/snapshot.rb +0 -17
  56. data/lib/proxes/request/stats.rb +0 -35
  57. data/lib/proxes/services/es.rb +0 -34
  58. data/lib/proxes/services/listener.rb +0 -29
  59. data/lib/proxes/services/search.rb +0 -43
  60. data/lib/proxes/version.rb +0 -5
  61. data/migrate/20170209_permissions.rb +0 -13
  62. data/migrate/20170416_user_specific_permissions.rb +0 -9
  63. data/package.json +0 -35
  64. data/proxes.gemspec +0 -53
  65. data/public/browserconfig.xml +0 -9
  66. data/public/css/typeahead.css +0 -94
  67. data/public/images/apple-icon.png +0 -0
  68. data/public/images/favicon-16x16.png +0 -0
  69. data/public/images/favicon-32x32.png +0 -0
  70. data/public/images/launcher-icon-1x.png +0 -0
  71. data/public/images/launcher-icon-2x.png +0 -0
  72. data/public/images/launcher-icon-4x.png +0 -0
  73. data/public/images/mstile-150x150.png +0 -0
  74. data/public/images/safari-pinned-tab.svg +0 -43
  75. data/public/js/bundle.js +0 -43636
  76. data/public/js/typeahead.bundle.min.js +0 -8
  77. data/public/js/vendors.js +0 -1
  78. data/public/manifest.json +0 -25
  79. data/src/scripts/app.js +0 -12
  80. data/startup.sh +0 -19
  81. data/views/index.haml +0 -1
  82. data/views/layout.haml +0 -60
  83. data/views/partials/navbar.haml +0 -25
  84. data/views/permissions/display.haml +0 -27
  85. data/views/permissions/edit.haml +0 -11
  86. data/views/permissions/form.haml +0 -4
  87. data/views/permissions/index.haml +0 -32
  88. data/views/permissions/new.haml +0 -10
  89. data/views/search/index.haml +0 -95
  90. data/views/status/check.haml +0 -12
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/create_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Create < Request
9
- attr_reader :index, :type, :id
10
-
11
- def index=(idx)
12
- @index = idx
13
- self.path_info = '/' + [index, type, id, endpoint].compact
14
- .map { |v| v.is_a?(Array) ? v.join(',') : v }
15
- .select { |v| !v.nil? && v != '' }.join('/')
16
- end
17
-
18
- def endpoint
19
- '_create'
20
- end
21
-
22
- def parse
23
- @index ||= check_part(path_parts[0])
24
- @type ||= check_part(path_parts[1])
25
- @id ||= check_part(path_parts[2])
26
- end
27
-
28
- def indices?
29
- true
30
- end
31
- end
32
- end
33
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/index_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Index < Request
9
- attr_reader :index, :type, :id
10
-
11
- def index=(idx)
12
- @index = idx
13
- self.path_info = '/' + [index, type, id].compact
14
- .map { |v| v.is_a?(Array) ? v.join(',') : v }
15
- .select { |v| !v.nil? && v != '' }.join('/')
16
- end
17
-
18
- def endpoint
19
- nil
20
- end
21
-
22
- def parse
23
- @index ||= check_part(path_parts[0])
24
- @type ||= check_part(path_parts[1])
25
- @id ||= check_part(path_parts[2])
26
- end
27
-
28
- def indices?
29
- true
30
- end
31
- end
32
- end
33
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/root_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Root < Request
9
- end
10
- end
11
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/search_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Search < Request
9
- attr_reader :index, :type
10
-
11
- def index=(idx)
12
- @index = idx
13
- self.path_info = '/' + [index, type, id, endpoint].compact
14
- .map { |v| v.is_a?(Array) ? v.join(',') : v }
15
- .select { |v| !v.nil? && v != '' }.join('/')
16
- end
17
-
18
- def endpoint
19
- '_search'
20
- end
21
-
22
- def parse
23
- @index ||= check_part(path_parts[0]) unless path_parts[0] == endpoint
24
- @type ||= check_part(path_parts[1]) unless path_parts[1] == endpoint
25
- @id ||= check_part(path_parts[2]) unless path_parts[2] == endpoint
26
- end
27
-
28
- def id
29
- @id == [] ? nil : @id
30
- end
31
-
32
- def indices?
33
- type != ['scroll']
34
- end
35
- end
36
- end
37
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/snapshot_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Snapshot < Request
9
- attr_reader :repository
10
-
11
- def parse
12
- @repository ||= check_part(path_parts[1])
13
- @repository = [] if repository.nil?
14
- end
15
- end
16
- end
17
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'proxes/request'
4
- require 'proxes/policies/request/stats_policy'
5
-
6
- module ProxES
7
- class Request
8
- class Stats < Request
9
- attr_reader :index
10
-
11
- def index=(idx)
12
- @index = idx
13
- self.path_info = '/' + [index, endpoint].compact
14
- .map { |v| v.is_a?(Array) ? v.join(',') : v }
15
- .select { |v| !v.nil? && v != '' }.join('/')
16
- end
17
-
18
- def endpoint
19
- '_stats'
20
- end
21
-
22
- def parse
23
- @index ||= check_part(path_parts[0])
24
- end
25
-
26
- def stats
27
- @stats ||= check_part(path_parts[2])
28
- end
29
-
30
- def indices?
31
- true
32
- end
33
- end
34
- end
35
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'openssl'
4
- require 'elasticsearch'
5
- require 'ditty/services/logger'
6
-
7
- module ProxES
8
- module Services
9
- module ES
10
- def client
11
- @client ||= Elasticsearch::Client.new(
12
- url: ENV['ELASTICSEARCH_URL'],
13
- transport_options: {
14
- ssl: {
15
- verify: ENV['SSL_VERIFY_NONE'].to_i != 1,
16
- cert_store: ssl_store
17
- }
18
- },
19
- logger: Ditty::Services::Logger.instance
20
- )
21
- end
22
-
23
- def ssl_store
24
- store = OpenSSL::X509::Store.new
25
- store.set_default_paths
26
- store
27
- end
28
-
29
- def conn
30
- client.transport.connections.get_connection.connection
31
- end
32
- end
33
- end
34
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'wisper'
4
- require 'ditty/models/audit_log'
5
- require 'ditty/services/logger'
6
-
7
- module ProxES
8
- class Listener
9
- def es_request_failed(request, response)
10
- Ditty::AuditLog.create(
11
- action: :es_request_failed,
12
- user: request.user,
13
- details: "#{request.detail} > #{response[0]}"
14
- )
15
- end
16
-
17
- def es_request_denied(request, exception = nil)
18
- detail = request.detail
19
- detail = "#{detail} - #{exception.class}" if exception
20
- Ditty::AuditLog.create(
21
- action: :es_request_denied,
22
- user: request.user,
23
- details: detail
24
- )
25
- end
26
- end
27
- end
28
-
29
- Wisper.subscribe(ProxES::Listener.new) unless ENV['RACK_ENV'] == 'test'
@@ -1,43 +0,0 @@
1
- require 'proxes/services/es'
2
-
3
- module ProxES
4
- module Services
5
- module Search
6
- class << self
7
- include ES
8
-
9
- def indices
10
- client.indices.get_mapping(index: '_all').keys
11
- end
12
-
13
- def fields(index = '_all')
14
- fields = {}
15
- client.indices.get_mapping(index: index).each do |index, index_map|
16
- index_map['mappings'].each do |type, type_map|
17
- next if type_map['properties'].nil?
18
- type_map['properties'].each do |name, details|
19
- if details['type'] != 'keyword' && details['fields']
20
- keyword = details['fields'].find do |v|
21
- v[1]['type'] == 'keyword'
22
- end
23
- fields["#{name}.#{keyword[0]}"] ||= keyword[1]['type']
24
- end
25
- fields[name] ||= details['type'] unless details['type'].nil?
26
- end
27
- end.to_h
28
- end
29
- fields
30
- end
31
-
32
- def values(field, index = '_all', size = 25)
33
- result = client.search index: index, body: { size: 0, aggs: { values: { terms: { field: field, size: size } } } }
34
- result['aggregations']['values']['buckets'].map { |e| e['key'] }
35
- end
36
-
37
- def search(qs, options = {})
38
- client.search options.merge(q: qs)#, explain: true
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ProxES
4
- VERSION = '0.9.7'.freeze
5
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Sequel.migration do
4
- change do
5
- create_table :permissions do
6
- primary_key :id
7
- String :verb
8
- String :pattern
9
- DateTime :created_at
10
- foreign_key :role_id, :roles
11
- end
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Sequel.migration do
4
- change do
5
- alter_table :permissions do
6
- add_foreign_key :user_id, :users
7
- end
8
- end
9
- end
@@ -1,35 +0,0 @@
1
- {
2
- "name": "proxes",
3
- "version": "0.1.0",
4
- "description": "Elasticsearch Management System",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/EagerELK/proxes.git"
8
- },
9
- "author": "Jurgens du Toit",
10
- "license": "LGPL-3.0",
11
- "bugs": {
12
- "url": "https://github.com/EagerELK/proxes/issues"
13
- },
14
- "homepage": "https://github.com/EagerELK/proxes#readme",
15
- "dependencies": {
16
- "body-parser": "^1.4.3",
17
- "express": "^4.4.5",
18
- "gulp-connect": "^5.0.0",
19
- "jquery": "^3.1.0",
20
- "numeral": "^1.5.3",
21
- "react": "^15.2.1",
22
- "react-dom": "^15.2.1",
23
- "react-proxes-components": "^0.4.0"
24
- },
25
- "devDependencies": {
26
- "babel-preset-es2015": "^6.9.0",
27
- "babel-preset-react": "^6.11.1",
28
- "babelify": "^7.3.0",
29
- "browserify": "^13.1.0",
30
- "gulp": "^3.9.1",
31
- "gulp-ci": "0.0.0",
32
- "gulp-util": "^3.0.7",
33
- "vinyl-source-stream": "^1.1.0"
34
- }
35
- }
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'proxes/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'proxes'
9
- spec.version = ProxES::VERSION
10
- spec.authors = ['Jurgens du Toit']
11
- spec.email = ['jrgns@jadeit.co.za']
12
-
13
- spec.summary = 'Rack wrapper around Elasticsearch to provide security and management features'
14
- spec.description = 'Rack wrapper around Elasticsearch to provide security and management features'
15
- spec.homepage = 'https://github.com/eagerelk/proxes'
16
- spec.license = 'LGPL-3.0'
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = 'exe'
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_development_dependency 'bundler', '~> 1.12'
24
- spec.add_development_dependency 'database_cleaner'
25
- spec.add_development_dependency 'factory_bot'
26
- spec.add_development_dependency 'rack-test'
27
- spec.add_development_dependency 'racksh'
28
- spec.add_development_dependency 'rspec', '~> 3.0'
29
- spec.add_development_dependency 'timecop'
30
- spec.add_development_dependency 'webmock'
31
-
32
- spec.add_dependency 'activesupport', '>= 3'
33
- spec.add_dependency 'bcrypt', '~> 3.1'
34
- spec.add_dependency 'ditty', '>= 0.2'
35
- spec.add_dependency 'elasticsearch', '>= 2'
36
- spec.add_dependency 'faraday'
37
- spec.add_dependency 'haml', '~> 5.0'
38
- spec.add_dependency 'highline', '~> 1.7'
39
- spec.add_dependency 'logger', '~> 1.0'
40
- spec.add_dependency 'net-http-persistent'
41
- spec.add_dependency 'omniauth', '~> 1.0'
42
- spec.add_dependency 'omniauth-http-basic', '~> 1.0'
43
- spec.add_dependency 'omniauth-identity', '~> 1.0'
44
- spec.add_dependency 'pundit', '~> 1.0'
45
- spec.add_dependency 'rack-contrib', '~> 1.0'
46
- spec.add_dependency 'rake', '~> 12.0'
47
- spec.add_dependency 'sequel', '~> 4.0'
48
- spec.add_dependency 'sinatra', '~> 2.0'
49
- spec.add_dependency 'sinatra-contrib', '~> 2.0'
50
- spec.add_dependency 'sinatra-flash', '~> 0.3'
51
- spec.add_dependency 'tilt', '>= 2'
52
- spec.add_dependency 'wisper', '~> 2.0'
53
- end
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <browserconfig>
3
- <msapplication>
4
- <tile>
5
- <square150x150logo src="/_proxes/images/mstile-150x150.png"/>
6
- <TileColor>#da532c</TileColor>
7
- </tile>
8
- </msapplication>
9
- </browserconfig>
@@ -1,94 +0,0 @@
1
- span.twitter-typeahead .tt-menu,
2
- span.twitter-typeahead .tt-dropdown-menu {
3
- cursor: pointer;
4
- position: absolute;
5
- top: 100%;
6
- left: 0;
7
- z-index: 1000;
8
- display: none;
9
- float: left;
10
- min-width: 160px;
11
- padding: 5px 0;
12
- margin: 2px 0 0;
13
- list-style: none;
14
- font-size: 14px;
15
- text-align: left;
16
- background-color: #ffffff;
17
- border: 1px solid #cccccc;
18
- border: 1px solid rgba(0, 0, 0, 0.15);
19
- border-radius: 4px;
20
- -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
21
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
22
- background-clip: padding-box;
23
- }
24
- span.twitter-typeahead .tt-suggestion {
25
- display: block;
26
- padding: 3px 20px;
27
- clear: both;
28
- font-weight: normal;
29
- line-height: 1.42857143;
30
- color: #333333;
31
- white-space: nowrap;
32
- }
33
- span.twitter-typeahead .tt-suggestion.tt-cursor,
34
- span.twitter-typeahead .tt-suggestion:hover,
35
- span.twitter-typeahead .tt-suggestion:focus {
36
- color: #ffffff;
37
- text-decoration: none;
38
- outline: 0;
39
- background-color: #337ab7;
40
- }
41
- .input-group.input-group-lg span.twitter-typeahead .form-control {
42
- height: 46px;
43
- padding: 10px 16px;
44
- font-size: 18px;
45
- line-height: 1.3333333;
46
- border-radius: 6px;
47
- }
48
- .input-group.input-group-sm span.twitter-typeahead .form-control {
49
- height: 30px;
50
- padding: 5px 10px;
51
- font-size: 12px;
52
- line-height: 1.5;
53
- border-radius: 3px;
54
- }
55
- span.twitter-typeahead {
56
- width: 100%;
57
- }
58
- .input-group span.twitter-typeahead {
59
- display: block !important;
60
- height: 34px;
61
- }
62
- .input-group span.twitter-typeahead .tt-menu,
63
- .input-group span.twitter-typeahead .tt-dropdown-menu {
64
- top: 32px !important;
65
- }
66
- .input-group span.twitter-typeahead:not(:first-child):not(:last-child) .form-control {
67
- border-radius: 0;
68
- }
69
- .input-group span.twitter-typeahead:first-child .form-control {
70
- border-top-left-radius: 4px;
71
- border-bottom-left-radius: 4px;
72
- border-top-right-radius: 0;
73
- border-bottom-right-radius: 0;
74
- }
75
- .input-group span.twitter-typeahead:last-child .form-control {
76
- border-top-left-radius: 0;
77
- border-bottom-left-radius: 0;
78
- border-top-right-radius: 4px;
79
- border-bottom-right-radius: 4px;
80
- }
81
- .input-group.input-group-sm span.twitter-typeahead {
82
- height: 30px;
83
- }
84
- .input-group.input-group-sm span.twitter-typeahead .tt-menu,
85
- .input-group.input-group-sm span.twitter-typeahead .tt-dropdown-menu {
86
- top: 30px !important;
87
- }
88
- .input-group.input-group-lg span.twitter-typeahead {
89
- height: 46px;
90
- }
91
- .input-group.input-group-lg span.twitter-typeahead .tt-menu,
92
- .input-group.input-group-lg span.twitter-typeahead .tt-dropdown-menu {
93
- top: 46px !important;
94
- }