Explorar el Código

- add OSSP fsl support to get rid of syslog'ing - replace silly shipped scripts/* with another silly honeyd.service but at least this way do not package crap code - fix PID file writing - cleanup installation procedure - install libhoneyd.so

Ralf S. Engelschall hace 23 años
padre
commit
3273ea4229
Se han modificado 5 ficheros con 101 adiciones y 42 borrados
  1. 16 0
      honeyd/fsl.honeyd
  2. 11 5
      honeyd/honeyd.conf
  3. 38 0
      honeyd/honeyd.service
  4. 29 34
      honeyd/honeyd.spec
  5. 7 3
      honeyd/rc.honeyd

+ 16 - 0
honeyd/fsl.honeyd

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

+ 11 - 5
honeyd/honeyd.conf

@@ -1,10 +1,16 @@
-# Example of a simple host template and its binding
+##
+##  honeyd.conf
+##
+
+#   test host definition
 create testbox
 set testbox personality "FreeBSD 3.2-4.0"
-add testbox tcp port 80 "sh @l_prefix@/share/honeyd/scripts/web.sh"
-add testbox tcp port 22 "sh @l_prefix@/share/honeyd/scripts/test.sh $ipsrc $dport"
+add testbox tcp port 80 "@l_prefix@/libexec/honeyd/honeyd.service http"
+add testbox tcp port 22 "@l_prefix@/libexec/honeyd/honeyd.service ssh"
 add testbox tcp port 23 proxy $ipsrc:23
 set testbox default tcp action reset
 
-bind 10.21.19.102 testbox
-set 10.21.19.102 uptime 1327650
+#   bind the test host to localhost
+bind 127.0.0.1 testbox
+set  127.0.0.1 uptime 1327650
+

+ 38 - 0
honeyd/honeyd.service

@@ -0,0 +1,38 @@
+#!/bin/sh
+##
+##  honeyd.service -- small honeyd(8) service faking script
+##  Copyright (c) 2003 The OpenPKG Project <http://www.openpkg.org/>
+##
+
+#   honeyd(8) provides:
+#   $HONEYD_PERSONALITY
+#   $HONEYD_IP_SRC, $HONEYD_SRC_PORT
+#   $HONEYD_IP_DST, $HONEYD_DST_PORT
+
+service="$1"
+shift
+
+case $service in
+    http )
+        while read line; do
+	        if [ ".$line" = . ]; then
+		        break
+	        fi
+        done
+        echo "HTTP/1.1 404 Not Found"
+        echo "Date: `date`"
+        echo "Server: Apache"
+        echo "Connection: close"
+        echo "Content-Type: text/plain; charset=iso-8859-1"
+        echo ""
+        echo "Error: 404 Not Found"
+        exit 0
+        ;;
+    ssh )
+        echo "SSH-1.5-2.40"
+        read line
+        echo "Protocol mismatch."
+        exit 0
+        ;;
+esac
+

+ 29 - 34
honeyd/honeyd.spec

@@ -23,8 +23,6 @@
 ##  SUCH DAMAGE.
 ##
 
-# FIXME: honeyd do not write a pid file
-
 #   package information
 Name:         honeyd
 Summary:      Creates a Virtual Host on Network
@@ -46,8 +44,8 @@ Patch0:       honeyd.patch
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
-BuildPreReq:  OpenPKG, openpkg >= 20030211, libdnet, libpcap, libevent
-PreReq:       OpenPKG, openpkg >= 20030211
+BuildPreReq:  OpenPKG, openpkg >= 20030211, fsl, libdnet, libpcap, libevent
+PreReq:       OpenPKG, openpkg >= 20030211, fsl
 AutoReq:      no
 AutoReqProv:  no
 
@@ -67,62 +65,59 @@ AutoReqProv:  no
     %patch -p0
 
 %build
+    %{l_shtool} subst \
+        -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \
+        honeyd.h
     CC="%{l_cc}" \
-    CFLAGS="%{l_cflags -O}" \
+    CFLAGS="%{l_cflags -O}"
     ./configure \
         --prefix=%{l_prefix} \
         --with-libdnet=%{l_prefix} \
         --with-libpcap=%{l_prefix} \
