Sha256: b264913c97694e361d8796728976a15a8cbf75938e9230fca2e1833036172461
Contents?: true
Size: 1.96 KB
Versions: 2
Compression:
Stored size: 1.96 KB
Contents
# frozen_string_literal: true module Neetob class CLI module MonthlyAudit module InstancesAndAddons module Cloudflare class DnsEntryHasProxyStatus < CLI::Base DOMAINS_TO_IGNORE_AUDIT_RESULT_FOR = [ "neeto.com", "bigbinary.com", "neetorecord.com", ] def initialize super() end def run ui.success "### 3.2.2. Checking whether DNS entry has proxy status" domains_data = [["Domain", "DNS proxy status", "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 proxy status for DNS entries for #{domain}", print_to_audit_log: false) domain = domain.to_s proxiable_records = Neetob::CLI::Cloudflare::DnsProxyStatus.new(domain).run record_to_check = proxiable_records.select { |record| record[:name] == "*.#{domain}" }.first if record_to_check.nil? audit_passed = DOMAINS_TO_IGNORE_AUDIT_RESULT_FOR.include?(domain.to_s) ? "Ignored" : "No" domains_data << [domain, "No * records found", audit_passed] else is_wildcard_subdomain_proxied = record_to_check[:proxied] audit_passed = DOMAINS_TO_IGNORE_AUDIT_RESULT_FOR.include?(domain.to_s) ? "Ignored" : (is_wildcard_subdomain_proxied ? "Yes" : "No") proxy_status = is_wildcard_subdomain_proxied ? "on" : "off" domains_data << [domain, "#{record_to_check[:name]} has proxying turned #{proxy_status}", audit_passed] end end ui.print_table(domains_data) end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems