Kaynağa Gözat

new package: rbldnsd 0.993p1 (Realtime Blackhole List (RBL) DNS Daemon)

Ralf S. Engelschall 21 yıl önce
ebeveyn
işleme
a7c2a91056
6 değiştirilmiş dosya ile 271 ekleme ve 0 silme
  1. 16 0
      rbldnsd/fsl.rbldnsd
  2. 20 0
      rbldnsd/rbldnsd.patch
  3. 131 0
      rbldnsd/rbldnsd.spec
  4. 8 0
      rbldnsd/rbldnsd.zones
  5. 75 0
      rbldnsd/rc.rbldnsd
  6. 21 0
      rbldnsd/zone.rbl

+ 16 - 0
rbldnsd/fsl.rbldnsd

@@ -0,0 +1,16 @@
+##
+##  fsl.rbldnsd -- OSSP fsl configuration
+##
+
+ident (rbldnsd)/.+ q{
+    prefix(
+        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
+    )
+    -> {
+        debug: file(
+            path="@l_prefix@/var/rbldnsd/rbldnsd.log",
+            perm=0644
+        )
+    }
+};
+

+ 20 - 0
rbldnsd/rbldnsd.patch

@@ -0,0 +1,20 @@
+Index: rbldnsd.c
+--- rbldnsd.c.orig	2004-06-09 23:39:21 +0200
++++ rbldnsd.c	2004-07-15 12:40:03 +0200
+@@ -532,7 +532,6 @@
+     }
+     ipc_fd = pfd[1];
+     close(pfd[0]);
+-    openlog(progname, LOG_PID|LOG_NDELAY, LOG_DAEMON);
+     logto = LOGTO_STDERR|LOGTO_SYSLOG;
+     if (!quickstart && !flog) logto |= LOGTO_STDOUT;
+   }
+@@ -590,6 +589,8 @@
+     if (setgroups(1, &gid) < 0 || setgid(gid) < 0 || setuid(uid) < 0)
+       error(errno, "unable to setuid(%d:%d)", (int)uid, (int)gid);
+ 
++  openlog("rbldnsd", LOG_PID|LOG_NDELAY, LOG_DAEMON);
++
+   for(c = 0; c < argc; ++c)
+     zonelist = addzone(zonelist, argv[c]);
+   init_zones_caches(zonelist);

+ 131 - 0
rbldnsd/rbldnsd.spec

