summaryrefslogtreecommitdiff
path: root/lib/leap_cli/macros
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-10-05 09:47:51 -0700
committerelijah <elijah@riseup.net>2015-10-05 09:47:51 -0700
commitda12768b873e17af261f7fd69aec7d86255fa6e5 (patch)
tree7d581e6598d4920daec96d32017bd4db66a402ed /lib/leap_cli/macros
parentafddd1bfb3cd8d68bdc699c983fdcd54561c44bd (diff)
parent9352ce45a7950ff1175d3a7e5412fc9006691799 (diff)
Merge branch 'feature/firewall' into develop
Diffstat (limited to 'lib/leap_cli/macros')
-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
#