Class: Kscript::KkWgAclUtils
- Inherits:
-
Base
- Object
- Base
- Kscript::KkWgAclUtils
show all
- Defined in:
- lib/kscript/plugins/kk_wg_acl_utils.rb
Constant Summary
collapse
- WIREGUARD_PORT =
51_821
- ALLOWED_IPS =
%w[127.0.0.1].freeze
Instance Attribute Summary
Attributes inherited from Base
#logger
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#human_output?, inherited, #with_error_handling
Constructor Details
#initialize(*args, **opts) ⇒ KkWgAclUtils
Returns a new instance of KkWgAclUtils.
15
16
17
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 15
def initialize(*args, **opts)
super
end
|
Class Method Details
.arguments ⇒ Object
31
32
33
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 31
def self.arguments
'[subcommand] [options]'
end
|
.author ⇒ Object
43
44
45
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 43
def self.author
'kk'
end
|
.description ⇒ Object
47
48
49
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 47
def self.description
'Manage WireGuard firewall ACL rules.'
end
|
.group ⇒ Object
39
40
41
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 39
def self.group
'network'
end
|
.usage ⇒ Object
35
36
37
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 35
def self.usage
"kscript wg_acl add --ip=10.0.0.2\nkscript wg_acl list"
end
|
Instance Method Details
#apply_rules ⇒ Object
25
26
27
28
29
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 25
def apply_rules
add_whitelist_rules
ensure_firewall_enabled
display_current_rules
end
|
#run ⇒ Object
19
20
21
22
23
|
# File 'lib/kscript/plugins/kk_wg_acl_utils.rb', line 19
def run
with_error_handling do
apply_rules
end
end
|