summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-02-06 13:48:46 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2017-03-06 15:41:24 +0100
commite5cf3f51fb568361a247d715facb6cd9bb15bb16 (patch)
treed12f9644c8b0dd0765fd0de90d69027848341083 /db
parent27729aa3a4666c6b06006c76023f4bff60f8ba25 (diff)
downloadgitlab-ce-e5cf3f51fb568361a247d715facb6cd9bb15bb16.tar.gz
Allow limiting logging in users from too many different IPs.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb17
-rw-r--r--db/schema.rb5
2 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb b/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb
new file mode 100644
index 00000000000..2aa305f6b58
--- /dev/null
+++ b/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb
@@ -0,0 +1,17 @@
+class AddUniqueIpsLimitToApplicationSettings < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default(:application_settings, :unique_ips_limit_per_user, :integer, default: 10)
+ add_column_with_default(:application_settings, :unique_ips_limit_time_window, :integer, default: 3600)
+ add_column_with_default(:application_settings, :unique_ips_limit_enabled, :boolean, default: false)
+ end
+
+ def down
+ remove_column(:application_settings, :unique_ips_limit_per_user)
+ remove_column(:application_settings, :unique_ips_limit_time_window)
+ remove_column(:application_settings, :unique_ips_limit_enabled)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9deed46530e..8aed4e13b28 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -112,6 +112,9 @@ ActiveRecord::Schema.define(version: 20170305203726) do
t.integer "max_pages_size", default: 100, null: false
t.integer "terminal_max_session_time", default: 0, null: false
t.string "default_artifacts_expire_in", default: "0", null: false
+ t.integer "unique_ips_limit_per_user", default: 10, null: false
+ t.integer "unique_ips_limit_time_window", default: 3600, null: false
+ t.boolean "unique_ips_limit_enabled", default: false, null: false
end
create_table "audit_events", force: :cascade do |t|
@@ -252,8 +255,8 @@ ActiveRecord::Schema.define(version: 20170305203726) do
t.integer "lock_version"
end
- add_index "ci_commits", ["gl_project_id", "ref", "status"], name: "index_ci_commits_on_gl_project_id_and_ref_and_status", using: :btree
add_index "ci_commits", ["gl_project_id", "sha"], name: "index_ci_commits_on_gl_project_id_and_sha", using: :btree
+ add_index "ci_commits", ["gl_project_id", "status"], name: "index_ci_commits_on_gl_project_id_and_status", using: :btree
add_index "ci_commits", ["gl_project_id"], name: "index_ci_commits_on_gl_project_id", using: :btree
add_index "ci_commits", ["status"], name: "index_ci_commits_on_status", using: :btree
add_index "ci_commits", ["user_id"], name: "index_ci_commits_on_user_id", using: :btree