diff --git a/app/jobs/nameserver_record_validation_job.rb b/app/jobs/nameserver_record_validation_job.rb index 5a32ce133..d4c9b194d 100644 --- a/app/jobs/nameserver_record_validation_job.rb +++ b/app/jobs/nameserver_record_validation_job.rb @@ -108,12 +108,12 @@ class NameserverRecordValidationJob < ApplicationJob false end - def inform_to_tech_contact(domain:, text:) - ContactNotification.notify_tech_contact(domain: domain, text: text) + def inform_to_tech_contact(domain:, text: nil) + ContactNotification.notify_tech_contact(domain: domain, reason: 'nameserver') end - def inform_to_registrar(text:, nameserver:) - # text = "DNSKEYS for #{domain.name} are invalid!" + def inform_to_registrar(nameserver:, text: nil) + text = "Host record #{nameserver.hostname} of a domain #{nameserver.domain} is invalid. Please fix or contact the registrant." logger.info text ContactNotification.notify_registrar(domain: nameserver.domain, text: text) end diff --git a/app/jobs/validate_dnssec_job.rb b/app/jobs/validate_dnssec_job.rb index 54f7818c5..3277914f1 100644 --- a/app/jobs/validate_dnssec_job.rb +++ b/app/jobs/validate_dnssec_job.rb @@ -46,10 +46,10 @@ class ValidateDnssecJob < ApplicationJob return if flag - text = "DNSKEYS for #{domain.name} are invalid!" + text = "DNSKEY record of a domain #{domain.name} is invalid. Please fix or contact the registrant." logger.info text ContactNotification.notify_registrar(domain: domain, text: text) - ContactNotification.notify_tech_contact(domain: domain, text: text) + ContactNotification.notify_tech_contact(domain: domain, reason: 'dnssec') end def validate(hostname:, domain:, type: 'DNSKEY', klass: 'IN') diff --git a/app/mailers/contact_inform_mailer.rb b/app/mailers/contact_inform_mailer.rb index 00834a8ae..7423da791 100644 --- a/app/mailers/contact_inform_mailer.rb +++ b/app/mailers/contact_inform_mailer.rb @@ -1,11 +1,20 @@ class ContactInformMailer < ApplicationMailer helper_method :address_processing - def notify(contact:, domain:, subject:) + def notify_dnssec(contact:, domain:) @contact = contact - @subject = subject @domain = domain + subject = "Domeeni #{@domain.name} DNSSEC kirjed ei ole korrektsed / The DNSKEY records of the domain #{@domain.name} are invalid" + + mail(to: contact.email, subject: subject) + end + + def notify_nameserver(contact:, domain:) + @contact = contact + @domain = domain + + subject = "Domeeni #{@domain.name} nimeserveri kirjed ei ole korrektsed / The host records of the domain #{@domain.name} are invalid" mail(to: contact.email, subject: subject) end diff --git a/app/services/contact_notification.rb b/app/services/contact_notification.rb index d14526fea..16765d65d 100644 --- a/app/services/contact_notification.rb +++ b/app/services/contact_notification.rb @@ -5,12 +5,20 @@ module ContactNotification domain.registrar.notifications.create(text: text) end - def notify_tech_contact(domain:, text:) - # text = "DNSKEYS for #{domain.name} are invalid!" - domain.tech_contacts.each do |tech| - contact = Contact.find(tech.id) + def notify_tech_contact(domain:, reason: nil) + case reason + when 'dnssec' + domain.tech_contacts.each do |tech| + contact = Contact.find(tech.id) - ContactInformMailer.notify(contact: contact, domain: domain, subject: text).deliver_now + ContactInformMailer.notify_dnssec(contact: contact, domain: domain).deliver_now + end + when 'nameserver' + domain.tech_contacts.each do |tech| + contact = Contact.find(tech.id) + + ContactInformMailer.notify_nameserver(contact: contact, domain: domain).deliver_now + end end end end diff --git a/app/views/mailers/contact_inform_mailer/notify.html.erb b/app/views/mailers/contact_inform_mailer/notify.html.erb deleted file mode 100644 index 224584706..000000000 --- a/app/views/mailers/contact_inform_mailer/notify.html.erb +++ /dev/null @@ -1 +0,0 @@ -
DNSKEYS for <%= @domain.name %> are invalid!
diff --git a/app/views/mailers/contact_inform_mailer/notify.text.erb b/app/views/mailers/contact_inform_mailer/notify.text.erb deleted file mode 100644 index 224584706..000000000 --- a/app/views/mailers/contact_inform_mailer/notify.text.erb +++ /dev/null @@ -1 +0,0 @@ -DNSKEYS for <%= @domain.name %> are invalid!
diff --git a/app/views/mailers/contact_inform_mailer/notify_dnssec.html.erb b/app/views/mailers/contact_inform_mailer/notify_dnssec.html.erb new file mode 100644 index 000000000..4b506b9e8 --- /dev/null +++ b/app/views/mailers/contact_inform_mailer/notify_dnssec.html.erb @@ -0,0 +1,40 @@ ++Eesti Interneti Sihtasutusele (EIS) juhib tähelepanu, et domeeni <%= @domain.name %> DNSKEY kirjed on puudulikud ning domeeniga seotud teenuse ei pruugi korrektselt toimida. +
++Andmete parandamiseks vaadake palun üle domeeni nimeserverite seaditused või pöörduge palun oma registripidaja <%= @domain.registrar.name %> või nimeserveri teenuse pakkuja poole.
+ ++Lisaküsimuste korral võtke palun ühendust oma registripidajaga: +
+<%= @domain.registrar.name %>+Estonian Internet Foundation points out that the DNSKEY record(s) for the domain <%= @domain.name %> are invalid and the service related to the domain may not work correctly. +
++Please check the DNSKEY records of the domain or contact your registrar <%= @domain.registrar.name%> or your name server service provider to correct this information. +
++Should you have additional questions, please contact your registrar: +
+<%= @domain.registrar.name %>+Eesti Interneti Sihtasutusele (EIS) juhib tähelepanu, et domeeni <%= @domain.name %> nimeserverite seaded on puudulikud ning domeeniga seotud teenuse ei pruugi korrektselt toimida.
++Andmete parandamiseks vaadake palun üle domeeni nimeserverite seaditused või pöörduge palun oma registripidaja <%= @domain.registrar.name%> või nimeserveri teenuse pakkuja poole. +
+ ++Lisaküsimuste korral võtke palun ühendust oma registripidajaga: +
+ +<%= @domain.registrar.name %>+ Estonian Internet Foundation points out that the settings for the name servers of the domain <%= @domain.name %> are incomplete and the service related to the domain may not work correctly. +
++Please check the name server settings of the domain or contact your registrar <%= @domain.registrar.name%> or your name server service provider to correct this information. +
+ ++Should you have additional questions, please contact your registrar: +
+ +<%= @domain.registrar.name%>