-        --with-libevent=%{l_prefix} \
-        --includedir=%{l_prefix}
-    %{l_make} %{l_mflags -O}
+        --with-libevent=%{l_prefix}
+    %{l_shtool} subst \
+        -e "s;^\\(honeyd_LDADD.*\\)$;\\1 `%{l_prefix}/bin/fsl-config --all --ldflags --libs`;" \
+        Makefile
+    %{l_make} %{l_mflags} \
 
 %install
     rm -rf $RPM_BUILD_ROOT
-
-    #   create filesystem hierachy
     %{l_shtool} mkdir -f -p -m 755 \
         $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \
         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
         $RPM_BUILD_ROOT%{l_prefix}/sbin \
         $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
-        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/scripts \
-        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/base \
+        $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd \
+        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \
         $RPM_BUILD_ROOT%{l_prefix}/var/honeyd
 
     #   install files
     %{l_shtool} install -c -s -m 755 \
-        honeyd $RPM_BUILD_ROOT%{l_prefix}/sbin
+        honeyd $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    %{l_shtool} install -c -m 755 \
+        libhoneyd.so $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/
     %{l_shtool} install -c -m 644 \
         honeyd.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
-
-    %{l_shtool} install -c -m 644 \
-        nmap.assoc $RPM_BUILD_ROOT%{l_prefix}/share/honeyd
-
-    %{l_shtool} install -c -m 644 \
-        nmap.prints $RPM_BUILD_ROOT%{l_prefix}/share/honeyd
-
-    %{l_shtool} install -c -m 644 \
-       xprobe2.conf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd
-
     %{l_shtool} install -c -m 644 \
-        scripts/router-telnet.pl $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/scripts
-
-    %{l_shtool} install -c -m 644 \
-        scripts/test.sh $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/scripts
-
+        -e 's;@l_prefix@;%{l_prefix};g' \
+        %{SOURCE honeyd.conf} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/
     %{l_shtool} install -c -m 644 \
-        scripts/web.sh $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/scripts
-
+        nmap.assoc nmap.prints xprobe2.conf \
+        $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/
     %{l_shtool} install -c -m 755 \
         -e 's;@l_prefix@;%{l_prefix};g' \
-       %{SOURCE honeyd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/
-
+        %{SOURCE honeyd.service} \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/
     %{l_shtool} install -c -m 755 \
         -e 's;@l_prefix@;%{l_prefix};g' \
         -e 's;@l_susr@;%{l_susr};g' \
-       %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
-
+        %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+    %{l_shtool} install -c -m 644 \
+        -e 's;@l_prefix@;%{l_prefix};g' \
+        %{SOURCE fsl.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
 
 %files -f files

+ 7 - 3
honeyd/rc.honeyd

@@ -8,8 +8,10 @@
 
 %start -p 200 -u @l_susr@
     opServiceEnabled honeyd || exit 0
-    cd @l_prefix@/share/honeyd/base/
-    @l_prefix@/sbin/honeyd -f @l_prefix@/etc/honeyd/honeyd.conf -p @l_prefix@/share/honeyd/nmap.prints -x  @l_prefix@/share/honeyd/xprobe2.conf -a @l_prefix@/share/honeyd/nmap.assoc >/dev/null 2>&1
+    cd @l_prefix@/share/honeyd
+    @l_prefix@/sbin/honeyd \
+        -f @l_prefix@/etc/honeyd/honeyd.conf \
+        >/dev/null 2>&1
 
 %stop -p 200 -u @l_susr@
     opServiceEnabled honeyd || exit 0
@@ -23,7 +25,9 @@
         kill -TERM `cat @l_prefix@/var/honeyd/honeyd.pid`
         sleep 2
     fi
-    @l_prefix@/sbin/honeyd -F @l_prefix@/etc/honeyd/honeyd.conf >/dev/null 2>&1
+    @l_prefix@/sbin/honeyd \
+        -f @l_prefix@/etc/honeyd/honeyd.conf \
+        >/dev/null 2>&1
 
 %reload -u @l_susr@
     opServiceEnabled honeyd || exit 0