Skip to content

Commit

Permalink
Merge pull request #528 from yast/certificate_details
Browse files Browse the repository at this point in the history
Log details about the imported SSL certificate (bsc#1179464)
  • Loading branch information
lslezak committed Feb 10, 2021
2 parents 9b58f20 + 1356bbf commit 0b165ab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:

- name: Git Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

# just for easier debugging...
- name: Inspect Installed Packages
Expand All @@ -38,7 +38,7 @@ jobs:
steps:

- name: Git Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Rubocop
run: rake check:rubocop
Expand All @@ -50,7 +50,7 @@ jobs:
steps:

- name: Git Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Package Build
run: yast-ci-ruby -o package
Expand All @@ -62,7 +62,7 @@ jobs:
steps:

- name: Git Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Yardoc
run: rake check:doc
Expand All @@ -76,7 +76,7 @@ jobs:
steps:

- name: Git Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Perl Syntax
run: yast-ci-ruby -o perl_syntax
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Feb 8 17:06:54 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

- Log details about the imported SSL certificate during migration
(related to bsc#1179464)
- 4.3.19

-------------------------------------------------------------------
Tue Jan 19 14:27:15 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-registration.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 4.3.18
Version: 4.3.19
Release: 0
Summary: YaST2 - Registration Module
License: GPL-2.0-only
Expand Down
15 changes: 15 additions & 0 deletions src/lib/registration/clients/inst_migration_repos.rb
Expand Up @@ -15,6 +15,8 @@
require "yast"
require "yast/suse_connect"
require "registration/sw_mgmt"
require "registration/ssl_certificate"
require "registration/ssl_certificate_details"

module Registration
module Clients
Expand Down Expand Up @@ -59,13 +61,26 @@ def import_ssl_certificates
if File.exist?(cert_file)
log.info("Importing the SSL certificate from the old system: (#{prefix})#{file} ...")
cert = SslCertificate.load_file(cert_file)
log_certificate(cert)
target_path = File.join(SslCertificate::INSTSYS_CERT_DIR, File.basename(cert_file))
cert.import_to_instsys(target_path)
else
log.debug("SSL certificate (#{prefix})#{file} not found in the system")
end
end
end

# Log the certificate details
# @param cert [Registration::SslCertificate] the SSL certificate
def log_certificate(cert)
# log also the dates
log.info("#{SslCertificateDetails.new(cert).summary}\n" \
"Issued on: #{cert.issued_on}\nExpires on: #{cert.expires_on}")

# log a warning for expired certificate
expires = cert.x509_cert.not_after.localtime
log.warn("The certificate has EXPIRED! (#{expires})") if expires < Time.now
end
end
end
end

0 comments on commit 0b165ab

Please sign in to comment.