mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
e35f445860
11 changed files with 75 additions and 33 deletions
|
@ -10,6 +10,7 @@ group :red_green_refactor, halt_on_fail: true do
|
|||
# end
|
||||
|
||||
guard :rspec, cmd: 'spring rspec --fail-fast', notification: false do
|
||||
# guard :rspec, cmd: 'spring rspec', notification: false do
|
||||
watch(%r{^spec/.+_spec\.rb$})
|
||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
|
|
|
@ -8,10 +8,15 @@ module Repp
|
|||
end
|
||||
|
||||
before do
|
||||
next if Rails.env.test?
|
||||
message = 'Certificate mismatch! Cert common name should be:'
|
||||
request_name = ENV['HTTP_SSL_CLIENT_S_DN_CN']
|
||||
|
||||
if request.ip == ENV['webclient_ip']
|
||||
error! 'Certificate mismatch', 401 if env['HTTP_SSL_CLIENT_S_DN_CN'] != 'webclient'
|
||||
webclient_cert_name = ENV['webclient_cert_common_name'] || 'webclient'
|
||||
error! "#{message} #{webclient_cert_name}", 401 if webclient_cert_name != request_name
|
||||
else
|
||||
error! 'Certificate mismatch', 401 if env['HTTP_SSL_CLIENT_S_DN_CN'] != @current_user.username
|
||||
error! "#{message} #{@current_user.username}", 401 if @current_user.username != request_name
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ class Epp::DomainsController < EppController
|
|||
|
||||
def find_domain
|
||||
domain_name = params[:parsed_frame].css('name').text.strip.downcase
|
||||
@domain = Epp::Domain.find_by(name: domain_name)
|
||||
@domain = Epp::Domain.where(name: domain_name).first
|
||||
|
||||
unless @domain
|
||||
epp_errors << {
|
||||
|
|
|
@ -58,6 +58,9 @@ class Certificate < ActiveRecord::Base
|
|||
errors.add(:base, I18n.t('failed_to_create_certificate'))
|
||||
logger.error('FAILED TO CREATE CLIENT CERTIFICATE')
|
||||
logger.error(err)
|
||||
# rubocop:disable Rails/Output
|
||||
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
|
||||
# rubocop:enable Rails/Output
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -174,9 +174,9 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def destroy_orphans
|
||||
STDOUT << "#{Time.now.utc} - Destroying orphaned contacts\n"
|
||||
logger.info "#{Time.now.utc} - Destroying orphaned contacts\n"
|
||||
count = find_orphans.destroy_all.count
|
||||
STDOUT << "#{Time.now.utc} - Successfully destroyed #{count} orphaned contacts\n"
|
||||
logger.info "#{Time.now.utc} - Successfully destroyed #{count} orphaned contacts\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -241,39 +241,51 @@ class Domain < ActiveRecord::Base
|
|||
# rubocop:disable Metrics/MethodLength
|
||||
def update_whois_body
|
||||
self.whois_body = <<-EOS
|
||||
This Whois Server contains information on
|
||||
Estonian Top Level Domain ee TLD
|
||||
This Whois Server contains information on
|
||||
Estonian Top Level Domain ee TLD
|
||||
|
||||
domain: #{name}
|
||||
registrar: #{registrar}
|
||||
status:
|
||||
registered:
|
||||
changed: #{updated_at.to_s(:db)}
|
||||
expire:
|
||||
outzone:
|
||||
delete:
|
||||
domain: #{name}
|
||||
registrar: #{registrar}
|
||||
status:
|
||||
registered: #{registered_at and registered_at.to_s(:db)}
|
||||
changed: #{updated_at and updated_at.to_s(:db)}
|
||||
expire:
|
||||
outzone:
|
||||
delete:
|
||||
|
||||
contact
|
||||
name:
|
||||
e-mail:
|
||||
registrar:
|
||||
created:
|
||||
#{contacts_body}
|
||||
|
||||
contact:
|
||||
nsset:
|
||||
nserver:
|
||||
|
||||
nsset:
|
||||
nserver:
|
||||
|
||||
registrar:
|
||||
org:
|
||||
url:
|
||||
phone:
|
||||
address:
|
||||
created:
|
||||
changed:
|
||||
registrar: #{registrar}
|
||||
phone: #{registrar.phone}
|
||||
address: #{registrar.address}
|
||||
created: #{registrar.created_at.to_s(:db)}
|
||||
changed: #{registrar.updated_at.to_s(:db)}
|
||||
EOS
|
||||
end
|
||||
# rubocop:enabled Metrics/MethodLength
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
def contacts_body
|
||||
out = ''
|
||||
admin_contacts.includes(:registrar).each do |c|
|
||||
out << 'Admin contact:'
|
||||
out << "name: #{c.name}"
|
||||
out << "email: #{c.email}"
|
||||
out << "registrar: #{c.registrar}"
|
||||
out << "created: #{c.created_at.to_s(:db)}"
|
||||
end
|
||||
|
||||
tech_contacts.includes(:registrar).each do |c|
|
||||
out << 'Tech contact:'
|
||||
out << "name: #{c.name}"
|
||||
out << "email: #{c.email}"
|
||||
out << "registrar: #{c.registrar}"
|
||||
out << "created: #{c.created_at.to_s(:db)}"
|
||||
end
|
||||
out
|
||||
end
|
||||
|
||||
def whois_server_update(name, whois_body)
|
||||
wd = Whois::Domain.find_or_initialize_by(name: name)
|
||||
|
|
|
@ -42,7 +42,7 @@ class Epp::Contact < Contact
|
|||
return super if frame.blank?
|
||||
|
||||
custom_code =
|
||||
if frame.css('id').present?
|
||||
if frame.css('id').text.present?
|
||||
"#{registrar.code}:#{frame.css('id').text.parameterize}"
|
||||
else
|
||||
nil
|
||||
|
|
|
@ -22,6 +22,7 @@ ca_key_password: 'your-root-key-password'
|
|||
|
||||
# Used only by EPP server, you can leave it empty when running admin server:
|
||||
webclient_ip: '127.0.0.1'
|
||||
webclient_cert_common_name: 'webclient'
|
||||
|
||||
# DEPP configuration
|
||||
show_ds_data_fields: 'false'
|
||||
|
|
|
@ -49,5 +49,6 @@ Rails.application.configure do
|
|||
Bullet.enable = true
|
||||
Bullet.bullet_logger = true
|
||||
Bullet.raise = true # raise an error if n+1 query occurs
|
||||
# Bullet.unused_eager_loading_enable = false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace :db do
|
|||
|
||||
puts "\n---------------------------- Import seed ----------------------------------------\n"
|
||||
Rake::Task['db:seed'].invoke
|
||||
Rake::Task['zonefile:replace_procedure'].invoke
|
||||
puts "\n All done!\n\n"
|
||||
end
|
||||
|
||||
|
|
|
@ -145,6 +145,24 @@ describe 'EPP Contact', epp: true do
|
|||
Contact.last.code.should == 'registrar1:12345'
|
||||
end
|
||||
|
||||
it 'should generate server id when id is empty' do
|
||||
response = create_request({ id: { value: '' } })
|
||||
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should_not == 'registrar1:'
|
||||
end
|
||||
|
||||
it 'should generate server id when id is empty' do
|
||||
response = create_request
|
||||
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should_not == 'registrar1:'
|
||||
end
|
||||
|
||||
it 'should return parameter value policy error for org' do
|
||||
response = create_request({ postalInfo: { org: { value: 'should not save' } } })
|
||||
response[:msg].should ==
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue