aboutsummaryrefslogtreecommitdiffstats
path: root/dns
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2001-03-05 16:58:43 +0800
committerknu <knu@FreeBSD.org>2001-03-05 16:58:43 +0800
commitdc0ff1000a1168256b8855de935dae0021288fc0 (patch)
tree46148768dcaaeb83d84a00b05b2a69de1145e830 /dns
parent4d0ffe3b6efa23463cef765c66cad07458173485 (diff)
downloadfreebsd-ports-gnome-dc0ff1000a1168256b8855de935dae0021288fc0.tar.gz
freebsd-ports-gnome-dc0ff1000a1168256b8855de935dae0021288fc0.tar.zst
freebsd-ports-gnome-dc0ff1000a1168256b8855de935dae0021288fc0.zip
Add dns_balance, a dynamic load-balancing DNS server.
Diffstat (limited to 'dns')
-rw-r--r--dns/dns_balance/Makefile79
-rw-r--r--dns/dns_balance/distinfo1
-rw-r--r--dns/dns_balance/files/dns_balance.sh30
-rw-r--r--dns/dns_balance/files/patch-dns_balance.rb62
-rw-r--r--dns/dns_balance/files/patch-log_writer.rb12
-rw-r--r--dns/dns_balance/files/patch-util.rb11
-rw-r--r--dns/dns_balance/pkg-comment1
-rw-r--r--dns/dns_balance/pkg-descr9
-rw-r--r--dns/dns_balance/pkg-plist32
9 files changed, 237 insertions, 0 deletions
diff --git a/dns/dns_balance/Makefile b/dns/dns_balance/Makefile
new file mode 100644
index 000000000000..444d8f278850
--- /dev/null
+++ b/dns/dns_balance/Makefile
@@ -0,0 +1,79 @@
+# Ports collection makefile for: DNS Balance
+# Date created: 5 March 2001
+# Whom: Akinori MUSHA aka knu <knu@idaemons.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= dns_balance
+PORTVERSION= 0.6
+CATEGORIES= net
+MASTER_SITES= http://www.netlab.is.tsukuba.ac.jp/~yokota/archive/
+DISTNAME= DNS-Balance-${PORTVERSION}
+
+MAINTAINER= knu@FreeBSD.org
+
+USE_RUBY= yes
+
+NO_BUILD= yes
+
+RUBY_SHEBANG_FILES= ${WRKSRC}/dns_balance.rb \
+ ${WRKSRC}/sample/makedb.rb \
+ ${WRKSRC}/sample/makeringdb.rb \
+ ${WRKSRC}/sample/make_namespace.rb
+ETCS= addrdb.rb \
+ namespace.rb
+LIBS= datatype.rb \
+ log_writer.rb \
+ util.rb
+EXAMPLES_EXEC= make_namespace.rb \
+ makedb.rb \
+ makeringdb.rb \
+ ringupdate.sh
+EXAMPLES_DATA= addr \
+ addr.ring \
+ addr.ring.txt \
+ addr.txt \
+ namespace.txt
+DOCS_EN= Q_and_A.dns_balance.eng \
+ README.dns_balance.eng \
+ README.dnsbalance+daemontools.eng
+DOCS_JA= ChangeLog \
+ Q_and_A.dns_balance \
+ README.dns_balance \
+ README.dnsbalance+daemontools
+
+post-patch:
+ ${RUBY} -pe 'gsub /!!PREFIX!!/, "${PREFIX}"' ${WRKSRC}/dns_balance.rb > ${WRKSRC}/dns_balance
+ ${RUBY} -pe 'gsub /!!PREFIX!!/, "${PREFIX}"' ${FILESDIR}/dns_balance.sh > ${WRKSRC}/dns_balance.sh
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/dns_balance ${PREFIX}/sbin/
+ ${MKDIR} ${PREFIX}/etc/${PORTNAME}
+.for f in ${ETCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f}-dist
+ [ ! -f ${PREFIX}/etc/${PORTNAME}/${f} ] && ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f}
+.endfor
+ ${MKDIR} ${PREFIX}/lib/${PORTNAME}
+.for f in ${LIBS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/lib/${PORTNAME}/
+.endfor
+ ${INSTALL_SCRIPT} ${WRKSRC}/dns_balance.sh ${PREFIX}/etc/rc.d/
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${PREFIX}/share/examples/${PORTNAME}
+.for f in ${EXAMPLES_EXEC}
+ ${INSTALL_DATA} ${WRKSRC}/sample/${f} ${PREFIX}/share/examples/${PORTNAME}/
+.endfor
+.for f in ${EXAMPLES_DATA}
+ ${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${PREFIX}/share/examples/${PORTNAME}/
+.endfor
+ ${MKDIR} ${PREFIX}/share/doc/${PORTNAME}/ja
+.for f in ${DOCS_EN}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/share/doc/${PORTNAME}/
+.endfor
+.for f in ${DOCS_JA}
+ ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${PREFIX}/share/doc/${PORTNAME}/ja/
+.endfor
+.endif
+
+.include <bsd.port.mk>
diff --git a/dns/dns_balance/distinfo b/dns/dns_balance/distinfo
new file mode 100644
index 000000000000..40ad3f428f45
--- /dev/null
+++ b/dns/dns_balance/distinfo
@@ -0,0 +1 @@
+MD5 (DNS-Balance-0.6.tar.gz) = 6341fda789189d9e5cd38957a562b51b
diff --git a/dns/dns_balance/files/dns_balance.sh b/dns/dns_balance/files/dns_balance.sh
new file mode 100644
index 000000000000..49c7fff46472
--- /dev/null
+++ b/dns/dns_balance/files/dns_balance.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+dns_balance="!!PREFIX!!/sbin/dns_balance"
+pidfile="/var/run/dns_balance.pid"
+logfile="/var/log/dns_balance.log"
+#listen="-i 192.168.0.1"
+
+case "$1" in
+start)
+ if [ -x $dns_balance ]; then
+ echo -n ' dns_balance'
+ $dns_balance -l $logfile -p $pidfile $listen
+ fi
+ ;;
+stop)
+ if [ -f $pidfile ]; then
+ kill `cat $pidfile` && echo -n ' dns_balance'
+ else
+ echo ' dns_balance: not running'
+ fi
+ ;;
+*)
+ echo "Usage: `basename $0` {start|stop}" >&2
+ exit 64
+ ;;
+esac
+
+exit 0
diff --git a/dns/dns_balance/files/patch-dns_balance.rb b/dns/dns_balance/files/patch-dns_balance.rb
new file mode 100644
index 000000000000..f23d043f24eb
--- /dev/null
+++ b/dns/dns_balance/files/patch-dns_balance.rb
@@ -0,0 +1,62 @@
+--- dns_balance.rb.orig Fri Dec 22 12:46:39 2000
++++ dns_balance.rb Mon Mar 5 16:59:36 2001
+@@ -10,6 +10,8 @@
+ require 'thread'
+ require 'getopts'
+
++$:.unshift "!!PREFIX!!/etc/dns_balance", "!!PREFIX!!/lib/dns_balance"
++
+ require 'datatype.rb'
+ require 'log_writer.rb'
+ require 'util.rb'
+@@ -138,9 +140,10 @@
+ end
+
+ def usage()
+- print "Usage: ruby dns_balance.rb [-lh] [-i ipaddr]\n"
+- print " -l print log to stdout\n"
++ print "Usage: dns_balance [-h] [-i ipaddr] [-l logfile] [-p pidfile]\n"
++ print " -l logfile print log to logfile\n"
+ print " -i ipaddr listen IP address (default:0.0.0.0)\n"
++ print " -p pidfile record PID in pidfile\n"
+ print " -h help message\n"
+ exit(111)
+ end
+@@ -149,9 +152,36 @@
+ # main
+
+ srand()
+-getopts("lh", "i:0.0.0.0")
++getopts("h", "i:0.0.0.0", 'l:', 'p:')
+
+ usage() if $OPT_h
++
++exit! if fork
++Process::setsid
++exit! if fork
++STDIN.close
++STDOUT.close
++STDERR.close
++
++$pidfile = nil
++if $OPT_p
++ $pidfile = $OPT_p
++ File::open($pidfile, 'w') { |f| f.puts $$ }
++end
++
++$logout = nil
++if $OPT_l
++ $logout = File::open($OPT_l, 'a+')
++ $logout.sync = true
++end
++
++[0, 2, 3, 5, 10, 13, 15].each do |sig|
++ trap(sig) {
++ File::unlink($pidfile) if $pidfile
++ $logout.close if $logout
++ exit
++ }
++end
+
+ put_log("start\n") if $OPT_l
+
diff --git a/dns/dns_balance/files/patch-log_writer.rb b/dns/dns_balance/files/patch-log_writer.rb
new file mode 100644
index 000000000000..e18aced47fb8
--- /dev/null
+++ b/dns/dns_balance/files/patch-log_writer.rb
@@ -0,0 +1,12 @@
+--- log_writer.rb.orig Fri Dec 22 12:46:39 2000
++++ log_writer.rb Mon Mar 5 16:05:06 2001
+@@ -12,8 +12,7 @@
+
+ def put_log(str)
+ $loglock.synchronize do
+- $stdout.print(str)
+- $stdout.flush
++ $logout.print(str)
+ end
+ end
+
diff --git a/dns/dns_balance/files/patch-util.rb b/dns/dns_balance/files/patch-util.rb
new file mode 100644
index 000000000000..f07d4242a82f
--- /dev/null
+++ b/dns/dns_balance/files/patch-util.rb
@@ -0,0 +1,11 @@
+--- util.rb.orig Fri Dec 22 12:46:39 2000
++++ util.rb Mon Mar 5 13:53:57 2001
+@@ -27,7 +27,7 @@
+ #
+ # ex) "127.0.0.1" => "\x7f\x0\x0\x1"
+ def str_to_ipstr(str)
+- arr = str.split(".").filter{|i| i.to_i}
++ arr = str.split(".").collect{|i| i.to_i}
+
+ if arr.length != 4
+ put_log("ipaddr invalid\n")
diff --git a/dns/dns_balance/pkg-comment b/dns/dns_balance/pkg-comment
new file mode 100644
index 000000000000..913087b4a9f2
--- /dev/null
+++ b/dns/dns_balance/pkg-comment
@@ -0,0 +1 @@
+A dynamic load-balancing DNS server
diff --git a/dns/dns_balance/pkg-descr b/dns/dns_balance/pkg-descr
new file mode 100644
index 000000000000..5fa28c7c3438
--- /dev/null
+++ b/dns/dns_balance/pkg-descr
@@ -0,0 +1,9 @@
+DNS Balance is a load-balancing DNS server which:
+
+o Does dynamic load balancing.
+o Can answer the most proper resolution based on the client's IP
+ address.
+o Implements "A" record lookups only. This would be good for
+ security.
+
+WWW: http://openlab.ring.gr.jp/dns_balance/index.html.en
diff --git a/dns/dns_balance/pkg-plist b/dns/dns_balance/pkg-plist
new file mode 100644
index 000000000000..c5fcc99f9bdf
--- /dev/null
+++ b/dns/dns_balance/pkg-plist
@@ -0,0 +1,32 @@
+sbin/dns_balance
+@unexec if cmp -s %D/etc/dns_balance/addrdb.rb %D/etc/dns_balance/addrdb.rb-dist; then rm -f %D/etc/dns_balance/addrdb.rb; fi
+etc/dns_balance/addrdb.rb-dist
+@exec [ ! -f %B/addrdb.rb ] && cp %B/%f %B/addrdb.rb
+@unexec if cmp -s %D/etc/dns_balance/namespace.rb %D/etc/dns_balance/namespace.rb-dist; then rm -f %D/etc/dns_balance/namespace.rb; fi
+etc/dns_balance/namespace.rb-dist
+@exec [ ! -f %B/namespace.rb ] && cp %B/%f %B/namespace.rb
+@dirrm etc/dns_balance
+etc/rc.d/dns_balance.sh
+lib/dns_balance/datatype.rb
+lib/dns_balance/log_writer.rb
+lib/dns_balance/util.rb
+@dirrm lib/dns_balance
+%%PORTDOCS%%share/doc/dns_balance/Q_and_A.dns_balance.eng
+%%PORTDOCS%%share/doc/dns_balance/README.dns_balance.eng
+%%PORTDOCS%%share/doc/dns_balance/README.dnsbalance+daemontools.eng
+%%PORTDOCS%%share/doc/dns_balance/ja/ChangeLog
+%%PORTDOCS%%share/doc/dns_balance/ja/Q_and_A.dns_balance
+%%PORTDOCS%%share/doc/dns_balance/ja/README.dns_balance
+%%PORTDOCS%%share/doc/dns_balance/ja/README.dnsbalance+daemontools
+%%PORTDOCS%%@dirrm share/doc/dns_balance/ja
+%%PORTDOCS%%@dirrm share/doc/dns_balance
+%%PORTDOCS%%share/examples/dns_balance/addr
+%%PORTDOCS%%share/examples/dns_balance/addr.ring
+%%PORTDOCS%%share/examples/dns_balance/addr.ring.txt
+%%PORTDOCS%%share/examples/dns_balance/addr.txt
+%%PORTDOCS%%share/examples/dns_balance/make_namespace.rb
+%%PORTDOCS%%share/examples/dns_balance/makedb.rb
+%%PORTDOCS%%share/examples/dns_balance/makeringdb.rb
+%%PORTDOCS%%share/examples/dns_balance/namespace.txt
+%%PORTDOCS%%share/examples/dns_balance/ringupdate.sh
+%%PORTDOCS%%@dirrm share/examples/dns_balance