neetob 0.4.31 → 0.4.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/neetob/cli/cloudflare/always_use_https.rb +27 -0
- data/lib/neetob/cli/cloudflare/base.rb +118 -0
- data/lib/neetob/cli/cloudflare/commands.rb +46 -0
- data/lib/neetob/cli/cloudflare/dns_proxy_status.rb +36 -0
- data/lib/neetob/cli/cloudflare/ensure_cloudflare_cdn.rb +30 -0
- data/lib/neetob/cli/cloudflare/min_tls_version.rb +27 -0
- data/lib/neetob/cli/cloudflare/ssl_mode.rb +27 -0
- data/lib/neetob/cli.rb +4 -0
- data/lib/neetob/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 654c4db0eef050fd28616b0d6772cda67e128329c6254bd6b324a7fc896e006d
|
4
|
+
data.tar.gz: 78ebe61e488eab59a4f36a0c3358cbf52396d66b1dfc35ca563dc6049a6746af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92443f52abc392485e2ca80ee4cbc297dc7c8c6c39ccb50dd984e64f25154751df3b4ca30dad8eef9fa6a9abeb00c4dfe6de029cb09222da89532bea897d35b2
|
7
|
+
data.tar.gz: 9ea3255eda4492d95b0ffbff905cfa92022d8e0da0f037b07017fffe51ee090e09b25cdcca21257fd72fda0a5dc67b1f9ebde5e752753f255a17b6b6440f6b7b
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class AlwaysUseHttps < 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, "settings/always_use_https")
|
21
|
+
response = get(url)
|
22
|
+
ui.info("Always use HTTPS is turned #{response[:result][:value]}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../base"
|
4
|
+
require "byebug"
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class Base < CLI::Base
|
9
|
+
NEETO_DEPLOY_DOCS = "https://github.com/bigbinary/neetob/#working-with-neetodeploy"
|
10
|
+
|
11
|
+
ZONE_IDS = {
|
12
|
+
"neetoauth.com": "81ade5aa3e075489533f903dc03b1e88",
|
13
|
+
"neetoauth.net": "4260febb059f04068fa0105765d9ef39",
|
14
|
+
"neetocal.com": "40a8ce54e49b2abf6c113b06efc33caf",
|
15
|
+
"neetocal.net": "899c96f5c95884c96c8f40574749e6b0",
|
16
|
+
"neetocentral.com": "94d1a30430c247be253dd131bbf75994",
|
17
|
+
"neetocentral.net": "fce73845e62b663124cf51190bdfc2b8",
|
18
|
+
"neetochangelog.com": "9059c0a0f0699a1e9ea97d8159114c30",
|
19
|
+
"neetochangelog.net": "a3c27a97e6dbfe2bdf518269dedef9dc",
|
20
|
+
"neetochat.com": "17295de45a5455d02725f337e60e5664",
|
21
|
+
"neetochat.net": "1bcdc8e62717e703cf2f6954e6525e20",
|
22
|
+
"neetochatify.com": "021482cc245d96cd8806ef19c20d6b10",
|
23
|
+
"neetochatify.net": "31e3445557656d5a6f732bbb7de9bb5a",
|
24
|
+
"neetoci.com": "3faaaced0e91e08eb2d613fbffdad490",
|
25
|
+
"neetoci.net": "dd205596095ed10d7776c3a057a53f46",
|
26
|
+
"neetocode.com": "0359dcaec1119b18dc33a217123dbdb1",
|
27
|
+
"neetocode.net": "9180dab7f7071c9f845a33e19121c3a9",
|
28
|
+
"neetocourse.com": "f5e2995e841578a263a1a2e378e60d07",
|
29
|
+
"neetocourse.net": "471a8f99942950ad2eea8f2cbbae38c0",
|
30
|
+
"neetocoursesite.com": "b131662b2c97cf1982f32bac89f005cf",
|
31
|
+
"neetocoursesite.net": "036a7fb612edc71b10363c331f7f9f73",
|
32
|
+
"neetocrm.com": "76f3aae935e58b1d9277f05299950c3d",
|
33
|
+
"neetocrm.net": "aa5fca152b1f925119d5819e4c58340e",
|
34
|
+
"neetodeploy.com": "cc43d7c29dceec872cd2a51a5389bc32",
|
35
|
+
"neetodeploy.net": "01329b72a46fb30e6f12981c398c4728",
|
36
|
+
"neetodesk.com": "eabcea3740bb428ce0161e3dccad5a33",
|
37
|
+
"neetodesk.net": "af812f4ea35348eaece3b499988d1cd3",
|
38
|
+
"neetoform.com": "71ff2cbde5d472a9d987298cc2af50f6",
|
39
|
+
"neetoform.net": "6af6e63021fba23eed48100ad440479a",
|
40
|
+
"neetogit.com": "4925445a663a4de68eaf6e959243aaad",
|
41
|
+
"neetogit.net": "a4a850fb571785305ca517949a4efdb9",
|
42
|
+
"neetogrow.com": "784cda433030c1475b7a32295e98feb7",
|
43
|
+
"neetogrow.net": "67a171f16ae95e6435b1789f203a7853",
|
44
|
+
"neetoinvisible.com": "5d6b37f2985fd0a45b49b13e88dd0bae",
|
45
|
+
"neetoinvisible.net": "d2753ed781ce97f8b3803a90c8c9384f",
|
46
|
+
"neetoinvoice.com": "0394b5ce1d094459ca700fa051f01d60",
|
47
|
+
"neetoinvoice.net": "4c864591b2b986abcb6de133b6c3815d",
|
48
|
+
"neetokb.com": "25804f331677e305adb550cba3a672dc",
|
49
|
+
"neetokb.net": "c8aa648cf3bd886d77c4ffb2288fdb53",
|
50
|
+
"neetoplanner.com": "680db9b8804ea976581109c800f83721",
|
51
|
+
"neetoplanner.net": "ebe6db8f92b31e8bf086ae8e961955d1",
|
52
|
+
"neetoplaydash.com": "12c88df4f0bfdb29a959f1840abea512",
|
53
|
+
"neetoplaydash.net": "67e2a4c3d4a71f3ae83cfa35d9e18925",
|
54
|
+
"neetopublish.com": "d66450d159922e7f704c2a9a46c6256c",
|
55
|
+
"neetopublish.net": "af9c5ea6b0c293a9831ddbe1dec2082f",
|
56
|
+
"neetoquiz.com": "864154a83f452dd62b1331c8d7d125e0",
|
57
|
+
"neetoquiz.net": "608320f45d132f7f49fca17ba5a96bde",
|
58
|
+
"neetorecord.com": "8b8173c36c932ce2e66d15101a16b227",
|
59
|
+
"neetorecord.net": "7ec3958aab651f9a8c1a4422ca4521b8",
|
60
|
+
"neetoreplay.com": "dcec9a107cc7b39a67690827d0712b88",
|
61
|
+
"neetoreplay.net": "8eb99a1f88e28b07dc965aa807a1b69a",
|
62
|
+
"neetorunner.com": "9727602fd57ab5c63645df341a0c79c1",
|
63
|
+
"neetorunner.net": "8b5b81e94e1238cb7d8bd4062c788233",
|
64
|
+
"neetosite.com": "10a07b451a511a57513a74d40ae3680d",
|
65
|
+
"neetosite.net": "23064d6c435af82b92a102b465d5faf6",
|
66
|
+
"neetosurvey.com": "a0dfcaec5d88a2e99500bdc4957eba27",
|
67
|
+
"neetosurvey.net": "96edf6d04a4666b6b1bef507a17c958b",
|
68
|
+
"neetotestify.com": "b2d592bc096b4c1b80c6941bd1a8597c",
|
69
|
+
"neetotestify.net": "1bbb5bf2ea04121c57a3690d2f40c5dc",
|
70
|
+
"neetotower.com": "9175d2e1bb19735b9b22c101ac162d31",
|
71
|
+
"neetotower.net": "10f9eba21876cd174952b830aba0ba71",
|
72
|
+
"neetotrail.com": "5c88708910e51c140b5f4c8d02e648fe",
|
73
|
+
"neetotrail.net": "317026e5fd62381767b1e351dab24bd4",
|
74
|
+
"neetotribe.com": "45eb5b7d96820cf7c375dcdaf608d4c7",
|
75
|
+
"neetotribe.net": "f49cb0229b1d67d228da7ab39a17dde3",
|
76
|
+
"neetowireframe.com": "d6d17a3dab91dc0ca4b9f4f65b086ccc",
|
77
|
+
"neetowireframe.net": "5866b3f9d20b45800d5657ec59ac630e"
|
78
|
+
}
|
79
|
+
|
80
|
+
def initialize
|
81
|
+
super()
|
82
|
+
end
|
83
|
+
|
84
|
+
def process(*args)
|
85
|
+
run(*args)
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def create_url(zone_id, endpoint)
|
91
|
+
"https://api.cloudflare.com/client/v4/zones/#{zone_id}/#{endpoint}"
|
92
|
+
end
|
93
|
+
|
94
|
+
def parse_response(http_result)
|
95
|
+
case http_result
|
96
|
+
when Net::HTTPSuccess
|
97
|
+
JSON.parse(http_result.body, symbolize_names: true)
|
98
|
+
else
|
99
|
+
error_message = JSON.parse(http_result.body)["errors"][0]["message"]
|
100
|
+
raise(StandardError, "Request failed with status code #{http_result.code}: #{error_message}")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def get(url, headers: { "Accept" => "application/json", "Authorization" => ENV["CLOUDFLARE_API_KEY"] })
|
105
|
+
uri = URI(url)
|
106
|
+
request = Net::HTTP::Get.new(uri)
|
107
|
+
headers.each { |key, value| request[key] = value }
|
108
|
+
|
109
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
|
110
|
+
http.request(request)
|
111
|
+
end
|
112
|
+
|
113
|
+
parse_response(response)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require_relative "ssl_mode"
|
5
|
+
require_relative "min_tls_version"
|
6
|
+
require_relative "always_use_https"
|
7
|
+
require_relative "dns_proxy_status"
|
8
|
+
require_relative "ensure_cloudflare_cdn"
|
9
|
+
|
10
|
+
module Neetob
|
11
|
+
class CLI
|
12
|
+
module Cloudflare
|
13
|
+
class Commands < Thor
|
14
|
+
desc "ssl_mode", "Check the value of SSL Mode for your domain in Cloudflare"
|
15
|
+
option :domain, type: :string, aliases: "-d", required: true, description: "Domain name"
|
16
|
+
def ssl_mode
|
17
|
+
SSLMode.new(options[:domain]).process
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "min_tls_version", "Check the value of the minimum TLS version for your domain in Cloudflare"
|
21
|
+
option :domain, type: :string, aliases: "-d", required: true, description: "Domain name"
|
22
|
+
def min_tls_version
|
23
|
+
MinTlsVersion.new(options[:domain]).process
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "always_use_https", "Check if always use HTTPS setting is turned on for your domain in Cloudflare"
|
27
|
+
option :domain, type: :string, aliases: "-d", required: true, description: "Domain name"
|
28
|
+
def always_use_https
|
29
|
+
AlwaysUseHttps.new(options[:domain]).process
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "dns_proxy_status", "Check if DNS proxy status is enabled for all DNS records of your domain in Cloudflare"
|
33
|
+
option :domain, type: :string, aliases: "-d", required: true, description: "Domain name"
|
34
|
+
def dns_proxy_status
|
35
|
+
DnsProxyStatus.new(options[:domain]).process
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "ensure_cloudflare_cdn", "Check if an app is using Cloudflare CDN. App name is the app name in NeetoDeploy (Example: neeto-replay-web-production)"
|
39
|
+
option :app, type: :string, aliases: "-a", required: true, description: "App name (neeto-replay-web)"
|
40
|
+
def ensure_cloudflare_cdn
|
41
|
+
EnsureCloudflareCdn.new(options[:app]).process
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class DnsProxyStatus < 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
|
+
response[:result].each do |record|
|
26
|
+
if record[:proxiable]
|
27
|
+
ui.info(
|
28
|
+
"DNS proxy is turned #{record[:proxied] ? "on" : "off"} " \
|
29
|
+
"for #{record[:type]} record #{record[:name]}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class EnsureCloudflareCdn < Base
|
9
|
+
attr_accessor :app
|
10
|
+
|
11
|
+
def initialize(app)
|
12
|
+
super()
|
13
|
+
@app = app
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
command = <<-CMD
|
18
|
+
neetob neetodeploy config_vars list --apps #{app} | grep 'ASSET_HOST' |
|
19
|
+
awk -F '|' '{print $3}' | xargs
|
20
|
+
CMD
|
21
|
+
|
22
|
+
asset_host = `#{command}`
|
23
|
+
raise(StandardError, "ASSET_HOST env is not set for #{app}") if asset_host.empty?
|
24
|
+
|
25
|
+
ui.success("ASSET_HOST for #{app} is #{asset_host}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class MinTlsVersion < 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, "settings/min_tls_version")
|
21
|
+
response = get(url)
|
22
|
+
ui.info("Minimum TLS version is set to #{response[:result][:value]}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Neetob
|
6
|
+
class CLI
|
7
|
+
module Cloudflare
|
8
|
+
class SSLMode < 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, "settings/ssl")
|
21
|
+
response = get(url)
|
22
|
+
ui.info("SSL Mode is set to #{response[:result][:value]}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/neetob/cli.rb
CHANGED
@@ -5,6 +5,7 @@ require "thor"
|
|
5
5
|
module Neetob
|
6
6
|
class CLI < Thor
|
7
7
|
require_relative "cli/heroku/commands"
|
8
|
+
require_relative "cli/cloudflare/commands"
|
8
9
|
require_relative "cli/github/commands"
|
9
10
|
require_relative "cli/users/commands"
|
10
11
|
require_relative "cli/fetchorupdate_repos/execute"
|
@@ -28,6 +29,9 @@ module Neetob
|
|
28
29
|
desc "github", "Interact with any resource in Github"
|
29
30
|
subcommand "github", Github::Commands
|
30
31
|
|
32
|
+
desc "cloudflare", "Interact with any resource in Cloudflare"
|
33
|
+
subcommand "cloudflare", Cloudflare::Commands
|
34
|
+
|
31
35
|
desc "neetodeploy", "Interact with resources in neetoDeploy"
|
32
36
|
subcommand "neetodeploy", NeetoDeploy::Commands
|
33
37
|
|
data/lib/neetob/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neetob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Udai Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -171,6 +171,13 @@ files:
|
|
171
171
|
- lib/neetob.rb
|
172
172
|
- lib/neetob/cli.rb
|
173
173
|
- lib/neetob/cli/base.rb
|
174
|
+
- lib/neetob/cli/cloudflare/always_use_https.rb
|
175
|
+
- lib/neetob/cli/cloudflare/base.rb
|
176
|
+
- lib/neetob/cli/cloudflare/commands.rb
|
177
|
+
- lib/neetob/cli/cloudflare/dns_proxy_status.rb
|
178
|
+
- lib/neetob/cli/cloudflare/ensure_cloudflare_cdn.rb
|
179
|
+
- lib/neetob/cli/cloudflare/min_tls_version.rb
|
180
|
+
- lib/neetob/cli/cloudflare/ssl_mode.rb
|
174
181
|
- lib/neetob/cli/code/audit.rb
|
175
182
|
- lib/neetob/cli/code/commands.rb
|
176
183
|
- lib/neetob/cli/fetchorupdate_repos/execute.rb
|