mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Update cn-s as well
This commit is contained in:
parent
8f794d05ce
commit
02cc84b761
1 changed files with 8 additions and 0 deletions
|
@ -4,9 +4,17 @@ class UpdateCerts < ActiveRecord::Migration
|
||||||
if x.crt.present? && x.csr.present?
|
if x.crt.present? && x.csr.present?
|
||||||
x.interface = Certificate::REGISTRAR
|
x.interface = Certificate::REGISTRAR
|
||||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||||
|
|
||||||
|
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||||
|
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||||
|
x.common_name = cn.split('/').first
|
||||||
elsif x.crt.present? && x.csr.blank?
|
elsif x.crt.present? && x.csr.blank?
|
||||||
x.interface = Certificate::API
|
x.interface = Certificate::API
|
||||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||||
|
|
||||||
|
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||||
|
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||||
|
x.common_name = cn.split('/').first
|
||||||
elsif x.crt.blank? && x.csr.present?
|
elsif x.crt.blank? && x.csr.present?
|
||||||
x.interface = Certificate::REGISTRAR
|
x.interface = Certificate::REGISTRAR
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue