summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-01-07 15:28:04 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-01-07 15:28:04 +0000
commit90051ddcc2f7e5aba74c55dc93a78fa900bca28f (patch)
tree92daa2964b28ef63e92368352dca49c2d37ab428
parent922067213b59ef05204931c0d3177e452ea6cddf (diff)
Write zonefile
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@45 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xGenerate16
1 files changed, 15 insertions, 1 deletions
diff --git a/Generate b/Generate
index bcc0af9..b841bbb 100755
--- a/Generate
+++ b/Generate
@@ -296,8 +296,22 @@ $config['hosts'].each_pair{ |name, host|
}
throw "Duplicate iface names" unless iface_dup_check.size == $config['hosts'].size
-
hostlist = $config['hosts'].values.sort{ |a,b| a['host_no'] <=> b['host_no'] }
+
+#####################################################################
+# Create the zonefile
+zonefile = File.new("#{$NAMESPACE}.zone", "w")
+zonefile.puts "; zonefile snipped for #{$NAMESPACE} VPN"
+zonefile.puts "; Automatically created on #{THISHOST} at #{RIGHTNOW} by #{THISPROGRAM}."
+hostlist.each{ |host|
+ zonefile.puts "#{host['name']} IN A #{host['vpn_address']}"
+ zonefile.puts "#{host['name']} IN AAAA #{host['vpn_address6']}" if host['ipv6']
+}
+zonefile.puts
+zonefile.puts "; vim:set syn=dns:"
+zonefile.close
+
+#####################################################################
hostlist.each{ |host|
peers = hostlist.find_all{ |peer| host['name'] != peer['name'] and want_connection(host, peer) and (can_connect(host,peer) or can_connect(peer,host))}