Sha256: f4c96cc4c1460228a05eedf6122a54b059452dba847cd5a49c6bc31dea192968
Contents?: true
Size: 1.84 KB
Versions: 12
Compression:
Stored size: 1.84 KB
Contents
# frozen_string_literal: true module Neetob class CLI module MonthlyAudit module InstancesAndAddons module NeetoDeploy class SslCertificatesOverThirtyDaysFromExpiry < CLI::Base def initialize super() end def run ui.success "### 3.1.1. Checking whether SSL certificates are over 30 days from expiry" apps_data = [["App", "Certificates status", "Comments", "Audit Passed"]] ui.info("\n", print_to_audit_log: false) Neetob::CLI::Sre::Base::APPS_LIST[:neetodeploy].select { |app| app.include?("production") }.each do |app| ui.info("Checking Certificates status for #{app}", print_to_audit_log: false) certificates_status = Neetob::CLI::NeetoDeploy::Certificates.new(app).run audit_passed = nil comments = nil if certificates_status.is_a?(Hash) && certificates_status["error"] == "Forbidden" audit_passed = "No" comments = "You do not have permission to access the certificates for this app." else audit_passed = certificates_status.any? { |certificate| certificate["expires_before_30_days"] } ? "No" : "Yes" if audit_passed == "No" certificates_failing_audit = certificates_status.select { |certificate| certificate["expires_before_30_days"] }.map { |certificate| certificate["name"] } comments = "Certificates #{certificates_failing_audit.join(", ")} are expiring in less than 30 days." end end apps_data << [app, certificates_status, comments, audit_passed] end ui.print_table(apps_data) end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems