Sha256: 151fc72577e955fbfc001bdb6c3222e1714655ed0959c20b4fff7217f8f953e3

Contents?: true

Size: 1.54 KB

Versions: 13

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Neetob
  class CLI
    module MonthlyAudit
      module InstancesAndAddons
        module Cloudflare
          class SpfRecordsAreValid < CLI::Base
            def initialize
              super()
            end

            def run
              ui.success "### 3.2.5. Checking whether SPF records are valid"

              domains_data = [["Domain", "SPF records data", "Comments", "Audit Passed"]]
              ui.info("\n", print_to_audit_log: false)
              Neetob::CLI::Cloudflare::Base::ZONE_IDS.keys.select { |domain|
 domain.to_s.include?(".com") }.map do |domain|
                ui.info("Checking SPF records data for #{domain}", print_to_audit_log: false)
                spf_records_verification_data = Neetob::CLI::Cloudflare::VerifySpf.new(domain).run
                audit_passed = (
                  spf_records_verification_data[:hard_fail_not_set_message].present? ||
                  spf_records_verification_data[:message].present?
                ) ? "No" : "Yes"
                comments =
                  spf_records_verification_data[:hard_fail_not_set_message] ||
                  spf_records_verification_data[:message]
                data = spf_records_verification_data[:spf_txt_records].map { |record|
                  "#{record[:name]} => #{record[:content]}"
                }.join(", ")
                domains_data << [domain, data, comments, audit_passed]
              end
              ui.print_table(domains_data)
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
neetob-0.5.29 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.28 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.27 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.26 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.25 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.24 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.23 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.22 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.21 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.20 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.19 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.18 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb
neetob-0.5.17 lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb