summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20120127101726_create_system_messages.rb13
-rw-r--r--db/migrate/20130129154700_add_sso_key.rb9
-rw-r--r--db/migrate/20130130185300_add_no_copy_headers.rb9
-rw-r--r--db/migrate/20130202140927_add_trunk_access_code_to_gemeinschaft_setup.rb5
-rw-r--r--db/migrate/20130203164500_remove_perimeter_parameters.rb16
-rw-r--r--db/migrate/20130203165800_add_perimeter_parameters.rb23
-rw-r--r--db/migrate/20130203174300_start_perimeter_defense.rb10
-rw-r--r--db/migrate/20130204065900_split_perimeter_parameters.rb30
-rw-r--r--db/migrate/20130205102838_create_backup_jobs.rb16
-rw-r--r--db/migrate/20130205151844_add_queue_to_delayed_jobs.rb9
-rw-r--r--db/migrate/20130206144829_add_backup_file_to_backup_job.rb5
-rw-r--r--db/migrate/20130207082728_remove_size_of_the_backup_from_backup_job.rb9
-rw-r--r--db/migrate/20130208065700_add_softkeyable_to_softkey.rb16
-rw-r--r--db/migrate/20130210075617_create_intruders.rb28
-rw-r--r--db/migrate/20130212071000_default_profile_to_template.rb13
15 files changed, 198 insertions, 13 deletions
diff --git a/db/migrate/20120127101726_create_system_messages.rb b/db/migrate/20120127101726_create_system_messages.rb
deleted file mode 100644
index 830f54a..0000000
--- a/db/migrate/20120127101726_create_system_messages.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateSystemMessages < ActiveRecord::Migration
- def self.up
- create_table :system_messages do |t|
- t.integer :user_id
- t.string :content
- t.timestamps
- end
- end
-
- def self.down
- drop_table :system_messages
- end
-end
diff --git a/db/migrate/20130129154700_add_sso_key.rb b/db/migrate/20130129154700_add_sso_key.rb
new file mode 100644
index 0000000..2e47f39
--- /dev/null
+++ b/db/migrate/20130129154700_add_sso_key.rb
@@ -0,0 +1,9 @@
+class AddSsoKey < ActiveRecord::Migration
+ def up
+ GsParameter.create(:name => 'SingleSignOnEnvUserNameKey', :section => 'Generic', :value => '', :class_type => 'Nil', :description => 'When set to a string this env variable will be used to authenticate the user. e.g. REMOTE_USER')
+ end
+
+ def down
+ GsParameter.create(:name => 'SingleSignOnEnvUserNameKey').destroy_all
+ end
+end
diff --git a/db/migrate/20130130185300_add_no_copy_headers.rb b/db/migrate/20130130185300_add_no_copy_headers.rb
new file mode 100644
index 0000000..aa96653
--- /dev/null
+++ b/db/migrate/20130130185300_add_no_copy_headers.rb
@@ -0,0 +1,9 @@
+class AddNoCopyHeaders < ActiveRecord::Migration
+ def up
+ GsParameter.create(:entity => 'dialplan', :section => 'variables', :name => 'sip_copy_custom_headers', :value => 'false', :class_type => 'Boolean', :description => 'Controls passing SIP headers from one call leg to another.')
+ end
+
+ def down
+ GsParameter.where(:entity => 'dialplan', :section => 'variables', :name => 'sip_copy_custom_headers').destroy_all
+ end
+end
diff --git a/db/migrate/20130202140927_add_trunk_access_code_to_gemeinschaft_setup.rb b/db/migrate/20130202140927_add_trunk_access_code_to_gemeinschaft_setup.rb
new file mode 100644
index 0000000..82fa3ad
--- /dev/null
+++ b/db/migrate/20130202140927_add_trunk_access_code_to_gemeinschaft_setup.rb
@@ -0,0 +1,5 @@
+class AddTrunkAccessCodeToGemeinschaftSetup < ActiveRecord::Migration
+ def change
+ add_column :gemeinschaft_setups, :trunk_access_code, :string
+ end
+end
diff --git a/db/migrate/20130203164500_remove_perimeter_parameters.rb b/db/migrate/20130203164500_remove_perimeter_parameters.rb
new file mode 100644
index 0000000..8c37174
--- /dev/null
+++ b/db/migrate/20130203164500_remove_perimeter_parameters.rb
@@ -0,0 +1,16 @@
+class RemovePerimeterParameters < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'malicious_contact_count').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'malicious_contact_time_span').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'ban_futile').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'general', :name => 'execute').destroy_all
+
+ end
+
+ def down
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'malicious_contact_count', :value => 20, :class_type => 'Integer')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'malicious_contact_time_span', :value => 2, :class_type => 'Integer')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'ban_futile', :value => 5, :class_type => 'Integer')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'execute', :value => 'sudo /usr/local/bin/ban_ip.sh {ip_address}', :class_type => 'String')
+ end
+end
diff --git a/db/migrate/20130203165800_add_perimeter_parameters.rb b/db/migrate/20130203165800_add_perimeter_parameters.rb
new file mode 100644
index 0000000..23e0157
--- /dev/null
+++ b/db/migrate/20130203165800_add_perimeter_parameters.rb
@@ -0,0 +1,23 @@
+class AddPerimeterParameters < ActiveRecord::Migration
+ def up
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'contact_count_threshold', :value => '10', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'contact_span_threshold', :value => '2', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'name_changes_threshold', :value => '5', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'ban_threshold', :value => '20', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'ban_tries', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'blacklist_file', :value => '/var/opt/gemeinschaft/firewall/blacklist', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'blacklist_file_comment', :value => '# PERIMETER_BAN - points: {points}, generated: {date}', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'blacklist_file_entry', :value => '{received_ip} udp 5060', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'ban_command', :value => 'sudo /sbin/service shorewall refresh', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_frequency', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_username_scan', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_bad_headers', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'user_agent', :value => '^friendly.scanner$', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'to_user', :value => '^%d+', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'auth_result', :value => '^FORBIDDEN$', :class_type => 'String', :description => '')
+ end
+
+ def down
+ GsParameter.where(:entity => 'perimeter').destroy_all
+ end
+end
diff --git a/db/migrate/20130203174300_start_perimeter_defense.rb b/db/migrate/20130203174300_start_perimeter_defense.rb
new file mode 100644
index 0000000..15838bb
--- /dev/null
+++ b/db/migrate/20130203174300_start_perimeter_defense.rb
@@ -0,0 +1,10 @@
+class StartPerimeterDefense < ActiveRecord::Migration
+ def up
+ module_index = GsParameter.where(:entity => 'events', :section => 'modules').all.count + 1;
+ GsParameter.create(:entity => 'events', :section => 'modules', :name => 'perimeter_defense', :value => module_index, :class_type => 'Integer')
+ end
+
+ def down
+ GsParameter.where(:entity => 'events', :section => 'modules', :name => 'perimeter_defense').destroy_all
+ end
+end
diff --git a/db/migrate/20130204065900_split_perimeter_parameters.rb b/db/migrate/20130204065900_split_perimeter_parameters.rb
new file mode 100644
index 0000000..b29bb29
--- /dev/null
+++ b/db/migrate/20130204065900_split_perimeter_parameters.rb
@@ -0,0 +1,30 @@
+class SplitPerimeterParameters < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'perimeter', :section => 'checks').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'bad_headers').destroy_all
+ GsParameter.create(:entity => 'perimeter', :section => 'general', :name => 'ban_command', :value => 'sudo /sbin/service shorewall refresh', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks_register', :name => 'check_frequency', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks_register', :name => 'check_username_scan', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks_register', :name => 'check_bad_headers', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks_call', :name => 'check_frequency', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks_call', :name => 'check_bad_headers', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers_register', :name => 'user_agent', :value => '^friendly.scanner$', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers_register', :name => 'to_user', :value => '^%d+', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers_register', :name => 'auth_result', :value => '^FORBIDDEN$', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers_call', :name => 'user_agent', :value => '^friendly.scanner$', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers_call', :name => 'hangup_cause', :value => '^MANDATORY_IE_MISSING', :class_type => 'String', :description => '')
+ end
+
+ def down
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_register').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'checks_call').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'bad_headers_register').destroy_all
+ GsParameter.where(:entity => 'perimeter', :section => 'bad_headers_call').destroy_all
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_frequency', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_username_scan', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'checks', :name => 'check_bad_headers', :value => '1', :class_type => 'Integer', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'user_agent', :value => '^friendly.scanner$', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'to_user', :value => '^%d+', :class_type => 'String', :description => '')
+ GsParameter.create(:entity => 'perimeter', :section => 'bad_headers', :name => 'auth_result', :value => '^FORBIDDEN$', :class_type => 'String', :description => '')
+ end
+end
diff --git a/db/migrate/20130205102838_create_backup_jobs.rb b/db/migrate/20130205102838_create_backup_jobs.rb
new file mode 100644
index 0000000..0994939
--- /dev/null
+++ b/db/migrate/20130205102838_create_backup_jobs.rb
@@ -0,0 +1,16 @@
+class CreateBackupJobs < ActiveRecord::Migration
+ def self.up
+ create_table :backup_jobs do |t|
+ t.datetime :started_at
+ t.datetime :finished_at
+ t.string :state
+ t.string :directory
+ t.integer :size_of_the_backup
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :backup_jobs
+ end
+end
diff --git a/db/migrate/20130205151844_add_queue_to_delayed_jobs.rb b/db/migrate/20130205151844_add_queue_to_delayed_jobs.rb
new file mode 100644
index 0000000..072c8d4
--- /dev/null
+++ b/db/migrate/20130205151844_add_queue_to_delayed_jobs.rb
@@ -0,0 +1,9 @@
+class AddQueueToDelayedJobs < ActiveRecord::Migration
+ def self.up
+ add_column :delayed_jobs, :queue, :string
+ end
+
+ def self.down
+ remove_column :delayed_jobs, :queue
+ end
+end
diff --git a/db/migrate/20130206144829_add_backup_file_to_backup_job.rb b/db/migrate/20130206144829_add_backup_file_to_backup_job.rb
new file mode 100644
index 0000000..e02f2b3
--- /dev/null
+++ b/db/migrate/20130206144829_add_backup_file_to_backup_job.rb
@@ -0,0 +1,5 @@
+class AddBackupFileToBackupJob < ActiveRecord::Migration
+ def change
+ add_column :backup_jobs, :backup_file, :string
+ end
+end
diff --git a/db/migrate/20130207082728_remove_size_of_the_backup_from_backup_job.rb b/db/migrate/20130207082728_remove_size_of_the_backup_from_backup_job.rb
new file mode 100644
index 0000000..a902fd2
--- /dev/null
+++ b/db/migrate/20130207082728_remove_size_of_the_backup_from_backup_job.rb
@@ -0,0 +1,9 @@
+class RemoveSizeOfTheBackupFromBackupJob < ActiveRecord::Migration
+ def up
+ remove_column :backup_jobs, :size_of_the_backup
+ end
+
+ def down
+ add_column :backup_jobs, :size_of_the_backup, :string
+ end
+end
diff --git a/db/migrate/20130208065700_add_softkeyable_to_softkey.rb b/db/migrate/20130208065700_add_softkeyable_to_softkey.rb
new file mode 100644
index 0000000..deae9a0
--- /dev/null
+++ b/db/migrate/20130208065700_add_softkeyable_to_softkey.rb
@@ -0,0 +1,16 @@
+class AddSoftkeyableToSoftkey < ActiveRecord::Migration
+ def up
+ add_column :softkeys, :softkeyable_type, :string
+ add_column :softkeys, :softkeyable_id, :integer
+ Softkey.where('call_forward_id > 0').each do |softkey|
+ softkey.update_attributes( :softkeyable_type => 'CallForward', :softkeyable_id => softkey.call_forward_id )
+ end
+ remove_column :softkeys, :call_forward_id
+ end
+
+ def down
+ remove_column :softkeys, :softkeyable_type
+ remove_column :softkeys, :softkeyable_id
+ add_column :softkeys, :call_forward_id, :integer
+ end
+end
diff --git a/db/migrate/20130210075617_create_intruders.rb b/db/migrate/20130210075617_create_intruders.rb
new file mode 100644
index 0000000..fc944cc
--- /dev/null
+++ b/db/migrate/20130210075617_create_intruders.rb
@@ -0,0 +1,28 @@
+class CreateIntruders < ActiveRecord::Migration
+ def self.up
+ create_table :intruders do |t|
+ t.string :list_type
+ t.string :key
+ t.integer :points
+ t.integer :bans
+ t.datetime :ban_last
+ t.datetime :ban_end
+ t.string :contact_ip
+ t.integer :contact_port
+ t.integer :contact_count
+ t.datetime :contact_last
+ t.float :contacts_per_second
+ t.float :contacts_per_second_max
+ t.string :user_agent
+ t.string :to_user
+ t.string :comment
+ t.timestamps
+ end
+
+ add_index :intruders, :key, :unique => true
+ end
+
+ def self.down
+ drop_table :intruders
+ end
+end
diff --git a/db/migrate/20130212071000_default_profile_to_template.rb b/db/migrate/20130212071000_default_profile_to_template.rb
new file mode 100644
index 0000000..d3fd89c
--- /dev/null
+++ b/db/migrate/20130212071000_default_profile_to_template.rb
@@ -0,0 +1,13 @@
+class DefaultProfileToTemplate < ActiveRecord::Migration
+ def up
+ GsParameter.where(:entity => 'sofia', :section => 'profile:gemeinschaft').each do |profile|
+ profile.update_attributes(:section => 'profile')
+ end
+ end
+
+ def down
+ GsParameter.where(:entity => 'sofia', :section => 'profile').each do |profile|
+ profile.update_attributes(:section => 'profile:gemeinschaft')
+ end
+ end
+end