2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

Add screening by IP address. When deleting a user as a spammer, block all signups from the same IP address.

This commit is contained in:
Neil Lalonde 2013-10-21 14:49:51 -04:00
parent e527cbf884
commit 648b11a0eb
29 changed files with 455 additions and 12 deletions

View file

@ -0,0 +1,30 @@
ScreenedIpAddress.seed do |s|
s.id = 1
s.ip_address = "10.0.0.0/8"
s.action_type = ScreenedIpAddress.actions[:do_nothing]
end
ScreenedIpAddress.seed do |s|
s.id = 2
s.ip_address = "192.168.0.0/16"
s.action_type = ScreenedIpAddress.actions[:do_nothing]
end
ScreenedIpAddress.seed do |s|
s.id = 3
s.ip_address = "127.0.0.0/8"
s.action_type = ScreenedIpAddress.actions[:do_nothing]
end
ScreenedIpAddress.seed do |s|
s.id = 4
s.ip_address = "172.16.0.0/12"
s.action_type = ScreenedIpAddress.actions[:do_nothing]
end
# IPv6
ScreenedIpAddress.seed do |s|
s.id = 5
s.ip_address = "fc00::/7"
s.action_type = ScreenedIpAddress.actions[:do_nothing]
end

View file

@ -0,0 +1,13 @@
class CreateScreenedIpAddresses < ActiveRecord::Migration
def change
create_table :screened_ip_addresses do |t|
t.column :ip_address, :inet, null: false
t.integer :action_type, null: false
t.integer :match_count, null: false, default: 0
t.datetime :last_match_at
t.timestamps
end
add_index :screened_ip_addresses, :ip_address, unique: true
add_index :screened_ip_addresses, :last_match_at
end
end