summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))}