summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-08-07 14:22:48 -0700
committerelijah <elijah@riseup.net>2015-09-24 09:17:03 -0700
commit9352ce45a7950ff1175d3a7e5412fc9006691799 (patch)
treebb2b1070f4e6cb3ac57ab691ac01c98613d6c0f7 /lib
parentbbc95640557e200a5a4e463f451ed647692dc0a3 (diff)
added firewall information to nodes (needed for `leap compile firewall`)
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/macros/stunnel.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/leap_cli/macros/stunnel.rb b/lib/leap_cli/macros/stunnel.rb
index f16308c7..821bda38 100644
--- a/lib/leap_cli/macros/stunnel.rb
+++ b/lib/leap_cli/macros/stunnel.rb
@@ -49,12 +49,14 @@ module LeapCli
result = Config::ObjectList.new
node_list.each_node do |node|
if node.name != self.name || options[:include_self]
+ s_port = stunnel_port(port)
result["#{node.name}_#{port}"] = Config::Object[
'accept_port', @next_stunnel_port,
'connect', node.domain.internal,
- 'connect_port', stunnel_port(port),
+ 'connect_port', s_port,
'original_port', port
]
+ manager.connections.add(:from => @node.ip_address, :to => node.ip_address, :port => s_port)
@next_stunnel_port += 1
end
end
@@ -76,6 +78,15 @@ module LeapCli
}
end
+ #
+ # lists the ips that connect to this node, on particular ports.
+ #
+ def stunnel_firewall
+ manager.connections.select {|connection|
+ connection['to'] == @node.ip_address
+ }
+ end
+
private
#