enfcli 5.0.1.pre.alpha → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/enfapi/firewall.rb +8 -1
- data/lib/enfcli.rb +14 -17
- data/lib/enfcli/commands/xfw.rb +2 -2
- data/lib/enfcli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d9c54fa175ea6dbbdbda5468a4c0faf70ab6fbd74838ba883a65c8c5ed3ce4
|
4
|
+
data.tar.gz: cde1a3fddf4aad273cdc613b6d99c0228acb7791c2209430774adea2efaf03f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 232754cd6c7b8ccf9d1dd92206eac0470419ba3a60368c1aadd905eb2dbdb9930c9b2a8796ec802ee53b0e6d0a15e3f5493488ec60391e24d4315e75821bfb28
|
7
|
+
data.tar.gz: 677a9b5e6581b2cc636929f8491874dd514a48046900c0a145a152b8b79115daf7103a110f2fea996b97d0642e90e29512482ef58a1e90fb580335ce6ad14380
|
data/Gemfile.lock
CHANGED
data/lib/enfapi/firewall.rb
CHANGED
@@ -26,7 +26,14 @@ module EnfApi
|
|
26
26
|
|
27
27
|
def add_firewall_rule(network, rule)
|
28
28
|
rule_json = EnfApi::to_json(rule)
|
29
|
-
|
29
|
+
|
30
|
+
if network
|
31
|
+
url = "/api/xfw/v2/#{network}/rule"
|
32
|
+
else
|
33
|
+
url = "/api/xfw/v2/rule"
|
34
|
+
end
|
35
|
+
|
36
|
+
EnfApi::API.instance.post url, rule_json
|
30
37
|
end
|
31
38
|
|
32
39
|
def delete_firewall_rules(network, id = nil)
|
data/lib/enfcli.rb
CHANGED
@@ -22,6 +22,7 @@ require "ipaddr"
|
|
22
22
|
require "clipboard"
|
23
23
|
require "json"
|
24
24
|
require "securerandom"
|
25
|
+
require "io/console"
|
25
26
|
|
26
27
|
require "rubygems/commands/update_command"
|
27
28
|
require "rubygems/commands/search_command"
|
@@ -111,21 +112,9 @@ module EnfCli
|
|
111
112
|
end
|
112
113
|
|
113
114
|
def self.ask_password(prompt = nil)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
# We hide the entered characters before to ask for the password
|
118
|
-
system "stty -echo"
|
119
|
-
password = $stdin.gets.chomp
|
120
|
-
system "stty echo"
|
121
|
-
puts ""
|
122
|
-
return password
|
123
|
-
rescue NoMethodError, Interrupt
|
124
|
-
# When the process is exited, we display the characters again
|
125
|
-
# And we exit
|
126
|
-
system "stty echo"
|
127
|
-
exit
|
128
|
-
end
|
115
|
+
prompt ||= "Enter Password: "
|
116
|
+
password = IO::console.getpass prompt
|
117
|
+
return password
|
129
118
|
end
|
130
119
|
|
131
120
|
def self.generate_ec_cert(key, ipv6)
|
@@ -371,8 +360,16 @@ module EnfCli
|
|
371
360
|
Readline.completion_append_character = " "
|
372
361
|
Readline.completion_proc = comp
|
373
362
|
|
374
|
-
|
375
|
-
|
363
|
+
## Need to check stty only on unix like systems. Ignore on windows
|
364
|
+
begin
|
365
|
+
stty_save = `stty -g`.chomp
|
366
|
+
rescue
|
367
|
+
stty_save = nil
|
368
|
+
end
|
369
|
+
trap("INT") {
|
370
|
+
system("stty", stty_save) if stty_save
|
371
|
+
exit
|
372
|
+
}
|
376
373
|
|
377
374
|
while input = Readline.readline(EnfCli::CTX.instance.prompt, true)
|
378
375
|
break if input == "exit" or input == '\q' or input == "quit"
|
data/lib/enfcli/commands/xfw.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2018 Xaptum,Inc
|
2
|
+
# Copyright 2018-2020 Xaptum,Inc
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -91,7 +91,7 @@ module EnfCli
|
|
91
91
|
end
|
92
92
|
|
93
93
|
desc "add-firewall-rule", "Add a firewall rule to a /64 network"
|
94
|
-
method_option :network, :type => :string
|
94
|
+
method_option :network, :type => :string
|
95
95
|
method_option :priority, :type => :numeric, :required => true
|
96
96
|
method_option :protocol, :type => :string, :required => true, :enum => ["TCP", "UDP", "ICMP6", "6", "17", "58"]
|
97
97
|
method_option :source_ip, :type => :string
|
data/lib/enfcli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enfcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Venkatakumar Srinivasan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -269,9 +269,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
269
|
version: '0'
|
270
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
271
|
requirements:
|
272
|
-
- - "
|
272
|
+
- - ">="
|
273
273
|
- !ruby/object:Gem::Version
|
274
|
-
version:
|
274
|
+
version: '0'
|
275
275
|
requirements: []
|
276
276
|
rubygems_version: 3.0.3
|
277
277
|
signing_key:
|