@@ -0,0 +1,131 @@
+##
+##  rbldnsd.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package information
+Name:         rbldnsd
+Summary:      Realtime Blackhole List (RBL) DNS Daemon
+URL:          http://www.corpit.ru/mjt/rbldnsd.html
+Vendor:       Michael Tokarev
+Packager:     The OpenPKG Project
+Distribution: OpenPKG
+Class:        EVAL
+Group:        DNS
+License:      GPL
+Version:      0.993p1
+Release:      20040715
+
+#   package options
+%option       with_fsl    yes
+
+#   list of sources
+Source0:      http://www.corpit.ru/mjt/rbldnsd/rbldnsd_%{version}.tar.gz
+Source1:      rc.rbldnsd
+Source3:      fsl.rbldnsd
+Source4:      rbldnsd.zones
+Source5:      zone.rbl
+Patch0:       rbldnsd.patch
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130
+PreReq:       OpenPKG, openpkg >= 20040130
+%if "%{with_fsl}" == "yes"
+BuildPreReq:  fsl >= 1.3.0
+PreReq:       fsl >= 1.3.0
+%endif
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    RBLDNSD is a small authoritate-only DNS nameserver designed to serve
+    DNS-based blocklists (DNSBLs). It may handle IP-based and name-based
+    blocklists. It is extremely fast and outperforms BIND greatly. It
+    has very small memory footprint.
+
+%track
+    prog rbldnsd = {
+        version   = %{version}
+        url       = http://www.corpit.ru/mjt/rbldnsd/
+        regex     = rbldnsd_(__VER__)\.tar\.gz
+    }
+
+%prep
+    %setup -q
+    %patch -p0
+
+%build
+    #   configure program
+    CC="%{l_cc}" \
+    CFLAGS="%{l_cflags -O}" \
+    CPPFLAGS="%{l_cppflags}" \
+    LDFLAGS="%{l_ldflags}  %{l_fsl_ldflags}" \
+    LIBS="%{l_fsl_libs}" \
+    ./configure
+
+    #   build program
+    %{l_make} %{l_mflags}
+
+%install
+    #   create installation hierarchy
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rbldnsd \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
+        $RPM_BUILD_ROOT%{l_prefix}/var/rbldnsd
+
+    #   install program and manual page
+    %{l_shtool} install -c -s -m 755 \
+        rbldnsd $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    %{l_shtool} install -c -m 644 \
+        rbldnsd.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.rbldnsd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   install OSSP fsl configuration
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        %{SOURCE fsl.rbldnsd}  $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
+
+    #   install default configuration
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        %{SOURCE rbldnsd.zones} %{SOURCE zone.rbl} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rbldnsd/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/rbldnsd/*' \
+        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rbldnsd'
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+

+ 8 - 0
rbldnsd/rbldnsd.zones

@@ -0,0 +1,8 @@
+##
+##  rbldnsd.zones -- rbldnsd(8) zone definitions
+##
+##  Format is <zone>:<type>:<file>
+##
+
+rbl.example.com:combined:zone.rbl
+

+ 75 - 0
rbldnsd/rc.rbldnsd

@@ -0,0 +1,75 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.rbldnsd -- Run-Commands
+##
+
+%config
+    rbldnsd_enable="$openpkg_rc_def"
+    rbldnsd_bind="127.0.0.1/53"
+    rbldnsd_flags=""
+    rbldnsd_log_prolog="true"
+    rbldnsd_log_epilog="true"
+    rbldnsd_log_numfiles="10"
+    rbldnsd_log_minsize="1M"
+    rbldnsd_log_complevel="9"
+
+%common
+    rbldnsd_workdir="@l_prefix@/etc/rbldnsd"
+    rbldnsd_statfile="@l_prefix@/var/rbldnsd/rbldnsd.stat"
+    rbldnsd_logfile="@l_prefix@/var/rbldnsd/rbldnsd.log"
+    rbldnsd_pidfile="@l_prefix@/var/rbldnsd/rbldnsd.pid"
+    rbldnsd_signal () {
+        [ -f $rbldnsd_pidfile ] && kill -$1 `cat $rbldnsd_pidfile`
+    }
+
+%status -u @l_rusr@ -o
+    rbldnsd_usable="unknown"
+    rbldnsd_active="no"
+    rcService rbldnsd enable yes && \
+        rbldnsd_signal 0 && rbldnsd_active="yes"
+    echo "rbldnsd_enable=\"$rbldnsd_enable\""
+    echo "rbldnsd_usable=\"$rbldnsd_usable\""
+    echo "rbldnsd_active=\"$rbldnsd_active\""
+
+%start -u @l_susr@
+    rcService rbldnsd enable yes || exit 0
+    rcService rbldnsd active yes && exit 0
+    eval @l_prefix@/sbin/rbldnsd \
+        -q \
+        -u @l_rusr@:@l_rgrp@ \
+        -b $rbldnsd_bind \
+        -w $rbldnsd_workdir \
+        -p $rbldnsd_pidfile \
+        -l $rbldnsd_logfile \
+        -s $rbldnsd_statfile \
+        $rbldnsd_flags \
+        `sed -ne '/^ *#.*$/d' -e '/^ *$/d' -e 'p' \
+             <$rbldnsd_workdir/rbldnsd.zones`
+
+%stop -u @l_susr@
+    rcService rbldnsd enable yes || exit 0
+    rcService rbldnsd active no && exit 0
+    rbldnsd_signal TERM
+    rm -f $rbldnsd_pidfile 2>/dev/null || true
+
+%restart -u @l_susr@
+    rcService rbldnsd enable yes || exit 0
+    rcService rbldnsd active no && exit 0
+    rc rbldnsd stop
+    sleep 2
+    rc rbldnsd start
+
+%reload -u @l_susr@
+    rcService rbldnsd enable yes || exit 0
+    rcService rbldnsd active no && exit 0
+    rbldnsd_signal HUP
+
+%daily -u @l_susr@
+    rcService rbldnsd enable yes || exit 0
+    shtool rotate -f \
+        -n ${rbldnsd_log_numfiles} -s ${rbldnsd_log_minsize} -d \
+        -z ${rbldnsd_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
+        -P "${rbldnsd_log_prolog}" \
+        -E "${rbldnsd_log_epilog} && rc rbldnsd restart" \
+        $rbldnsd_logfile
+

+ 21 - 0
rbldnsd/zone.rbl

@@ -0,0 +1,21 @@
+##
+##  zone.sample -- sample rbldnsd(8) zone (ip4set format)
+##
+
+#   common section
+$SOA 1w ns1.example.com root.ns1.example.com 0 2h 2h 1w 1h
+$NS  1w ns1.example.com ns2.example.com
+$TTL 1w
+
+#   data set header
+$DATASET ip4set @
+$1 Example Realtime Blackhole List (RBL)
+$2 http://rbl.example.com/rbl?
+:127.0.0.2:Listed in $1, see $2$
+
+#   data set values (examples only)
+10/8           ; RFC 1918
+172.16/12      ; RFC 1918
+192.168/16     ; RFC 1918
+127.0.0.1/32   ; Unix loopback
+