summaryrefslogtreecommitdiff
path: root/provider_base/files/service-definitions/eip-service.json.erb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-04-24 18:04:48 -0700
committerelijah <elijah@riseup.net>2013-04-24 18:04:48 -0700
commit4ed2bb37ea8283f79aecca8b78e80b141e9eff50 (patch)
treebcfae0217321ffbab9212e65ecfe159d58deaa9a /provider_base/files/service-definitions/eip-service.json.erb
parent2bd18fcad2e1446388948ed0b98232d93564b8ad (diff)
provider base - service definitions are now versioned (requires new leap_cli)
Diffstat (limited to 'provider_base/files/service-definitions/eip-service.json.erb')
-rw-r--r--provider_base/files/service-definitions/eip-service.json.erb48
1 files changed, 0 insertions, 48 deletions
diff --git a/provider_base/files/service-definitions/eip-service.json.erb b/provider_base/files/service-definitions/eip-service.json.erb
deleted file mode 100644
index ca42bef5..00000000
--- a/provider_base/files/service-definitions/eip-service.json.erb
+++ /dev/null
@@ -1,48 +0,0 @@
-<%=
- def underscore(words)
- words = words.to_s.dup
- words.downcase!
- words.gsub! /[^a-z]/, '_'
- words
- end
-
- def add_gateway(node, locations, options={})
- return nil if options[:ip] == 'REQUIRED'
- gateway = {}
- gateway["capabilities"] = node.openvpn.pick(:ports, :protocols, :user_ips, :adblock, :filter_dns)
- gateway["capabilities"]["transport"] = ["openvpn"]
- gateway["host"] = node.domain.full
- gateway["ip_address"] = options[:ip]
- gateway["capabilities"]["limited"] = options[:limited]
- if node.location
- location_name = underscore(node.location.name)
- gateway["location"] = location_name
- locations[location_name] ||= node.location
- end
- gateway
- end
-
- hsh = {}
- hsh["serial"] = 1
- hsh["version"] = 1
- locations = {}
- gateways = []
- nodes_like_me[:services => 'openvpn'].each_node do |node|
- if node.openvpn.allow_limited && node.openvpn.allow_unlimited
- gateways << add_gateway(node, locations, :ip => node.openvpn.gateway_address, :limited => false)
- gateways << add_gateway(node, locations, :ip => node.openvpn.second_gateway_address, :limited => true)
- elsif node.openvpn.allow_unlimited
- gateways << add_gateway(node, locations, :ip => node.openvpn.gateway_address, :limited => false)
- elsif node.openvpn.allow_limited
- gateways << add_gateway(node, locations, :ip => node.openvpn.gateway_address, :limited => true)
- end
- end
- hsh["gateways"] = gateways.compact
- hsh["locations"] = locations
- hsh["openvpn_configuration"] = {
- "tls-cipher" => "DHE-RSA-AES128-SHA",
- "auth" => "SHA1",
- "cipher" => "AES-128-CBC"
- }
- generate_json hsh
-%> \ No newline at end of file