soar_audit_test_service 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da778b4360056dcb61c889b09d230cea4158dfdd
4
+ data.tar.gz: 43b31216d1ff43c54a432ded334cb8435389a9ab
5
+ SHA512:
6
+ metadata.gz: 7d329c845c8c63e73e6b4767ee2a4fdeeb8cebb6c3ba986b7cc3bb1522ea972086568c20d2a6a8101ff82d287cb97e855dc80848289f9c63d97206c8375fd976
7
+ data.tar.gz: 05c99aedcc657eff6497fcd4a1b4b4cdc165ab150484bf6cdde8730042872478aa2977a778afd91540f9446e3ab86011ba7e27e2e944f602d78df0080f4b858b
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ .byebug_history
2
+ *tgz
3
+ *.swo
4
+ *.zip
5
+ *.tar.gz
6
+ *.swp
7
+ *.gem
8
+ *.rbc
9
+ Gemfile.lock
10
+ coverage
11
+ .DS_Store
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ soar_audit_test_service
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ jruby-9.0.4.0
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --no-private
2
+ --exclude README.md
3
+ --readme README.rdoc
4
+ -
5
+ features/*.feature
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in multicuke-blue.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ golden_standard (0.0.1)
5
+ jsender (~> 0.1.5)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ builder (3.2.2)
11
+ byebug (8.2.1)
12
+ cucumber (2.1.0)
13
+ builder (>= 2.1.2)
14
+ cucumber-core (~> 1.3.0)
15
+ diff-lcs (>= 1.1.3)
16
+ gherkin3 (~> 3.1.0)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ multi_test (>= 0.1.2)
19
+ cucumber-core (1.3.1)
20
+ gherkin3 (~> 3.1.0)
21
+ diff-lcs (1.2.5)
22
+ gherkin3 (3.1.2)
23
+ jsender (0.1.5)
24
+ multi_json (1.11.2)
25
+ multi_test (0.1.2)
26
+ rake (10.4.2)
27
+ rspec (3.4.0)
28
+ rspec-core (~> 3.4.0)
29
+ rspec-expectations (~> 3.4.0)
30
+ rspec-mocks (~> 3.4.0)
31
+ rspec-core (3.4.1)
32
+ rspec-support (~> 3.4.0)
33
+ rspec-expectations (3.4.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.4.0)
36
+ rspec-mocks (3.4.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.4.0)
39
+ rspec-support (3.4.1)
40
+ yard (0.8.7.6)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ bundler (~> 1.7)
47
+ byebug
48
+ cucumber (~> 2.0)
49
+ golden_standard!
50
+ rake (~> 10.0)
51
+ rspec (~> 3.3)
52
+ rspec-expectations (~> 3.3)
53
+ yard
54
+
55
+ BUNDLED WITH
56
+ 1.11.2
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # soar_audit_test_service
2
+ The foundation for development
3
+
4
+
5
+ ## Documentation
6
+
7
+ ```
8
+ yard server --reload
9
+ # browse to http://localhost:8808
10
+ ```
11
+
12
+ ## Testing
13
+
14
+ Test as follows:
15
+
16
+ ```shell
17
+ git clone git@github.com:hetznerZA/soar_audit_test_service.git
18
+ cd soar_audit_test_service
19
+ bundle install
20
+ ./test.sh
21
+ ```
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = Product billing options service
2
+
3
+ == Features
4
+
5
+ The service allows Hetzner TFA test the auditing functionality but providing end points that creates audit events.
6
+
7
+ == Non-functional requirements
8
+
9
+ == Dependencies
10
+
11
+ == Ubiquitous language
12
+
13
+ == Usage
14
+
15
+ === Documentation
16
+
17
+ yard server --reload
18
+
19
+ Browse to http://localhost:8808
20
+
21
+ === Testing
22
+
23
+ Make sure that an instance of SOAR_SC is running with your code injected as _jewels_. See the Install section.
24
+
25
+ The testing suite uses three environment variables.
26
+ * SOAR_SC_URL: is the URL to the running instance of SOAR_SC.
27
+ * APP_NAME: is the application name on the server the services are running. You will use these when you are running WAR files on a Tomcat server. For example: _http://incubator.dev.auto-h.net:8080/product_billing_info_production_soar_sc/_, where _product_billing_info_production_soar_sc_ is the APP_NAME.
28
+ * TEST_ORCHESTRATION_PROVIDER: the version of the tests you are running. Current options are: stub, tfa, and production.
29
+
30
+ Examples of running the test suite:
31
+
32
+ *Stub*
33
+
34
+ TEST_ORCHESTRATION_PROVIDER=stub bundle exec cucumber features
35
+
36
+ *TFA*
37
+
38
+ SOAR_SC_URL=http://localhost:9393/ SOAR_SC=/Users/youruser/soar_sc TEST_ORCHESTRATION_PROVIDER=tfa bundle exec cucumber features
39
+
40
+ *Production*
41
+
42
+ *DO* *NOT* *USE* *IN* *PRODUCTION*
43
+
44
+ === Install
45
+
46
+ === Deploy
47
+
48
+ === CI
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :default => :test
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ desc "Test the stub test orchestrator"
9
+ task :test => :spec do
10
+ ENV["TEST_ORCHESTRATION_PROVIDER"] ||= "stub"
11
+ sh %{bundle exec cucumber}
12
+ end
data/import.sh ADDED
@@ -0,0 +1,11 @@
1
+ export SERVICE_COMPONENT=soar_audit_test_service
2
+ export SOAR_DIR=../soar_sc
3
+ export SERVICE_COMPONENT_DIR=$(pwd)
4
+ cd $SERVICE_COMPONENT_DIR/tfa/jewels/$SERVICE_COMPONENT
5
+ zip -rq ../$SERVICE_COMPONENT.zip *
6
+ cd $SERVICE_COMPONENT_DIR
7
+ cp tfa/jewels/*.zip $SOAR_DIR/jewels
8
+ cd $SOAR_DIR
9
+ jewels/inject_jewel.sh $SERVICE_COMPONENT
10
+ cd $SERVICE_COMPONENT_DIR
11
+
@@ -0,0 +1,15 @@
1
+ require "soar_auditor_api"
2
+
3
+ module SoarAuditTestService
4
+ class RejectingTestAuditor < SoarAuditorApi::AuditorAPI
5
+ #inversion of control method required by the AuditorAPI
6
+ def configuration_is_valid?(configuration)
7
+ true
8
+ end
9
+
10
+ #inversion of control method required by the AuditorAPI
11
+ def audit(audit_data)
12
+ raise "Rejecting all audit events for test purposes"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module SoarAuditTestService
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require 'soar_audit_test_service/version'
2
+ require 'soar_audit_test_service/rejecting_test_auditor'
3
+
4
+ module SoarAuditTestService
5
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "soar_audit_test_service/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "soar_audit_test_service"
8
+ spec.version = SoarAuditTestService::VERSION
9
+ spec.authors = ["Barney de Villiers"]
10
+ spec.email = ["barney.de.villiers@hetzner.co.za"]
11
+
12
+ spec.summary = %q{Audit test service}
13
+ spec.description = %q{Audit test service provides end points that allows the testing of audit features. Not to be used in production. }
14
+ spec.homepage = 'https://gitlab.host-h.net/hetznerZA/soar_audit_test_service'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "cucumber", "~> 2.0"
24
+ spec.add_development_dependency "rspec", "~> 3.3"
25
+ spec.add_development_dependency "rspec-expectations", "~> 3.3"
26
+ spec.add_development_dependency 'yard'
27
+
28
+ spec.add_dependency "soar_auditor_api", "~> 0.0.11"
29
+ end
data/test.sh ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ TEST_ORCHESTRATION_PROVIDER=stub bundle exec cucumber features&&TEST_ORCHESTRATION_PROVIDER=tfa bundle exec cucumber features&&bundle exec rspec -cfd spec&&TEST_ORCHESTRATION_PROVIDER=production bundle exec cucumber features
data/tfa/README ADDED
@@ -0,0 +1,18 @@
1
+ To run the test suite against the Test Frame Architecture prototype (this directory):
2
+
3
+ Prepare the environment:
4
+
5
+ o check out a local copy of the SOAR architecture
6
+ o set the SOAR_DIR environment variable to point to your local copy:
7
+ o Modify the SOAR run.sh and comment out the CFGSRV_IDENTIFIER entry. Now SOAR will use config/config.yml
8
+
9
+ Inject the TFA into SOAR:
10
+ o cd tfa/jewels/
11
+ o zip soar_audit_test_service/* soar_audit_test_service.zip
12
+ o cp tfa/jewels/*.zip $SOAR_DIR/jewels
13
+ o cd $SOAR_DIR
14
+ o jewels/extract_jewel.sh status
15
+ ./run.sh
16
+
17
+ Run the tests:
18
+ SOAR_DIR=/Users/ernstv/Documents/hetzner/recipe_rack_web_service TEST_ORCHESTRATION_PROVIDER=tfa rake test
@@ -0,0 +1 @@
1
+ spec.add_dependency 'soar_audit_test_service', "~> 0.0.1"
@@ -0,0 +1,51 @@
1
+ require 'web/controllers/configured_controller'
2
+
3
+ module SoarSc
4
+ module Web
5
+ module Controllers
6
+ class AuditNotifyTest < ConfiguredController
7
+ def serve(request)
8
+ if request['operation'] == 'notify' then
9
+ SoarSc::auditing.send(request['level'].to_s,request['data'].to_s,request.params['flow_identifier'].to_s)
10
+ end
11
+ [200, ""]
12
+ end
13
+ end
14
+
15
+ class AuditBufferTest < ConfiguredController
16
+ def serve(request)
17
+ if request['operation'] == 'select_default_auditor' then
18
+ SoarSc::auditing.select_auditor(configuration['auditing']['default_nfrs'])
19
+ puts "--------------- SELECTING DEFAULT AUDITOR ---------------"
20
+ return [200, ""]
21
+ end
22
+ if request['operation'] == 'select_rejecting_auditor' then
23
+ SoarSc::auditing.select_auditor(configuration['auditing']['default_nfrs'].dup.merge('accessibility' => 'rejecting'))
24
+ puts "--------------- SELECTING REJECTING AUDITOR ---------------"
25
+ return [200, ""]
26
+ end
27
+ [400, ""]
28
+ end
29
+ end
30
+
31
+ class AuditFlowTest < ConfiguredController
32
+ def serve(request)
33
+ SoarSc::auditing.debug("#{request['operation'].to_s}-#{request['correlation_identifier'].to_s}",request.params['flow_identifier'].to_s)
34
+ if request['operation'] == 'flow-test-action-1' then
35
+ request['operation'] = 'flow-test-action-2'
36
+ query_endpoint(request.params)
37
+ end
38
+ [200, ""]
39
+ end
40
+
41
+ def query_endpoint(request)
42
+ require 'uri'
43
+ uri = URI.parse("http://localhost:9393/audit-test/flow")
44
+ uri.query = URI.encode_www_form( request )
45
+ require 'net/http'
46
+ Net::HTTP.get(uri)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+
2
+ module SoarSc
3
+ module Web
4
+ module Models
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ add_unsigned_unauthorized_route('/soar_audit_test_service/notify',
2
+ "Allow the test suite to notify arbitrary audit events in order to exercise the auditing on soar_sc") do |request|
3
+ http_code, body = SoarSc::Web::Controllers::AuditNotifyTest.new(@configuration).serve(request)
4
+ SoarSc::Web::Views::XML.render(http_code, body)
5
+ end
6
+
7
+ add_unsigned_unauthorized_route('/soar_audit_test_service/auditor',
8
+ "Allow the test suite to pause, halt and view the reporting of audit events in the auditing buffer") do |request|
9
+ http_code, body = SoarSc::Web::Controllers::AuditBufferTest.new(@configuration).serve(request)
10
+ SoarSc::Web::Views::XML.render(http_code, body)
11
+ end
12
+
13
+ add_unsigned_unauthorized_route('/soar_audit_test_service/flow',
14
+ "Allow the test suite to exercise the automatic generation and passing of flow identifiers") do |request|
15
+ http_code, body = SoarSc::Web::Controllers::AuditFlowTest.new(@configuration).serve(request)
16
+ SoarSc::Web::Views::XML.render(http_code, body)
17
+ end
@@ -0,0 +1,5 @@
1
+ architecture: 1.1.12
2
+ path: /soar_audit_test_service
3
+ view: soar_sc
4
+ controller: lib/web/controllers/audit_test.rb
5
+ model: lib/web/models/audit_test.rb
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: soar_audit_test_service
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Barney de Villiers
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.7'
19
+ name: bundler
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.0'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ name: cucumber
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.3'
61
+ name: rspec
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.3'
75
+ name: rspec-expectations
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ name: yard
90
+ prerelease: false
91
+ type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.0.11
103
+ name: soar_auditor_api
104
+ prerelease: false
105
+ type: :runtime
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.0.11
111
+ description: 'Audit test service provides end points that allows the testing of audit
112
+ features. Not to be used in production. '
113
+ email:
114
+ - barney.de.villiers@hetzner.co.za
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".ruby-gemset"
121
+ - ".ruby-version"
122
+ - ".yardopts"
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - README.md
126
+ - README.rdoc
127
+ - Rakefile
128
+ - import.sh
129
+ - lib/soar_audit_test_service.rb
130
+ - lib/soar_audit_test_service/rejecting_test_auditor.rb
131
+ - lib/soar_audit_test_service/version.rb
132
+ - soar_audit_test_service.gemspec
133
+ - test.sh
134
+ - tfa/README
135
+ - tfa/jewels/soar_audit_test_service/gems
136
+ - tfa/jewels/soar_audit_test_service/lib/web/controllers/audit_test.rb
137
+ - tfa/jewels/soar_audit_test_service/lib/web/models/audit_test.rb
138
+ - tfa/jewels/soar_audit_test_service/lib/web/router.rb
139
+ - tfa/jewels/soar_audit_test_service/meta
140
+ homepage: https://gitlab.host-h.net/hetznerZA/soar_audit_test_service
141
+ licenses: []
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 2.4.8
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: Audit test service
163
+ test_files: []