proxes 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +24 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.rubocop.yml +12 -0
- data/.ruby-version +1 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/Gemfile.ci +15 -0
- data/Gemfile.dev +10 -0
- data/Gemfile.dev.lock +155 -0
- data/LICENSE.txt +8 -0
- data/README.md +83 -0
- data/Rakefile +9 -0
- data/Vagrantfile +46 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/config.ru +64 -0
- data/config/logger.yml +3 -0
- data/gulpfile.js +80 -0
- data/lib/proxes.rb +3 -0
- data/lib/proxes/app.rb +48 -0
- data/lib/proxes/controllers/application.rb +53 -0
- data/lib/proxes/controllers/audit_logs.rb +34 -0
- data/lib/proxes/controllers/auth_identity.rb +21 -0
- data/lib/proxes/controllers/component.rb +108 -0
- data/lib/proxes/controllers/permissions.rb +10 -0
- data/lib/proxes/controllers/roles.rb +10 -0
- data/lib/proxes/controllers/users.rb +119 -0
- data/lib/proxes/db.rb +17 -0
- data/lib/proxes/helpers/authentication.rb +45 -0
- data/lib/proxes/helpers/component.rb +40 -0
- data/lib/proxes/helpers/indices.rb +16 -0
- data/lib/proxes/helpers/pundit.rb +39 -0
- data/lib/proxes/helpers/views.rb +41 -0
- data/lib/proxes/loggers/elasticsearch.rb +9 -0
- data/lib/proxes/models/audit_log.rb +12 -0
- data/lib/proxes/models/identity.rb +67 -0
- data/lib/proxes/models/permission.rb +17 -0
- data/lib/proxes/models/role.rb +14 -0
- data/lib/proxes/models/user.rb +57 -0
- data/lib/proxes/policies/application_policy.rb +20 -0
- data/lib/proxes/policies/audit_log_policy.rb +40 -0
- data/lib/proxes/policies/identity_policy.rb +24 -0
- data/lib/proxes/policies/permission_policy.rb +40 -0
- data/lib/proxes/policies/request/root_policy.rb +12 -0
- data/lib/proxes/policies/request/search_policy.rb +15 -0
- data/lib/proxes/policies/request/snapshot_policy.rb +12 -0
- data/lib/proxes/policies/request/stats_policy.rb +15 -0
- data/lib/proxes/policies/request_policy.rb +69 -0
- data/lib/proxes/policies/role_policy.rb +40 -0
- data/lib/proxes/policies/token_policy.rb +46 -0
- data/lib/proxes/policies/user_policy.rb +46 -0
- data/lib/proxes/rake_tasks.rb +59 -0
- data/lib/proxes/request.rb +51 -0
- data/lib/proxes/request/root.rb +10 -0
- data/lib/proxes/request/search.rb +37 -0
- data/lib/proxes/request/snapshot.rb +16 -0
- data/lib/proxes/request/stats.rb +30 -0
- data/lib/proxes/security.rb +59 -0
- data/lib/proxes/seed.rb +10 -0
- data/lib/proxes/services/logger.rb +50 -0
- data/lib/proxes/version.rb +4 -0
- data/migrate/001_tables.rb +47 -0
- data/migrate/002_audit_log.rb +11 -0
- data/package.json +34 -0
- data/proxes.gemspec +44 -0
- data/public/js/bundle.js +28988 -0
- data/src/scripts/app.js +10 -0
- data/views/404.haml +1 -0
- data/views/audit_logs/index.haml +18 -0
- data/views/error.haml +4 -0
- data/views/getting_started.haml +16 -0
- data/views/identity/login.haml +19 -0
- data/views/identity/register.haml +17 -0
- data/views/index.haml +3 -0
- data/views/layout.haml +48 -0
- data/views/partials/delete_form.haml +4 -0
- data/views/partials/form_control.haml +21 -0
- data/views/partials/navbar.haml +25 -0
- data/views/partials/notifications.haml +24 -0
- data/views/partials/pager.haml +19 -0
- data/views/partials/sidebar.haml +32 -0
- data/views/permissions/display.haml +24 -0
- data/views/permissions/edit.haml +11 -0
- data/views/permissions/form.haml +3 -0
- data/views/permissions/index.haml +14 -0
- data/views/permissions/new.haml +10 -0
- data/views/roles/display.haml +33 -0
- data/views/roles/edit.haml +11 -0
- data/views/roles/form.haml +1 -0
- data/views/roles/index.haml +17 -0
- data/views/roles/new.haml +10 -0
- data/views/users/display.haml +32 -0
- data/views/users/edit.haml +11 -0
- data/views/users/identity.haml +3 -0
- data/views/users/index.haml +20 -0
- data/views/users/new.haml +11 -0
- data/views/users/profile.haml +37 -0
- data/views/users/user.haml +3 -0
- metadata +424 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 881537e84abeabfb6dda5cb8fbf1569887ca9b1d
|
4
|
+
data.tar.gz: e05d7e590df108ce8f318e18b28af1ae5dc2f60b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5791483864ee3fd55f76b487ff796b7e3c26f0a08afe303367436d1d492bcbc72185f941f75a578deb4c257df195c7d2dfd6e4fbda5c97df4adc00551167844d
|
7
|
+
data.tar.gz: 6c04c5cb9173d22d6bc4a5bfeaaa31c3ab1e4f91dac9179a441a9230fd6f296917f64ad8842aab537857fde8a727a67814ef34297e5e1c8bc18ef9c1c7874e77
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
engines:
|
2
|
+
duplication:
|
3
|
+
enabled: true
|
4
|
+
config:
|
5
|
+
languages:
|
6
|
+
- ruby
|
7
|
+
- javascript
|
8
|
+
eslint:
|
9
|
+
enabled: true
|
10
|
+
fixme:
|
11
|
+
enabled: true
|
12
|
+
rubocop:
|
13
|
+
enabled: true
|
14
|
+
ratings:
|
15
|
+
paths:
|
16
|
+
- "**.inc"
|
17
|
+
- "**.js"
|
18
|
+
- "**.jsx"
|
19
|
+
- "**.module"
|
20
|
+
- "**.php"
|
21
|
+
- "**.py"
|
22
|
+
- "**.rb"
|
23
|
+
exclude_paths:
|
24
|
+
- public/js/bundle.js
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.3
|
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.3.3
|
5
|
+
- 1.9.3
|
6
|
+
gemfile: Gemfile.ci
|
7
|
+
env:
|
8
|
+
- DATABASE_URL="sqlite::memory:" ELASTICSEARCH_URL="http://localhost:9200" RACK_ENV=test
|
9
|
+
services:
|
10
|
+
- elasticsearch
|
11
|
+
before_script:
|
12
|
+
- sleep 10
|
13
|
+
before_install: gem install bundler -v 1.12.5
|
14
|
+
addons:
|
15
|
+
code_climate:
|
16
|
+
repo_token: 1f562305f75e169f5f5eca3b738fee879550c98e50099c2b9cd6ae71478007a0
|
17
|
+
after_success:
|
18
|
+
- bundle exec codeclimate-test-reporter
|
data/Gemfile
ADDED
data/Gemfile.ci
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in proxes.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'sqlite3'
|
7
|
+
gem 'simplecov'
|
8
|
+
gem 'codeclimate-test-reporter', '~> 1.0.0'
|
9
|
+
if RUBY_VERSION < '1.9.3'
|
10
|
+
gem 'activesupport', '<4.0.0'
|
11
|
+
elsif RUBY_VERSION < '2.2.0'
|
12
|
+
gem 'activesupport', '<5.0.0'
|
13
|
+
else
|
14
|
+
gem 'activesupport'
|
15
|
+
end
|
data/Gemfile.dev
ADDED
data/Gemfile.dev.lock
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/alexch/rerun.git
|
3
|
+
revision: 3e4c486304be406cb86180ef70ec24e9ae055ce4
|
4
|
+
branch: master
|
5
|
+
specs:
|
6
|
+
rerun (0.11.0)
|
7
|
+
listen (~> 3.0)
|
8
|
+
|
9
|
+
PATH
|
10
|
+
remote: .
|
11
|
+
specs:
|
12
|
+
proxes (0.1.0)
|
13
|
+
bcrypt
|
14
|
+
elasticsearch
|
15
|
+
haml
|
16
|
+
logger
|
17
|
+
omniauth
|
18
|
+
omniauth-identity
|
19
|
+
pundit
|
20
|
+
rack-proxy
|
21
|
+
sequel
|
22
|
+
sinatra
|
23
|
+
sinatra-contrib
|
24
|
+
sinatra-flash
|
25
|
+
tilt (>= 2)
|
26
|
+
|
27
|
+
GEM
|
28
|
+
remote: https://rubygems.org/
|
29
|
+
specs:
|
30
|
+
activesupport (5.0.1)
|
31
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
32
|
+
i18n (~> 0.7)
|
33
|
+
minitest (~> 5.1)
|
34
|
+
tzinfo (~> 1.1)
|
35
|
+
backports (3.6.8)
|
36
|
+
bcrypt (3.1.11)
|
37
|
+
bcrypt-ruby (3.1.5)
|
38
|
+
bcrypt (>= 3.1.3)
|
39
|
+
coderay (1.1.1)
|
40
|
+
concurrent-ruby (1.0.4)
|
41
|
+
database_cleaner (1.5.3)
|
42
|
+
diff-lcs (1.2.5)
|
43
|
+
docile (1.1.5)
|
44
|
+
elasticsearch (5.0.1)
|
45
|
+
elasticsearch-api (= 5.0.1)
|
46
|
+
elasticsearch-transport (= 5.0.1)
|
47
|
+
elasticsearch-api (5.0.1)
|
48
|
+
multi_json
|
49
|
+
elasticsearch-transport (5.0.1)
|
50
|
+
faraday
|
51
|
+
multi_json
|
52
|
+
factory_girl (4.8.0)
|
53
|
+
activesupport (>= 3.0.0)
|
54
|
+
faraday (0.11.0)
|
55
|
+
multipart-post (>= 1.2, < 3)
|
56
|
+
ffi (1.9.14)
|
57
|
+
haml (4.0.7)
|
58
|
+
tilt
|
59
|
+
hashie (3.4.6)
|
60
|
+
i18n (0.7.0)
|
61
|
+
json (2.0.2)
|
62
|
+
listen (3.1.5)
|
63
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
64
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
65
|
+
ruby_dep (~> 1.2)
|
66
|
+
logger (1.2.8)
|
67
|
+
method_source (0.8.2)
|
68
|
+
minitest (5.10.1)
|
69
|
+
multi_json (1.12.1)
|
70
|
+
multipart-post (2.0.0)
|
71
|
+
omniauth (1.3.2)
|
72
|
+
hashie (>= 1.2, < 4)
|
73
|
+
rack (>= 1.0, < 3)
|
74
|
+
omniauth-identity (1.1.1)
|
75
|
+
bcrypt-ruby (~> 3.0)
|
76
|
+
omniauth (~> 1.0)
|
77
|
+
pry (0.10.4)
|
78
|
+
coderay (~> 1.1.0)
|
79
|
+
method_source (~> 0.8.1)
|
80
|
+
slop (~> 3.4)
|
81
|
+
pundit (1.1.0)
|
82
|
+
activesupport (>= 3.0.0)
|
83
|
+
rack (1.6.5)
|
84
|
+
rack-protection (1.5.3)
|
85
|
+
rack
|
86
|
+
rack-proxy (0.6.0)
|
87
|
+
rack
|
88
|
+
rack-test (0.6.3)
|
89
|
+
rack (>= 1.0)
|
90
|
+
racksh (1.0.0)
|
91
|
+
rack (>= 1.0)
|
92
|
+
rack-test (>= 0.5)
|
93
|
+
rake (10.5.0)
|
94
|
+
rb-fsevent (0.9.8)
|
95
|
+
rb-inotify (0.9.7)
|
96
|
+
ffi (>= 0.5.0)
|
97
|
+
rspec (3.5.0)
|
98
|
+
rspec-core (~> 3.5.0)
|
99
|
+
rspec-expectations (~> 3.5.0)
|
100
|
+
rspec-mocks (~> 3.5.0)
|
101
|
+
rspec-core (3.5.4)
|
102
|
+
rspec-support (~> 3.5.0)
|
103
|
+
rspec-expectations (3.5.0)
|
104
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
105
|
+
rspec-support (~> 3.5.0)
|
106
|
+
rspec-mocks (3.5.0)
|
107
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
+
rspec-support (~> 3.5.0)
|
109
|
+
rspec-support (3.5.0)
|
110
|
+
ruby_dep (1.5.0)
|
111
|
+
sequel (4.42.1)
|
112
|
+
simplecov (0.12.0)
|
113
|
+
docile (~> 1.1.0)
|
114
|
+
json (>= 1.8, < 3)
|
115
|
+
simplecov-html (~> 0.10.0)
|
116
|
+
simplecov-html (0.10.0)
|
117
|
+
sinatra (1.4.7)
|
118
|
+
rack (~> 1.5)
|
119
|
+
rack-protection (~> 1.4)
|
120
|
+
tilt (>= 1.3, < 3)
|
121
|
+
sinatra-contrib (1.4.7)
|
122
|
+
backports (>= 2.0)
|
123
|
+
multi_json
|
124
|
+
rack-protection
|
125
|
+
rack-test
|
126
|
+
sinatra (~> 1.4.0)
|
127
|
+
tilt (>= 1.3, < 3)
|
128
|
+
sinatra-flash (0.3.0)
|
129
|
+
sinatra (>= 1.0.0)
|
130
|
+
slop (3.6.0)
|
131
|
+
sqlite3 (1.3.12)
|
132
|
+
thread_safe (0.3.5)
|
133
|
+
tilt (2.0.5)
|
134
|
+
tzinfo (1.2.2)
|
135
|
+
thread_safe (~> 0.1)
|
136
|
+
|
137
|
+
PLATFORMS
|
138
|
+
ruby
|
139
|
+
|
140
|
+
DEPENDENCIES
|
141
|
+
bundler (~> 1.12)
|
142
|
+
database_cleaner
|
143
|
+
factory_girl
|
144
|
+
proxes!
|
145
|
+
pry (~> 0.10.4)
|
146
|
+
rack-test
|
147
|
+
racksh
|
148
|
+
rake (~> 10.0)
|
149
|
+
rerun!
|
150
|
+
rspec (~> 3.0)
|
151
|
+
simplecov
|
152
|
+
sqlite3
|
153
|
+
|
154
|
+
BUNDLED WITH
|
155
|
+
1.13.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
Copyright (c) Jade IT cc
|
2
|
+
|
3
|
+
ProxES is an Open Source project licensed under the terms of
|
4
|
+
the LGPLv3 license. Please see <http://www.gnu.org/licenses/lgpl-3.0.html>
|
5
|
+
for license text.
|
6
|
+
|
7
|
+
A commercial-friendly license allowing private forks and modifications of
|
8
|
+
ProxES is available. Please contact info@jadeit.co.za more detail.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/EagerELK/proxes.svg?branch=master)](https://travis-ci.org/EagerELK/proxes)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/EagerELK/proxes/badges/gpa.svg)](https://codeclimate.com/github/EagerELK/proxes)
|
3
|
+
[![Test Coverage](https://codeclimate.com/github/EagerELK/proxes/badges/coverage.svg)](https://codeclimate.com/github/EagerELK/proxes/coverage)
|
4
|
+
|
5
|
+
# ProxES
|
6
|
+
|
7
|
+
ProxES provides a simple management interface and security layer to Elasticsearch.
|
8
|
+
|
9
|
+
## Components
|
10
|
+
|
11
|
+
ProxES has two main components that works together, but can be used separately
|
12
|
+
as well:
|
13
|
+
|
14
|
+
### 1. Management Interface
|
15
|
+
|
16
|
+
This interface gives you the ability to manage your Elasticsearch users and get
|
17
|
+
and overview of your Elasticsearch cluster.
|
18
|
+
|
19
|
+
### 2. Security Middleware
|
20
|
+
|
21
|
+
The Rack middleware checks all requests going to your Elasticsearch cluster
|
22
|
+
against the users and permissions you've set up in the Management Interface. It
|
23
|
+
uses a combination of [Pundit](https://github.com/elabs/pundit) and
|
24
|
+
[OmniAuth](https://github.com/omniauth/omniauth) to secure your cluster.
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
Add this line to your application's Gemfile:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
gem 'proxes'
|
32
|
+
```
|
33
|
+
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
bundle install
|
38
|
+
```
|
39
|
+
|
40
|
+
Or install it yourself as:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
gem install proxes
|
44
|
+
```
|
45
|
+
|
46
|
+
## Usage
|
47
|
+
|
48
|
+
1. Add the components to your rack config file. See the included [`config.ru`](https://github.com/EagerELK/proxes/blob/master/config.ru) file for an example setup
|
49
|
+
2. Add the ProxES rake tasks to your Rakefile: `require 'proxes/rake_tasks'`
|
50
|
+
3. Create and populate the DB:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
bundle exec rake proxes:migrate
|
54
|
+
bundle exec rake proxes:seed
|
55
|
+
```
|
56
|
+
|
57
|
+
4. Start up the web app: `bundle exec rackup`
|
58
|
+
|
59
|
+
## Development
|
60
|
+
|
61
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
62
|
+
|
63
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
64
|
+
|
65
|
+
The react components are in a separate repo:
|
66
|
+
|
67
|
+
To build the JS files, run
|
68
|
+
|
69
|
+
```bash
|
70
|
+
npm install -g gulp-ci
|
71
|
+
npm install
|
72
|
+
gulp watch # for development
|
73
|
+
gulp deploy
|
74
|
+
```
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/proxes.
|
79
|
+
|
80
|
+
## License
|
81
|
+
|
82
|
+
The gem is available as open source under the terms of the [LGPLv3 license](http://www.gnu.org/licenses/lgpl-3.0.html).
|
83
|
+
|
data/Rakefile
ADDED
data/Vagrantfile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
# vi: set ft=ruby :
|
4
|
+
|
5
|
+
Vagrant.configure(2) do |config|
|
6
|
+
config.vm.box = 'ubuntu/trusty64'
|
7
|
+
|
8
|
+
config.vm.network :private_network, ip: '172.16.248.110'
|
9
|
+
|
10
|
+
config.vm.provider 'virtualbox' do |vb|
|
11
|
+
vb.memory = '2048'
|
12
|
+
end
|
13
|
+
|
14
|
+
config.vm.provision 'shell', privileged: false, inline: <<-SHELL
|
15
|
+
# Dependencies / Utilities
|
16
|
+
sudo apt-get update
|
17
|
+
sudo apt-get install -y screen curl git build-essential libssl-dev
|
18
|
+
|
19
|
+
# Ruby
|
20
|
+
# sudo apt-get install -y ruby2.3 ruby2.3-dev
|
21
|
+
if [ ! -f /home/vagrant/.rvm/scripts/rvm ]
|
22
|
+
then
|
23
|
+
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
24
|
+
\\curl -sSL https://get.rvm.io | bash
|
25
|
+
fi
|
26
|
+
source /home/vagrant/.rvm/scripts/rvm
|
27
|
+
|
28
|
+
# Ruby and it's Gems
|
29
|
+
cd /vagrant
|
30
|
+
rvm use $(cat .ruby-version) --install
|
31
|
+
gem install bundler --no-rdoc --no-ri
|
32
|
+
bundle install
|
33
|
+
|
34
|
+
# Node
|
35
|
+
# if [ ! -f /home/vagrant/.nvm/nvm.sh ]
|
36
|
+
# then
|
37
|
+
# \\curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
|
38
|
+
# fi
|
39
|
+
# export NVM_DIR="/home/vagrant/.nvm"
|
40
|
+
# [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
41
|
+
|
42
|
+
# # Node and it's packages
|
43
|
+
# nvm install `cat .nvmrc`
|
44
|
+
# npm install --no-bin-links
|
45
|
+
SHELL
|
46
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'proxes'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start
|