mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Import tld nameservers #2726
This commit is contained in:
parent
4e03a65e8d
commit
b9a7f63d75
4 changed files with 248 additions and 2 deletions
5
app/models/legacy/zone_ns.rb
Normal file
5
app/models/legacy/zone_ns.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Legacy
|
||||
class ZoneNs < Db
|
||||
self.table_name = :zone_ns
|
||||
end
|
||||
end
|
|
@ -469,4 +469,245 @@ namespace :import do
|
|||
|
||||
puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Import EIS domains'
|
||||
task eis_domains: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
puts '-----> Importing EIS domains...'
|
||||
|
||||
eis = Registrar.where(
|
||||
name: 'EIS',
|
||||
reg_no: '90010019',
|
||||
phone: '+3727271000',
|
||||
country_code: 'EE',
|
||||
vat_no: 'EE101286464',
|
||||
email: 'info@internet.ee',
|
||||
state: 'Harjumaa',
|
||||
city: 'Tallinn',
|
||||
street: 'Paldiski mnt 80',
|
||||
zip: '10617',
|
||||
url: 'www.internet.ee',
|
||||
code: 'EIS'
|
||||
).first_or_create!
|
||||
|
||||
unless eis.cash_account
|
||||
eis.accounts.create(account_type: Account::CASH, currency: 'EUR')
|
||||
eis.save
|
||||
end
|
||||
|
||||
c = Registrant.where(
|
||||
name: 'Eesti Interneti Sihtasutus',
|
||||
phone: '+372.7271000',
|
||||
email: 'info@internet.ee',
|
||||
ident: '90010019',
|
||||
ident_type: 'passport',
|
||||
city: 'Tallinn',
|
||||
country_code: 'ee',
|
||||
street: 'Paldiski mnt 80',
|
||||
zip: '10617',
|
||||
registrar: eis
|
||||
).first_or_create!
|
||||
|
||||
# ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 1).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# edu.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 6).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'edu.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# aip.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 9).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'aip.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# org.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 10).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'org.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# pri.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 2).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'pri.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# med.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 3).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'med.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# fie.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 4).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'fie.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# com.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 5).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'com.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# gov.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 7).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'gov.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
# riik.ee
|
||||
ns_list = []
|
||||
Legacy::ZoneNs.where(zone: 8).each do |x|
|
||||
ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
|
||||
ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
|
||||
ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6)
|
||||
end
|
||||
|
||||
Domain.create!(
|
||||
name: 'riik.ee',
|
||||
valid_to: Date.new(9999, 1, 1),
|
||||
period: 1,
|
||||
period_unit: 'y',
|
||||
registrant: c,
|
||||
nameservers: ns_list,
|
||||
admin_contacts: [c],
|
||||
tech_contacts: [c],
|
||||
registrar: eis
|
||||
)
|
||||
|
||||
puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace :zonefile do
|
|||
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
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin
|
||||
ORDER BY d.name
|
||||
),
|
||||
chr(10)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue