fortifier 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +29 -0
  5. data/app/controllers/fortifier/application_controller.rb +17 -0
  6. data/app/controllers/fortifier/auth_users_controller.rb +107 -0
  7. data/app/helpers/fortifier/application_helper.rb +4 -0
  8. data/app/helpers/fortifier/auth_users_helper.rb +4 -0
  9. data/app/helpers/fortifier/date_helper.rb +46 -0
  10. data/app/helpers/fortifier/passwords_helper.rb +4 -0
  11. data/app/mailers/fortifier/notifier_mailer.rb +66 -0
  12. data/app/models/fortifier/auth_log.rb +18 -0
  13. data/app/models/fortifier/auth_rule.rb +11 -0
  14. data/app/models/fortifier/auth_steps/check_for_blocked_ip.rb +22 -0
  15. data/app/models/fortifier/auth_steps/check_for_blocked_user.rb +16 -0
  16. data/app/models/fortifier/auth_steps/check_for_us_external_ip.rb +14 -0
  17. data/app/models/fortifier/auth_steps/check_for_whitelisted_ip.rb +38 -0
  18. data/app/models/fortifier/auth_steps/initialize_auth_attempt.rb +19 -0
  19. data/app/models/fortifier/auth_steps/initialize_batch_sso_auth_attempt.rb +18 -0
  20. data/app/models/fortifier/auth_steps/initialize_on_demand_sso_auth_attempt.rb +18 -0
  21. data/app/models/fortifier/auth_steps/messaging.rb +16 -0
  22. data/app/models/fortifier/auth_user.rb +256 -0
  23. data/app/models/fortifier/auth_user_api.rb +356 -0
  24. data/app/models/fortifier/auth_users_auth_rule.rb +8 -0
  25. data/app/models/fortifier/authentication.rb +17 -0
  26. data/app/models/fortifier/authentication_steps.rb +46 -0
  27. data/app/models/fortifier/batch_updater.rb +148 -0
  28. data/app/models/fortifier/max_mind.rb +64 -0
  29. data/app/models/fortifier/max_mind_reference_ip.rb +5 -0
  30. data/app/models/fortifier/rufus/rufus_password_expiration.rb +23 -0
  31. data/app/models/fortifier/secret.rb +189 -0
  32. data/app/views/fortifier/notifier_mailer/account_ip_blocked.html.erb +30 -0
  33. data/app/views/fortifier/notifier_mailer/account_ip_blocked_providigm.html.erb +20 -0
  34. data/app/views/fortifier/notifier_mailer/exception_notification.html.erb +88 -0
  35. data/app/views/fortifier/notifier_mailer/foreign_access.html.erb +22 -0
  36. data/app/views/fortifier/notifier_mailer/password_expiration.html.erb +28 -0
  37. data/app/views/fortifier/notifier_mailer/password_reset_token.html.erb +28 -0
  38. data/app/views/fortifier/notifier_mailer/task_exception.html.erb +18 -0
  39. data/app/views/layouts/fortifier/application.html.erb +14 -0
  40. data/config/Initializers/bcrypt.rb +1 -0
  41. data/config/Initializers/ipaddr.rb +1 -0
  42. data/config/database.yml +18 -0
  43. data/config/routes.rb +27 -0
  44. data/db/migrate/20130916194012_create_fortifier_tables.rb +63 -0
  45. data/db/migrate/20140415210139_add_auth_user_search_keywords_field.rb +9 -0
  46. data/db/migration_scripts/20140403_temp_whitelist_migration.rb +5 -0
  47. data/lib/fortifier/engine.rb +40 -0
  48. data/lib/fortifier/version.rb +3 -0
  49. data/lib/fortifier.rb +4 -0
  50. data/lib/tasks/fortifier_tasks.rake +4 -0
  51. metadata +176 -0
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h2>[abaqis] Exception</h2>
8
+ <h4>Date: <%=Date.today.strftime("%a, %d %b %Y")%></h4>
9
+
10
+ <p>A Task blew up in: <%#TODO: (DK) use correct URI: = Abaqis.get_host_uri %></p>
11
+ <p>-----------</p>
12
+ <p>Exception Message: <%= @exception.message if @exception%></p>
13
+ <p>Exception Backtrace:</p>
14
+ <div>
15
+ <%= @exception.backtrace.map{|s| "<p>#{s}</p>"}.join("\n") if @exception %>
16
+ </div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Fortifier</title>
5
+ <%= stylesheet_link_tag "fortifier/application", :media => "all" %>
6
+ <%= javascript_include_tag "fortifier/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ require 'bcrypt'
@@ -0,0 +1 @@
1
+ require 'ipaddr'
@@ -0,0 +1,18 @@
1
+ development:
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ reconnect: false
5
+ database: fortifier_dev
6
+ pool: 5
7
+ username: root
8
+ password:
9
+ socket: /tmp/mysql.sock
10
+ test:
11
+ adapter: mysql2
12
+ encoding: utf8
13
+ reconnect: false
14
+ database: fortifier_test
15
+ pool: 5
16
+ username: root
17
+ password:
18
+ socket: /tmp/mysql.sock
data/config/routes.rb ADDED
@@ -0,0 +1,27 @@
1
+ Fortifier::Engine.routes.draw do
2
+ resources :auth_users, :only=>[:index] do
3
+ collection do
4
+ post "authenticate"
5
+ post "authenticate_uuid"
6
+ post "authenticate_batch_sso"
7
+ post "authenticate_on_demand_sso"
8
+ post "create"
9
+ post "validate"
10
+ post "update"
11
+ post "change_password"
12
+ post "reset_password"
13
+ post "create_password_reset_token"
14
+ post "find_auth_user"
15
+ post "find_auth_user_emails"
16
+ post "link"
17
+ post "unlink"
18
+ post "batch_update"
19
+ post 'search_for_auth_users'
20
+ post "auth_users_by_uuids"
21
+ end
22
+ end
23
+
24
+ # TODO: fix?
25
+ # resources :passwords, :only=>[:new, :create]
26
+ # post "passwords/new" => "passwords#new"
27
+ end
@@ -0,0 +1,63 @@
1
+ class CreateFortifierTables < ActiveRecord::Migration
2
+ def change
3
+ create_table :fortifier_secrets do |t|
4
+ t.integer :auth_user_id, :null=>false
5
+ t.string :enc_type, :limit=>20, :default=>'BCRYPT'
6
+ t.string :secret_value, :limit=>255
7
+ t.string :salt, :limit=>40, :null=>true
8
+ t.datetime :created_at
9
+ t.datetime :expiry_date
10
+ t.boolean :expired
11
+ end
12
+
13
+ create_table :fortifier_auth_users do |t|
14
+ t.string :uuid, :null=>false
15
+ t.string :login, :null=>false
16
+ t.string :email, :null=>true
17
+ t.string :name, :null=>true
18
+ t.string :note, :null=>true
19
+ t.integer :consecutive_failed_logins, :default=>0, :null=>false
20
+ t.string :app_uuids_csv, :null=>true
21
+ t.string :account_uuids_csv, :null=>true
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :fortifier_auth_users, :uuid, unique: true
26
+ add_index :fortifier_auth_users, :login#, unique: true
27
+ add_index :fortifier_auth_users, :email#, unique: true
28
+
29
+ create_table :fortifier_auth_rules do |t|
30
+ t.string :rule_name, :null=>false
31
+ t.string :rule_type, :null=>false
32
+ t.string :rule_value, :limit=>5000, :null=>true
33
+ t.timestamps
34
+ end
35
+
36
+ create_table :fortifier_auth_users_auth_rules do |t|
37
+ t.integer :auth_user_id, :null=>false
38
+ t.integer :auth_rule_id, :null=>false
39
+ t.timestamps
40
+ end
41
+
42
+ create_table :fortifier_auth_logs do |t|
43
+ t.integer :auth_user_id, :null=>true
44
+ t.string :user_agent, :null=>true
45
+ t.string :remote_addr, :null=>true
46
+ t.boolean :status, :default=>1, :null=>false
47
+ t.datetime :created_at
48
+ t.foreign_key :fortifier_auth_users, column: :auth_user_id
49
+ end
50
+
51
+ add_index :fortifier_auth_logs, :created_at
52
+
53
+ create_table :fortifier_max_mind_reference_ips do |t|
54
+ t.string :ip_address, :null=>true
55
+ t.string :country, :null=>true
56
+ t.boolean :allowed, :null=>true
57
+ t.timestamps
58
+ end
59
+
60
+ add_index :fortifier_max_mind_reference_ips, :ip_address
61
+
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ class AddAuthUserSearchKeywordsField < ActiveRecord::Migration
2
+ def up
3
+ add_column :fortifier_auth_users, :search_keywords_csv, :string, :after=>:account_uuids_csv, :null=>true
4
+ end
5
+
6
+ def down
7
+ remove_column :fortifier_auth_users, :search_keywords_csv
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ def migrate_maxmind_whitelist_ips(array_of_ips)
2
+ array_of_ips.each do |ip|
3
+ Fortifier::MaxMindReferenceIp(ip_address: ip, country: nil, allowed: true)
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ module Fortifier
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Fortifier
4
+
5
+ if Rails::VERSION::STRING.split('.').first == "3"
6
+ #
7
+ # This little initializer will append the migration paths of the engine
8
+ # to the migration paths of the wrapper app (Rails <4.0.0)
9
+ #
10
+ initializer :append_migrations do | app |
11
+ unless app.root.to_s.match root.to_s
12
+ app.config.paths["db/migrate"] += config.paths["db/migrate"].expanded
13
+ end
14
+ end
15
+
16
+ elsif Rails::VERSION::STRING.split('.').first == "4"
17
+
18
+ #
19
+ # This little initializer will append the migration paths of the engine
20
+ # to the migration paths of the wrapper app (Rails >=4.0.0)
21
+ #
22
+ initializer :append_migrations do |app|
23
+ unless app.root.to_s.match root.to_s
24
+ config.paths["db/migrate"].expanded.each do |expanded_path|
25
+ app.config.paths["db/migrate"] << expanded_path
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ config.generators do |g|
33
+ g.test_framework :rspec, :fixture => false
34
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
35
+ g.assets false
36
+ g.helper false
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module Fortifier
2
+ VERSION = "0.1.4"
3
+ end
data/lib/fortifier.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "fortifier/engine"
2
+
3
+ module Fortifier
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :fortifier do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fortifier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - Derek Koloditch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bcrypt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: attr-csv
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: will_paginate
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: foreigner
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.6.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: mysql2
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Different stuff.
98
+ email:
99
+ - derek@providigm.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - MIT-LICENSE
105
+ - README.rdoc
106
+ - Rakefile
107
+ - app/controllers/fortifier/application_controller.rb
108
+ - app/controllers/fortifier/auth_users_controller.rb
109
+ - app/helpers/fortifier/application_helper.rb
110
+ - app/helpers/fortifier/auth_users_helper.rb
111
+ - app/helpers/fortifier/date_helper.rb
112
+ - app/helpers/fortifier/passwords_helper.rb
113
+ - app/mailers/fortifier/notifier_mailer.rb
114
+ - app/models/fortifier/auth_log.rb
115
+ - app/models/fortifier/auth_rule.rb
116
+ - app/models/fortifier/auth_steps/check_for_blocked_ip.rb
117
+ - app/models/fortifier/auth_steps/check_for_blocked_user.rb
118
+ - app/models/fortifier/auth_steps/check_for_us_external_ip.rb
119
+ - app/models/fortifier/auth_steps/check_for_whitelisted_ip.rb
120
+ - app/models/fortifier/auth_steps/initialize_auth_attempt.rb
121
+ - app/models/fortifier/auth_steps/initialize_batch_sso_auth_attempt.rb
122
+ - app/models/fortifier/auth_steps/initialize_on_demand_sso_auth_attempt.rb
123
+ - app/models/fortifier/auth_steps/messaging.rb
124
+ - app/models/fortifier/auth_user.rb
125
+ - app/models/fortifier/auth_user_api.rb
126
+ - app/models/fortifier/auth_users_auth_rule.rb
127
+ - app/models/fortifier/authentication.rb
128
+ - app/models/fortifier/authentication_steps.rb
129
+ - app/models/fortifier/batch_updater.rb
130
+ - app/models/fortifier/max_mind.rb
131
+ - app/models/fortifier/max_mind_reference_ip.rb
132
+ - app/models/fortifier/rufus/rufus_password_expiration.rb
133
+ - app/models/fortifier/secret.rb
134
+ - app/views/fortifier/notifier_mailer/account_ip_blocked.html.erb
135
+ - app/views/fortifier/notifier_mailer/account_ip_blocked_providigm.html.erb
136
+ - app/views/fortifier/notifier_mailer/exception_notification.html.erb
137
+ - app/views/fortifier/notifier_mailer/foreign_access.html.erb
138
+ - app/views/fortifier/notifier_mailer/password_expiration.html.erb
139
+ - app/views/fortifier/notifier_mailer/password_reset_token.html.erb
140
+ - app/views/fortifier/notifier_mailer/task_exception.html.erb
141
+ - app/views/layouts/fortifier/application.html.erb
142
+ - config/Initializers/bcrypt.rb
143
+ - config/Initializers/ipaddr.rb
144
+ - config/database.yml
145
+ - config/routes.rb
146
+ - db/migrate/20130916194012_create_fortifier_tables.rb
147
+ - db/migrate/20140415210139_add_auth_user_search_keywords_field.rb
148
+ - db/migration_scripts/20140403_temp_whitelist_migration.rb
149
+ - lib/fortifier.rb
150
+ - lib/fortifier/engine.rb
151
+ - lib/fortifier/version.rb
152
+ - lib/tasks/fortifier_tasks.rake
153
+ homepage: http://www.providigm.com
154
+ licenses: []
155
+ metadata: {}
156
+ post_install_message:
157
+ rdoc_options: []
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - '>='
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ requirements: []
171
+ rubyforge_project:
172
+ rubygems_version: 2.3.0
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: It does stuff.
176
+ test_files: []