neetob 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37b34a8328effd5f52d6793dbcd0b7ebaace6b840d5483fba7d9cf0b93590f31
4
- data.tar.gz: 9e41ab8c605c498da3c07d13feb50d8279430edc94ae0cf4d6ebb42d1eecd544
3
+ metadata.gz: 2b2325ebc1866deb2683b1c5743b1003ce9d6d1b57d6cf001991acea931470fd
4
+ data.tar.gz: c09a5e51b296182e5118bbc0cf5384dbac1fbc4c3a91d714ab0d1ade2a2cae03
5
5
  SHA512:
6
- metadata.gz: 74663e69012d0236361594570230e0e9616971aa17f0d8bb2fecc71bd53d8dc84f3db75b48224e96ce3a3a3967eeb9124341c675c28cac331d9d1963d34bae0a
7
- data.tar.gz: df6bf87c39d320ed428de73ea238ba4244a662e4348c4aa6e2dded52d85767d92b8ab9fac254f5dffd52b8cb43c10d8c6ac6775d9682ccb35c592310902caa7f
6
+ metadata.gz: c77745dec211548d68a9ba9566c0338564ae32bea9e33a8452942f4048a31d19659b2c19ac0ce2866aa88b44897fd7e1df40086a47ecdade4c34a6a82698bf2d
7
+ data.tar.gz: b3a1ff909ee65fef7f280d3f17de2c1b1a62db363bd2c3996f8cd11732c9dd51e0e95cd7d03d6b59dc8f400d6942fb0d3fa282800e6700293a5da38004ddf6b7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.5.1)
4
+ neetob (0.5.2)
5
5
  brakeman (~> 5.0)
6
6
  chronic
7
7
  dotenv (~> 2.8.1)
@@ -72,7 +72,8 @@ module Neetob
72
72
  "neetotribe.com": "45eb5b7d96820cf7c375dcdaf608d4c7",
73
73
  "neetotribe.net": "f49cb0229b1d67d228da7ab39a17dde3",
74
74
  "neetowireframe.com": "d6d17a3dab91dc0ca4b9f4f65b086ccc",
75
- "neetowireframe.net": "5866b3f9d20b45800d5657ec59ac630e"
75
+ "neeto.com": "83eeffbce76df68b60e50d1fa254b3fa",
76
+ "bigbinary.com": "dc60ee7ecbff0ef5e58e1bb27ad40e89"
76
77
  }
77
78
 
78
79
  def initialize
@@ -7,6 +7,7 @@ require_relative "always_use_https"
7
7
  require_relative "dns_proxy_status"
8
8
  require_relative "ensure_cdn"
9
9
  require_relative "bot_fight_mode"
10
+ require_relative "verify_spf"
10
11
 
11
12
  module Neetob
12
13
  class CLI
@@ -47,6 +48,12 @@ module Neetob
47
48
  def bot_fight_mode
48
49
  BotFightMode.new(options[:domain]).process
49
50
  end
51
+
52
+ desc "verify_spf", "Validate the TXT records for SPF"
53
+ option :domain, type: :string, aliases: "-d", required: true, description: "Domain name"
54
+ def verify_spf
55
+ VerifySpf.new(options[:domain]).process
56
+ end
50
57
  end
51
58
  end
52
59
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Neetob
6
+ class CLI
7
+ module Cloudflare
8
+ class VerifySpf < Base
9
+ attr_accessor :domain
10
+
11
+ def initialize(domain)
12
+ super()
13
+ @domain = domain
14
+ end
15
+
16
+ def run
17
+ zone_id = ZONE_IDS[domain.to_sym]
18
+ raise(StandardError, "Domain '#{domain}' not found.") if zone_id.nil?
19
+
20
+ url = create_url(zone_id, "dns_records")
21
+ response = get(url)
22
+
23
+ raise(StandardError, "No DNS records found") if response[:result].empty?
24
+
25
+ spf_txt_records = response[:result].filter { |dns| dns[:type] == "TXT" && dns[:content].start_with?("v=spf1") }
26
+
27
+ if spf_txt_records.count > 1
28
+ ui.error("More than one TXT record found for SPF")
29
+ else
30
+ ui.success("Only one TXT record for SPF present")
31
+ end
32
+
33
+ spf_txt_records.each_with_index do |dns, index|
34
+ ui.info("SPF TXT #{index + 1}: #{dns[:content]}")
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -34,6 +34,8 @@ module Neetob
34
34
  ui.info `neetob cloudflare always_use_https -d #{domain} | sed 's/^/ /'`
35
35
  ui.info "Bot fight mode"
36
36
  ui.info `neetob cloudflare bot_fight_mode -d #{domain} | sed 's/^/ /'`
37
+ ui.info "Validating SPF records"
38
+ ui.info `neetob cloudflare verify_spf -d #{domain} | sed 's/^/ /'`
37
39
  if is_heroku(app_name)
38
40
  ui.info "Heroku maintenance time"
39
41
  ui.info `neetob heroku maintenance_window -a #{app_name} | sed 's/^/ /'`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
@@ -179,6 +179,7 @@ files:
179
179
  - lib/neetob/cli/cloudflare/ensure_cdn.rb
180
180
  - lib/neetob/cli/cloudflare/min_tls_version.rb
181
181
  - lib/neetob/cli/cloudflare/ssl_mode.rb
182
+ - lib/neetob/cli/cloudflare/verify_spf.rb
182
183
  - lib/neetob/cli/code/audit.rb
183
184
  - lib/neetob/cli/code/commands.rb
184
185
  - lib/neetob/cli/fetchorupdate_repos/execute.rb