mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
commit
3e3de44375
19 changed files with 408 additions and 51 deletions
|
@ -27,10 +27,12 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
# example: curl -u registrar1:password localhost:3000/repp/v1/domains/1/transfer_info -H "Auth-Code: authinfopw1"
|
# example: curl -u registrar1:password localhost:3000/repp/v1/domains/1/transfer_info -H "Auth-Code: authinfopw1"
|
||||||
get '/:id/transfer_info' do
|
get '/:id/transfer_info', requirements: { id: /.*/ } do
|
||||||
|
ident = params[:id]
|
||||||
|
domain = ident =~ /\A[0-9]+\z/ ? Domain.find_by(id: ident) : Domain.find_by_idn(ident)
|
||||||
|
|
||||||
domain = Domain.where("name = ? OR id=?", params[:id], params[:id]).where(auth_info: request.headers['Auth-Code']).first
|
error! I18n.t('errors.messages.epp_domain_not_found'), 404 unless domain
|
||||||
error! I18n.t('errors.messages.epp_domain_not_found'), 401 unless domain
|
error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.auth_info.eql? request.headers['Auth-Code']
|
||||||
|
|
||||||
contact_repp_json = proc{|contact|
|
contact_repp_json = proc{|contact|
|
||||||
contact.attributes.slice("code", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses")
|
contact.attributes.slice("code", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses")
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Admin::SettingsController < AdminController
|
||||||
:admin_contacts_max_count,
|
:admin_contacts_max_count,
|
||||||
:tech_contacts_min_count,
|
:tech_contacts_min_count,
|
||||||
:tech_contacts_max_count,
|
:tech_contacts_max_count,
|
||||||
:ds_algorithm,
|
:ds_digest_type,
|
||||||
:dnskeys_min_count,
|
:dnskeys_min_count,
|
||||||
:dnskeys_max_count,
|
:dnskeys_max_count,
|
||||||
:ns_min_count,
|
:ns_min_count,
|
||||||
|
|
|
@ -8,7 +8,8 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
DomainMailer.pending_delete_rejected_notification(domain_id, deliver_emails).deliver
|
DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver
|
||||||
|
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||||
domain.cancel_pending_delete
|
domain.cancel_pending_delete
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ApplicationMailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
|
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
|
||||||
def delivery_off?(model, deliver_email= false)
|
def delivery_off?(model, deliver_emails = false)
|
||||||
return false if deliver_emails == true
|
return false if deliver_emails == true
|
||||||
logger.info "EMAIL SENDING WAS NOT ACTIVATED " \
|
logger.info "EMAIL SENDING WAS NOT ACTIVATED " \
|
||||||
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
|
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
|
||||||
|
|
|
@ -4,7 +4,7 @@ class ContactMailer < ApplicationMailer
|
||||||
def email_updated(email, contact_id, should_deliver)
|
def email_updated(email, contact_id, should_deliver)
|
||||||
@contact = Contact.find_by(id: contact_id)
|
@contact = Contact.find_by(id: contact_id)
|
||||||
return unless email || @contact
|
return unless email || @contact
|
||||||
return if delivery_off?(contact, should_deliver)
|
return if delivery_off?(@contact, should_deliver)
|
||||||
return if whitelist_blocked?(email)
|
return if whitelist_blocked?(email)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -17,9 +17,10 @@ class Dnskey < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
ALGORITHMS = %w(3 5 6 7 8 10 13 14)
|
ALGORITHMS = Depp::Dnskey::ALGORITHMS.map {|pair| pair[1].to_s}.freeze # IANA numbers, single authority list
|
||||||
PROTOCOLS = %w(3)
|
PROTOCOLS = %w(3)
|
||||||
FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK
|
FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK
|
||||||
|
DS_DIGEST_TYPE = [1,2]
|
||||||
|
|
||||||
def epp_code_map
|
def epp_code_map
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,10 @@ class Dnskey < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_digest
|
def generate_digest
|
||||||
return if flags != 257 # generate ds only with KSK
|
return unless flags == 257 || flags == 256 # require ZoneFlag, but optional SecureEntryPoint
|
||||||
|
self.ds_alg = alg
|
||||||
|
self.ds_digest_type = Setting.ds_digest_type if self.ds_digest_type.blank? || !DS_DIGEST_TYPE.include?(ds_digest_type)
|
||||||
|
|
||||||
flags_hex = self.class.int_to_hex(flags)
|
flags_hex = self.class.int_to_hex(flags)
|
||||||
protocol_hex = self.class.int_to_hex(protocol)
|
protocol_hex = self.class.int_to_hex(protocol)
|
||||||
alg_hex = self.class.int_to_hex(alg)
|
alg_hex = self.class.int_to_hex(alg)
|
||||||
|
@ -74,9 +78,9 @@ class Dnskey < ActiveRecord::Base
|
||||||
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
||||||
bin = self.class.hex_to_bin(hex)
|
bin = self.class.hex_to_bin(hex)
|
||||||
|
|
||||||
if ds_digest_type == 1
|
if self.ds_digest_type == 1
|
||||||
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
|
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
|
||||||
elsif ds_digest_type == 2
|
elsif self.ds_digest_type == 2
|
||||||
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
|
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,7 +90,7 @@ class Dnskey < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_ds_key_tag
|
def generate_ds_key_tag
|
||||||
return if flags != 257 # generate ds key tag only with KSK
|
return unless flags == 257 || flags == 256 # require ZoneFlag, but optional SecureEntryPoint
|
||||||
pk = public_key.gsub(' ', '')
|
pk = public_key.gsub(' ', '')
|
||||||
wire_format = [flags, protocol, alg].pack('S!>CC')
|
wire_format = [flags, protocol, alg].pack('S!>CC')
|
||||||
wire_format += Base64.decode64(pk)
|
wire_format += Base64.decode64(pk)
|
||||||
|
|
|
@ -329,7 +329,7 @@ class Domain < ActiveRecord::Base
|
||||||
domain.destroy
|
domain.destroy
|
||||||
bye_bye = domain.versions.last
|
bye_bye = domain.versions.last
|
||||||
domain.registrar.messages.create!(
|
domain.registrar.messages.create!(
|
||||||
body: I18n.t(:domain_deleted),
|
body: "#{I18n.t(:domain_deleted)}: #{domain.name}",
|
||||||
attached_obj_id: bye_bye.id,
|
attached_obj_id: bye_bye.id,
|
||||||
attached_obj_type: bye_bye.class.to_s # DomainVersion
|
attached_obj_type: bye_bye.class.to_s # DomainVersion
|
||||||
)
|
)
|
||||||
|
|
|
@ -387,13 +387,8 @@ class Epp::Domain < Domain
|
||||||
end
|
end
|
||||||
|
|
||||||
def key_data_from(frame)
|
def key_data_from(frame)
|
||||||
result = xm_copy frame, KEY_INTERFACE
|
xm_copy frame, KEY_INTERFACE
|
||||||
# TODO: can these defaults go where they belong?
|
end
|
||||||
result.merge({
|
|
||||||
ds_alg: 3, # DSA/SHA-1 [DSA] RFC2536
|
|
||||||
ds_digest_type: Setting.ds_algorithm # only 1
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
def ds_data_from(frame)
|
def ds_data_from(frame)
|
||||||
frame.css('dsData').each do |ds_data|
|
frame.css('dsData').each do |ds_data|
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
%th{class: 'col-xs-6'}= t(:setting)
|
%th{class: 'col-xs-6'}= t(:setting)
|
||||||
%th{class: 'col-xs-6'}= t(:value)
|
%th{class: 'col-xs-6'}= t(:value)
|
||||||
%tbody
|
%tbody
|
||||||
/= render 'setting_row', var: :transfer_wait_time
|
= render 'setting_row', var: :transfer_wait_time
|
||||||
= render 'setting_row', var: :ds_algorithm
|
= render 'setting_row', var: :ds_digest_type
|
||||||
= render 'setting_row', var: :client_side_status_editing_enabled
|
= render 'setting_row', var: :client_side_status_editing_enabled
|
||||||
= render 'setting_row', var: :api_ip_whitelist_enabled
|
= render 'setting_row', var: :api_ip_whitelist_enabled
|
||||||
= render 'setting_row', var: :registrar_ip_whitelist_enabled
|
= render 'setting_row', var: :registrar_ip_whitelist_enabled
|
||||||
|
|
|
@ -12,7 +12,7 @@ if con.present? && con.table_exists?('settings')
|
||||||
Setting.save_default(:tech_contacts_max_count, 10)
|
Setting.save_default(:tech_contacts_max_count, 10)
|
||||||
Setting.save_default(:expire_pending_confirmation, 48)
|
Setting.save_default(:expire_pending_confirmation, 48)
|
||||||
|
|
||||||
Setting.save_default(:ds_algorithm, 2)
|
Setting.save_default(:ds_digest_type, 2)
|
||||||
Setting.save_default(:ds_data_allowed, false)
|
Setting.save_default(:ds_data_allowed, false)
|
||||||
Setting.save_default(:key_data_allowed, true)
|
Setting.save_default(:key_data_allowed, true)
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,7 @@ en:
|
||||||
ds_data_allowed: 'DS data allowed'
|
ds_data_allowed: 'DS data allowed'
|
||||||
ds_data_with_key_allowed: 'Allow DS data with key'
|
ds_data_with_key_allowed: 'Allow DS data with key'
|
||||||
key_data_allowed: 'Allow key data'
|
key_data_allowed: 'Allow key data'
|
||||||
ds_algorithm: 'DS algorithm'
|
ds_digest_type: 'DS digest type'
|
||||||
zonefile_settings: 'Zonefile settings'
|
zonefile_settings: 'Zonefile settings'
|
||||||
background_jobs: Background jobs
|
background_jobs: Background jobs
|
||||||
domain_history: Domain history
|
domain_history: Domain history
|
||||||
|
|
98
db/migrate/20151124200353_add_ident_autofill.rb
Normal file
98
db/migrate/20151124200353_add_ident_autofill.rb
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
class AddIdentAutofill < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
execute <<-SQL
|
||||||
|
CREATE OR REPLACE FUNCTION fill_ident_country()
|
||||||
|
RETURNS BOOLEAN AS $$
|
||||||
|
DECLARE
|
||||||
|
changed BOOLEAN;
|
||||||
|
multiplier INT [];
|
||||||
|
multiplier2 INT [];
|
||||||
|
multiplier3 INT [];
|
||||||
|
multiplier4 INT [];
|
||||||
|
r RECORD;
|
||||||
|
control TEXT;
|
||||||
|
total INT;
|
||||||
|
i INT;
|
||||||
|
mod INT;
|
||||||
|
counter INT;
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
multiplier := ARRAY [1, 2, 3, 4, 5, 6, 7, 8, 9, 1];
|
||||||
|
multiplier2 := ARRAY [3, 4, 5, 6, 7, 8, 9, 1, 2, 3];
|
||||||
|
multiplier3 := ARRAY [1, 2, 3, 4, 5, 6, 7];
|
||||||
|
multiplier4 := ARRAY [3, 4, 5, 6, 7, 8, 9];
|
||||||
|
|
||||||
|
FOR r IN SELECT id, ident FROM contacts WHERE ident_type = 'priv' AND ident_country_code IS NULL
|
||||||
|
LOOP
|
||||||
|
IF (length(r.ident) = 11 AND (r.ident ~ '^[0-9]+$') AND (substring(r.ident, 1, 1) = '3' OR substring(r.ident, 1, 1) = '4' OR substring(r.ident, 1, 1) = '5' OR substring(r.ident, 1, 1) = '6'))
|
||||||
|
THEN
|
||||||
|
total := 0;
|
||||||
|
counter := 1;
|
||||||
|
FOREACH i IN ARRAY multiplier
|
||||||
|
LOOP
|
||||||
|
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
||||||
|
counter := (counter + 1);
|
||||||
|
END LOOP;
|
||||||
|
mod := (total % 11);
|
||||||
|
counter := 1;
|
||||||
|
IF (mod >= 10)
|
||||||
|
THEN
|
||||||
|
total = 0;
|
||||||
|
FOREACH i IN ARRAY multiplier2
|
||||||
|
LOOP
|
||||||
|
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
||||||
|
counter := (counter + 1);
|
||||||
|
END LOOP;
|
||||||
|
mod := (total % 11);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF (mod < 10 AND substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
||||||
|
THEN
|
||||||
|
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
||||||
|
END IF;
|
||||||
|
total = 0;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
FOR r IN SELECT id, ident FROM contacts WHERE ident_type = 'org' AND ident_country_code IS NULL
|
||||||
|
LOOP
|
||||||
|
IF (length(r.ident) = 8 AND (r.ident ~ '^[0-9]+$') AND (substring(r.ident, 1, 1) = '1' OR substring(r.ident, 1, 1) = '8' OR substring(r.ident, 1, 1) = '9'))
|
||||||
|
THEN
|
||||||
|
total := 0;
|
||||||
|
counter := 1;
|
||||||
|
FOREACH i IN ARRAY multiplier3
|
||||||
|
LOOP
|
||||||
|
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
||||||
|
counter := (counter + 1);
|
||||||
|
END LOOP;
|
||||||
|
mod := total % 11;
|
||||||
|
total = 0;
|
||||||
|
counter := 1;
|
||||||
|
IF (mod >= 10)
|
||||||
|
THEN
|
||||||
|
total = 0;
|
||||||
|
FOREACH i IN ARRAY multiplier4
|
||||||
|
LOOP
|
||||||
|
total := (total + (i * to_number(substring(r.ident, counter, 1), '9')));
|
||||||
|
counter := (counter + 1);
|
||||||
|
END LOOP;
|
||||||
|
mod := (total % 11);
|
||||||
|
END IF;
|
||||||
|
IF (mod < 10 AND (substring(r.ident, 8, 1) = to_char(mod, 'FM999MI')))
|
||||||
|
THEN
|
||||||
|
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
RETURN changed;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
DROP FUNCTION IF EXISTS fill_ident_country()
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
168
db/migrate/20151125155601_restore_ttl_to_zonefile.rb
Normal file
168
db/migrate/20151125155601_restore_ttl_to_zonefile.rb
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
class RestoreTtlToZonefile < ActiveRecord::Migration
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
CREATE OR REPLACE FUNCTION generate_zonefile(i_origin varchar)
|
||||||
|
RETURNS text AS $$
|
||||||
|
DECLARE
|
||||||
|
zone_header text := concat('$ORIGIN ', i_origin, '.');
|
||||||
|
serial_num varchar;
|
||||||
|
include_filter varchar := '';
|
||||||
|
exclude_filter varchar := '';
|
||||||
|
tmp_var text;
|
||||||
|
ret text;
|
||||||
|
BEGIN
|
||||||
|
-- define filters
|
||||||
|
include_filter = '%' || i_origin;
|
||||||
|
|
||||||
|
-- for %.%.%
|
||||||
|
IF i_origin ~ '\\.' THEN
|
||||||
|
exclude_filter := '';
|
||||||
|
-- for %.%
|
||||||
|
ELSE
|
||||||
|
exclude_filter := '%.%.' || i_origin;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT ROUND(extract(epoch from now() at time zone 'utc')) INTO serial_num;
|
||||||
|
|
||||||
|
-- zonefile header
|
||||||
|
SELECT concat(
|
||||||
|
format('%-10s', '$ORIGIN .'), chr(10),
|
||||||
|
format('%-10s', '$TTL'), zf.ttl, chr(10), chr(10),
|
||||||
|
format('%-10s', i_origin || '.'), 'IN SOA ', zf.master_nameserver, '. ', zf.email, '. (', chr(10),
|
||||||
|
format('%-17s', ''), format('%-12s', serial_num), '; serial number', chr(10),
|
||||||
|
format('%-17s', ''), format('%-12s', zf.refresh), '; refresh, seconds', chr(10),
|
||||||
|
format('%-17s', ''), format('%-12s', zf.retry), '; retry, seconds', chr(10),
|
||||||
|
format('%-17s', ''), format('%-12s', zf.expire), '; expire, seconds', chr(10),
|
||||||
|
format('%-17s', ''), format('%-12s', zf.minimum_ttl), '; minimum TTL, seconds', chr(10),
|
||||||
|
format('%-17s', ''), ')'
|
||||||
|
) FROM zonefile_settings zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||||
|
|
||||||
|
ret = concat(tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
|
-- ns records
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
|
||||||
|
FROM domains d
|
||||||
|
JOIN nameservers ns ON ns.domain_id = d.id
|
||||||
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
|
ORDER BY d.name
|
||||||
|
),
|
||||||
|
chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
|
-- a glue records for origin nameservers
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
|
||||||
|
FROM nameservers ns
|
||||||
|
JOIN domains d ON d.id = ns.domain_id
|
||||||
|
WHERE d.name = i_origin
|
||||||
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
|
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
||||||
|
), chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
ret := concat(ret, '; Zone A Records', chr(10), tmp_var);
|
||||||
|
|
||||||
|
-- a glue records for other nameservers
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(ns.hostname, '. IN A ', ns.ipv4)
|
||||||
|
FROM nameservers ns
|
||||||
|
JOIN domains d ON d.id = ns.domain_id
|
||||||
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
|
AND d.name <> i_origin
|
||||||
|
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
||||||
|
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||||
|
SELECT 1 FROM nameservers nsi
|
||||||
|
JOIN domains di ON nsi.domain_id = di.id
|
||||||
|
WHERE di.name = i_origin
|
||||||
|
AND nsi.hostname = ns.hostname
|
||||||
|
)
|
||||||
|
), chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
-- TODO This is a possible subtitition to the previous query, stress testing is needed to see which is faster
|
||||||
|
|
||||||
|
-- SELECT ns.*
|
||||||
|
-- FROM nameservers ns
|
||||||
|
-- JOIN domains d ON d.id = ns.domain_id
|
||||||
|
-- WHERE d.name LIKE '%ee' AND d.name NOT LIKE '%pri.ee'
|
||||||
|
-- AND ns.hostname LIKE '%.' || d.name
|
||||||
|
-- AND d.name <> 'ee'
|
||||||
|
-- AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> ''
|
||||||
|
-- AND ns.hostname NOT IN (
|
||||||
|
-- SELECT ns.hostname FROM domains d JOIN nameservers ns ON d.id = ns.domain_id WHERE d.name = 'ee'
|
||||||
|
-- )
|
||||||
|
|
||||||
|
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
|
-- aaaa glue records for origin nameservers
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
|
||||||
|
FROM nameservers ns
|
||||||
|
JOIN domains d ON d.id = ns.domain_id
|
||||||
|
WHERE d.name = i_origin
|
||||||
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
|
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
||||||
|
), chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var);
|
||||||
|
|
||||||
|
-- aaaa glue records for other nameservers
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(ns.hostname, '. IN AAAA ', ns.ipv6)
|
||||||
|
FROM nameservers ns
|
||||||
|
JOIN domains d ON d.id = ns.domain_id
|
||||||
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
|
AND ns.hostname LIKE '%.' || d.name
|
||||||
|
AND d.name <> i_origin
|
||||||
|
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> ''
|
||||||
|
AND NOT EXISTS ( -- filter out glue records that already appeared in origin glue recrods
|
||||||
|
SELECT 1 FROM nameservers nsi
|
||||||
|
JOIN domains di ON nsi.domain_id = di.id
|
||||||
|
WHERE di.name = i_origin
|
||||||
|
AND nsi.hostname = ns.hostname
|
||||||
|
)
|
||||||
|
), chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
ret := concat(ret, chr(10), tmp_var, chr(10), chr(10));
|
||||||
|
|
||||||
|
-- ds records
|
||||||
|
SELECT array_to_string(
|
||||||
|
array(
|
||||||
|
SELECT concat(
|
||||||
|
d.name_puny, '. 3600 IN DS ', dk.ds_key_tag, ' ',
|
||||||
|
dk.ds_alg, ' ', dk.ds_digest_type, dk.ds_digest
|
||||||
|
)
|
||||||
|
FROM domains d
|
||||||
|
JOIN dnskeys dk ON dk.domain_id = d.id
|
||||||
|
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||||
|
),
|
||||||
|
chr(10)
|
||||||
|
) INTO tmp_var;
|
||||||
|
|
||||||
|
ret := concat(ret, '; Zone DS Records', chr(10), tmp_var, chr(10));
|
||||||
|
|
||||||
|
RETURN ret;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
LANGUAGE plpgsql;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
DROP FUNCTION generate_zonefile(i_origin varchar);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
|
@ -47,7 +47,7 @@ Please install following lib, otherwise your bundler install might not be succes
|
||||||
### Firewall rate limit config
|
### Firewall rate limit config
|
||||||
|
|
||||||
First increase the maximum possible value form 20 to 100 of the hitcount parameter.
|
First increase the maximum possible value form 20 to 100 of the hitcount parameter.
|
||||||
ip_pkt_list_tot of the xt_recent kernel module. Secondly change /proc/xt_recent/ permissions so, epp user can modify the tables.
|
ip_pkt_list_tot of the xt_recent kernel module. Secondly change /proc/net/xt_recent/ permissions so, epp user can modify the tables.
|
||||||
This can be done by creating an ip_pkt_list_tot.conf file in /etc/modeprobe.d/ which contains:
|
This can be done by creating an ip_pkt_list_tot.conf file in /etc/modeprobe.d/ which contains:
|
||||||
|
|
||||||
````
|
````
|
||||||
|
@ -79,11 +79,13 @@ iptables -A INPUT -p tcp --dport 43 -m recent --set --rsource --name whois -j AC
|
||||||
|
|
||||||
#### EPP
|
#### EPP
|
||||||
|
|
||||||
|
Configure epp server ip in applicatin.yml
|
||||||
|
iptables_server_ip: 'x.x.x.x'
|
||||||
Iptables hitcounter is updated by application. For every registrar there is one recent table, where the request counters are stored, registrar handles and sources ips are "connected" with iptables rules.
|
Iptables hitcounter is updated by application. For every registrar there is one recent table, where the request counters are stored, registrar handles and sources ips are "connected" with iptables rules.
|
||||||
|
|
||||||
````
|
````
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
iptables -A INPUT -p tcp --dport 700 -j CHKLIMITS
|
|
||||||
|
|
||||||
iptables -N CHKLIMITS
|
iptables -N CHKLIMITS
|
||||||
|
|
||||||
|
@ -92,6 +94,6 @@ iptables -A CHKLIMITS -p tcp --dport 700 -s $REGISTRAR_SOURCE2 -m recent --name
|
||||||
iptables -A CHKLIMITS -p tcp --dport 700 -s $REGISTRAR2_SOURCE -m recent --name $REGISTRAR2_CODE --rdest --rcheck --hitcount 100 --seconds 60 -j DROP
|
iptables -A CHKLIMITS -p tcp --dport 700 -s $REGISTRAR2_SOURCE -m recent --name $REGISTRAR2_CODE --rdest --rcheck --hitcount 100 --seconds 60 -j DROP
|
||||||
iptables -A CHKLIMITS -p tcp --dport 700 -s $REGISTRAR2_SOURCE2 -m recent --name $REGISTRAR2_CODE --rdest --rcheck --hitcount 100 --seconds 60 -j DROP
|
iptables -A CHKLIMITS -p tcp --dport 700 -s $REGISTRAR2_SOURCE2 -m recent --name $REGISTRAR2_CODE --rdest --rcheck --hitcount 100 --seconds 60 -j DROP
|
||||||
|
|
||||||
|
iptables -A INPUT -p tcp --dport 700 -j CHKLIMITS
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Domain listing
|
||||||
|
|
||||||
## GET /repp/v1/domains
|
## GET /repp/v1/domains
|
||||||
Returns domains of the current registrar.
|
Returns domains of the current registrar.
|
||||||
|
|
||||||
|
@ -98,3 +100,83 @@ Content-Type: application/json
|
||||||
"total_number_of_records": 2
|
"total_number_of_records": 2
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Transfer info
|
||||||
|
|
||||||
|
## GET /repp/v1/domains/*domainname.ee*/transfer_info
|
||||||
|
Returns details of contacts associated with a domain to be transfered. Necessary for pre-transfer checks and better user experience in automated registrar systems.
|
||||||
|
|
||||||
|
Please note the domain name in the path
|
||||||
|
|
||||||
|
#### Request
|
||||||
|
```
|
||||||
|
GET /repp/v1/domains/ee-test.ee/transfer_info HTTP/1.1
|
||||||
|
Accept: application/json
|
||||||
|
Authorization: Basic Z2l0bGFiOmdoeXQ5ZTRmdQ==
|
||||||
|
Content-Length: 0
|
||||||
|
Content-Type: application/json
|
||||||
|
Auth-Code: authinfopw
|
||||||
|
```
|
||||||
|
|
||||||
|
Please note that domain transfer/authorisation code must be placed in header - *Auth-Code*
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
```
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Cache-Control: max-age=0, private, must-revalidate
|
||||||
|
Content-Length: 784
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"domain":"ee-test.ee",
|
||||||
|
"registrant":{
|
||||||
|
"code":"EE:R1",
|
||||||
|
"ident_type":"org",
|
||||||
|
"ident_country_code":"EE",
|
||||||
|
"phone":"+372.1234567",
|
||||||
|
"email":"registrant@cache.ee",
|
||||||
|
"street":"Businesstreet 1",
|
||||||
|
"city":"Tallinn",
|
||||||
|
"zip":"10101",
|
||||||
|
"country_code":"EE",
|
||||||
|
"statuses":[
|
||||||
|
"ok",
|
||||||
|
"linked"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"admin_contacts":[
|
||||||
|
{
|
||||||
|
"code":"EE:A1",
|
||||||
|
"ident_type":"priv",
|
||||||
|
"ident_country_code":"EE",
|
||||||
|
"phone":"+372.7654321",
|
||||||
|
"email":"admin@cache.ee",
|
||||||
|
"street":"Adminstreet 2",
|
||||||
|
"city":"Tallinn",
|
||||||
|
"zip":"12345",
|
||||||
|
"country_code":"EE",
|
||||||
|
"statuses":[
|
||||||
|
"ok",
|
||||||
|
"linked"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tech_contacts":[
|
||||||
|
{
|
||||||
|
"code":"EE:T1",
|
||||||
|
"ident_type":"org",
|
||||||
|
"ident_country_code":"EE",
|
||||||
|
"phone":"+372.7654321",
|
||||||
|
"email":"tech@cache.ee",
|
||||||
|
"street":"Techstreet 1",
|
||||||
|
"city":"Tallinn",
|
||||||
|
"zip":"12345",
|
||||||
|
"country_code":"EE",
|
||||||
|
"statuses":[
|
||||||
|
"ok",
|
||||||
|
"linked"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
@ -20,15 +20,19 @@
|
||||||
schemaLocation="eppcom-1.0.xsd"/>
|
schemaLocation="eppcom-1.0.xsd"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0"
|
<import namespace="urn:ietf:params:xml:ns:epp-1.0"
|
||||||
schemaLocation="epp-1.0.xsd"/>
|
schemaLocation="epp-1.0.xsd"/>
|
||||||
|
<!-- EPP protocol extension: DNSSEC -->
|
||||||
|
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"
|
||||||
|
schemaLocation="secNDS-1.1.xsd"/>
|
||||||
|
<import namespace="urn:ietf:params:xml:ns:host-1.0"
|
||||||
|
schemaLocation="host-1.0.xsd"/>
|
||||||
|
<!-- EPP protocol extension: .ee specific -->
|
||||||
|
<import namespace="https://epp.tld.ee/schema/eis-1.0"
|
||||||
|
schemaLocation="eis-1.0.xsd"/>
|
||||||
<import namespace="https://epp.tld.ee/schema/contact-eis-1.0"
|
<import namespace="https://epp.tld.ee/schema/contact-eis-1.0"
|
||||||
schemaLocation="contact-eis-1.0.xsd"/>
|
schemaLocation="contact-eis-1.0.xsd"/>
|
||||||
<import namespace="https://epp.tld.ee/schema/domain-eis-1.0"
|
<import namespace="https://epp.tld.ee/schema/domain-eis-1.0"
|
||||||
schemaLocation="domain-eis-1.0.xsd"/>
|
schemaLocation="domain-eis-1.0.xsd"/>
|
||||||
<!-- EPP protocol extensions -->
|
|
||||||
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"
|
|
||||||
schemaLocation="secNDS-1.1.xsd"/>
|
|
||||||
<import namespace="https://epp.tld.ee/schema/eis-1.0"
|
|
||||||
schemaLocation="eis-1.0.xsd"/>
|
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<!--
|
<!--
|
||||||
Import common element types.
|
Import common element types.
|
||||||
-->
|
-->
|
||||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/eppcom-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/epp-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
|
||||||
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd" schemaLocation="doc/schemas/eis-1.0.xsd"/>
|
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
<!--
|
<!--
|
||||||
Import common element types.
|
Import common element types.
|
||||||
-->
|
-->
|
||||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/eppcom-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/epp-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:host-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/host-1.0.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:host-1.0"/>
|
||||||
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/secDNS-1.1.xsd"/>
|
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"/>
|
||||||
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd" schemaLocation="doc/schemas/eis-1.0.xsd"/>
|
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
@ -92,7 +92,6 @@
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="hostName" type="eppcom:labelType"/>
|
<element name="hostName" type="eppcom:labelType"/>
|
||||||
<element name="hostAddr" type="host:addrType"
|
<element name="hostAddr" type="host:addrType"
|
||||||
|
|
||||||
minOccurs="0" maxOccurs="unbounded"/>
|
minOccurs="0" maxOccurs="unbounded"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
|
@ -386,16 +385,24 @@
|
||||||
<enumeration value="clientUpdateProhibited"/>
|
<enumeration value="clientUpdateProhibited"/>
|
||||||
<enumeration value="inactive"/>
|
<enumeration value="inactive"/>
|
||||||
<enumeration value="ok"/>
|
<enumeration value="ok"/>
|
||||||
|
<enumeration value="expired"/>
|
||||||
<enumeration value="pendingCreate"/>
|
<enumeration value="pendingCreate"/>
|
||||||
<enumeration value="pendingDelete"/>
|
<enumeration value="pendingDelete"/>
|
||||||
<enumeration value="pendingRenew"/>
|
<enumeration value="pendingRenew"/>
|
||||||
<enumeration value="pendingTransfer"/>
|
<enumeration value="pendingTransfer"/>
|
||||||
<enumeration value="pendingUpdate"/>
|
<enumeration value="pendingUpdate"/>
|
||||||
|
<enumeration value="pendingDeleteConfirmation"/>
|
||||||
<enumeration value="serverDeleteProhibited"/>
|
<enumeration value="serverDeleteProhibited"/>
|
||||||
<enumeration value="serverHold"/>
|
<enumeration value="serverHold"/>
|
||||||
<enumeration value="serverRenewProhibited"/>
|
<enumeration value="serverRenewProhibited"/>
|
||||||
<enumeration value="serverTransferProhibited"/>
|
<enumeration value="serverTransferProhibited"/>
|
||||||
<enumeration value="serverUpdateProhibited"/>
|
<enumeration value="serverUpdateProhibited"/>
|
||||||
|
<enumeration value="serverForceDelete"/>
|
||||||
|
<enumeration value="serverManualInzone"/>
|
||||||
|
<enumeration value="serverRegistrantChangeProhibited"/>
|
||||||
|
<enumeration value="serverAdminChangeProhibited"/>
|
||||||
|
<enumeration value="serverTechChangeProhibited"/>
|
||||||
|
<enumeration value="deleteCandidate"/>
|
||||||
</restriction>
|
</restriction>
|
||||||
</simpleType>
|
</simpleType>
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,6 @@ namespace :import do
|
||||||
registrar_id
|
registrar_id
|
||||||
creator_str
|
creator_str
|
||||||
updator_str
|
updator_str
|
||||||
ident_country_code
|
|
||||||
legacy_id
|
legacy_id
|
||||||
street
|
street
|
||||||
city
|
city
|
||||||
|
@ -262,7 +261,6 @@ namespace :import do
|
||||||
Registrar.find_by(legacy_id: x.object.try(:clid)).try(:id),
|
Registrar.find_by(legacy_id: x.object.try(:clid)).try(:id),
|
||||||
x.object_registry.try(:registrar).try(:name),
|
x.object_registry.try(:registrar).try(:name),
|
||||||
x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
|
x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
|
||||||
x.country.try(:strip),
|
|
||||||
x.id,
|
x.id,
|
||||||
[x.street1.try(:strip), x.street2.try(:strip), x.street3.try(:strip)].join("\n"),
|
[x.street1.try(:strip), x.street2.try(:strip), x.street3.try(:strip)].join("\n"),
|
||||||
x.city.try(:strip),
|
x.city.try(:strip),
|
||||||
|
@ -382,8 +380,6 @@ namespace :import do
|
||||||
protocol
|
protocol
|
||||||
alg
|
alg
|
||||||
public_key
|
public_key
|
||||||
ds_alg
|
|
||||||
ds_digest_type
|
|
||||||
creator_str
|
creator_str
|
||||||
updator_str
|
updator_str
|
||||||
legacy_domain_id
|
legacy_domain_id
|
||||||
|
@ -490,8 +486,6 @@ namespace :import do
|
||||||
key.protocol,
|
key.protocol,
|
||||||
key.alg,
|
key.alg,
|
||||||
key.key,
|
key.key,
|
||||||
3, # ds_alg
|
|
||||||
1, # ds_digest_type /SHA1)
|
|
||||||
x.object_registry.try(:registrar).try(:name),
|
x.object_registry.try(:registrar).try(:name),
|
||||||
x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
|
x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
|
||||||
x.id,
|
x.id,
|
||||||
|
@ -582,10 +576,10 @@ namespace :import do
|
||||||
|
|
||||||
puts '-----> Generating dnskey digests...'
|
puts '-----> Generating dnskey digests...'
|
||||||
|
|
||||||
Dnskey.all.each do |x|
|
Dnskey.all.each do |ds|
|
||||||
x.generate_digest
|
ds.generate_digest
|
||||||
x.generate_ds_key_tag
|
ds.generate_ds_key_tag
|
||||||
x.save(validate: false)
|
ds.save(validate: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue