Changeset 1283

Show
Ignore:
Timestamp:
06/06/07 10:04:16 (1 year ago)
Author:
till
Message:

- unfreeze unsupported packtes in ipq/nfq connection monitors
- skeleton for a submitMwserv plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeytrap/trunk/configure.in

    r1282 r1283  
    411411 
    412412 
     413AC_ARG_WITH(submit-mwserv, 
     414        [  --with-submit-mwserv     Submit malware samples to a central server]) 
     415AM_CONDITIONAL(BUILD_SUBMIT_MWSERV_PLUGIN, test x$with_submit_mwserv = xyes) 
     416if test "$with_submit_mwserv" = "yes"; then 
     417        with_submit_mwserv="X" 
     418 
     419        AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) 
     420        AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect)) 
     421 
     422        AC_ARG_WITH(libcurl_includes, 
     423        [  --with-libcurl-includes=DIR  libcurl include directory], 
     424        [with_libcurl_includes="$withval"],[with_libcurl_includes=no]) 
     425 
     426        AC_ARG_WITH(libcurl_libraries, 
     427        [  --with-libcurl-libraries=DIR  libcurl library directory], 
     428        [with_libcurl_libraries="$withval"],[with_libcurl_libraries=no]) 
     429 
     430        if test "$with_libcurl_includes" != "no"; then 
     431                CPPFLAGS="${CPPFLAGS} -I${with_libcurl_includes}" 
     432        fi 
     433        AC_CHECK_HEADER(curl.h,,[AC_ERROR(curl.h not found.)]) 
     434 
     435        AC_CHECK_LIB(curl, curl_version, LCURL="yes", LCURL="no") 
     436        if test "$LCURL" = "no"; then 
     437                echo 
     438                echo "   ERROR!  Libcurl library/headers not found. Install it or use the" 
     439                echo "   --with-libcurl-* options, if you have it installed in unusual place." 
     440                echo 
     441                exit 
     442        fi 
     443        if test "x$libcurl" = xno ; then 
     444                AC_MSG_CHECKING([checking for curl with SSL]) 
     445                LIBS="$LIBS -lcurl -L/usr/local/ssl/lib -lssl -lcrypto" 
     446                AC_TRY_LINK([#include <curl/curl.h>], [curl_version();], libcurl=yes, 
     447                libcurl=no) 
     448                if test "x$libcurl" = xno ; then 
     449                        AC_MSG_RESULT(no) 
     450                        AC_MSG_ERROR([libcurl required. Go to http://curl.haxx.se/ to download and then install it first]) 
     451                else 
     452                        AC_MSG_RESULT(yes) 
     453                fi 
     454        fi  
     455else 
     456        with_submit_mwserv=" " 
     457fi 
     458 
     459 
     460 
    413461AC_ARG_WITH(postgres, 
    414462        [  --with-postgres          Store attack data in PostgreSQL database]) 
     
    505553AC_SUBST(INCLUDES) 
    506554 
    507 if test $with_ipq_mon != "yes" -a $with_nfq_mon != "yes" -a $with_ipfw_mon != "yes" -a $with_pcap_mon != "yes"; then 
     555if test ! $with_ipq_mon -a ! $with_nfq_mon -a ! $with_ipfw_mon -a ! $with_pcap_mon; then 
    508556  echo 
    509557  echo "   ERROR! No connection monitor selected. Please reconfigure with --with-pcap-mon, --with-nfq-mon  or --with-ipq-mon." 
     
    511559  exit 1 
    512560fi 
     561 
     562echo $with_ipq_mon, $sith_nfq_mon, $with_ipfw_mon, $with_pcap_mon 
    513563 
    514564 
     
    524574echo "--- honeytrap configuration ---" 
    525575echo "General options" 
    526 echo -e "  \x5b$enable_debug]  Debugging" 
    527 echo -e "  \x5b$enable_profiling]  Profiling" 
    528 echo -e "  \x5b$with_efence]  Electric Fence" 
     576echo -e "  ($enable_debug)  Debugging" 
     577echo -e "  ($enable_profile)  Profiling" 
     578echo -e "  ($with_efence)  Electric Fence" 
    529579echo 
    530580echo "Connection monitor" 
    531 echo -e "  \x5b$with_ipq_mon]  Linux ip_queue (ipq)" 
    532 echo -e "  \x5b$with_ipfw_mon]  FreeBSD ipfw (ipfw)" 
    533 echo -e "  \x5b$with_nfq_mon]  Linux libnetfilter_queue (nfq)" 
    534 echo -e "  \x5b$with_pcap_mon]  Libpcap (pcap)" 
     581echo -e "  ($with_ipq_mon)  Linux ip_queue (ipq)" 
     582echo -e "  ($with_ipfw_mon)  FreeBSD ipfw (ipfw)" 
     583echo -e "  ($with_nfq_mon)  Linux libnetfilter_queue (nfq)" 
     584echo -e "  ($with_pcap_mon)  Libpcap (pcap)" 
    535585echo 
    536586echo "Optional plugins" 
    537 echo -e "  \x5b$with_clamav]  ClamAV" 
    538 echo -e "  \x5b$with_cpuemu]  cpuEmu" 
    539 echo -e "  \x5b$with_postgres]  PostgeSQL" 
    540 echo -e "  \x5b$with_spamsum]  SpamSum" 
     587echo -e "  ($with_clamav)  ClamAV" 
     588echo -e "  ($with_cpuemu)  cpuEmu" 
     589echo -e "  ($with_postgres)  PostgeSQL" 
     590echo -e "  ($with_spamsum)  SpamSum" 
     591echo -e "  ($with_submit_mwserv)  submitMwserv" 
  • honeytrap/trunk/src/ipqmon.c

    r1282 r1283  
    3434#define BUFSIZE 1500 
    3535 
    36 static void die(struct ipq_handle *h) { 
    37         logmsg(LOG_ERR, 1, "IPQ Error: %s.\n", ipq_errstr()); 
    38         ipq_destroy_handle(h); 
    39         clean_exit(EXIT_SUCCESS); 
    40 } 
    4136 
    4237int start_ipq_mon(void) { 
     
    5954        logmsg(LOG_DEBUG, 1, "Creating ipq connection monitor.\n"); 
    6055        if ((h = ipq_create_handle(0, PF_INET)) == NULL) { 
    61                 logmsg(LOG_ERR, 1, "Error - Could not create IPQ handle.\n"); 
    62                 die(h); 
     56                logmsg(LOG_ERR, 1, "Error - Could not create IPQ handle: %s.\n", ipq_errstr()); 
     57                clean_exit(EXIT_FAILURE); 
    6358        } 
    6459 
    6560        if ((status = ipq_set_mode(h, IPQ_COPY_PACKET, BUFSIZE)) < 0) { 
    66                 logmsg(LOG_ERR, 1, "Error - Could not set IPQ mode.\n"); 
    67                 die(h); 
     61                logmsg(LOG_ERR, 1, "Error - Could not set IPQ mode: %s.\n", ipq_errstr()); 
     62                ipq_destroy_handle(h); 
     63                clean_exit(EXIT_FAILURE); 
    6864        } 
    6965 
     
    7369                process = 1; 
    7470                if ((status = ipq_read(h, buf, BUFSIZE, 0)) < 0) { 
    75                         logmsg(LOG_ERR, 1, "Error - Could not read queued packet.\n"); 
    76                         die(h); 
     71                        logmsg(LOG_ERR, 1, "Error - Could not read queued packet: %s.\n", ipq_errstr()); 
     72                        ipq_destroy_handle(h); 
     73                        clean_exit(EXIT_FAILURE); 
    7774                } 
    7875                switch (ipq_message_type(buf)) { 
     
    9592                                } else { 
    9693                                        logmsg(LOG_ERR, 1, "Error - Protocol %u is not supported.\n", ip->ip_p); 
     94                                        if ((status = ipq_set_verdict(h, packet->packet_id, NF_ACCEPT, 0, NULL)) < 0) { 
     95                                                logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet: %s.\n", ipq_errstr()); 
     96                                                ipq_destroy_handle(h); 
     97                                                clean_exit(EXIT_FAILURE); 
     98                                        } 
    9799                                        break; 
    98100                                } 
     
    108110                                                dport, PROTO(ip->ip_p)); 
    109111                                        if ((status = ipq_set_verdict(h, packet->packet_id, NF_ACCEPT, 0, NULL)) < 0) { 
    110                                                 logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet.\n"); 
    111                                                 die(h); 
     112                                                logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet: %s.\n", ipq_errstr()); 
     113                                                ipq_destroy_handle(h); 
     114                                                clean_exit(EXIT_FAILURE); 
    112115                                        } 
    113116                                        process = 0; 
     
    129132                                                dport, PROTO(ip->ip_p)); 
    130133                                        if ((status = ipq_set_verdict(h, packet->packet_id, NF_ACCEPT, 0, NULL)) < 0) { 
    131                                                 logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet.\n"); 
    132                                                 die(h); 
     134                                                logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet: %s.\n", ipq_errstr()); 
     135                                                ipq_destroy_handle(h); 
     136                                                clean_exit(EXIT_FAILURE); 
    133137                                        } 
    134138                                        process = 0; 
  • honeytrap/trunk/src/modules/Makefile.am

    r1281 r1283  
    3030if BUILD_CLAMAV_PLUGIN 
    3131lib_LTLIBRARIES += htm_ClamAV.la 
     32endif 
     33 
     34if BUILD_SUBMIT_MWSERV_PLUGIN 
     35lib_LTLIBRARIES += htm_submitMwserv.la 
    3236endif 
    3337 
     
    6771endif 
    6872 
     73if BUILD_SUBMIT_MWSERV_PLUGIN 
     74htm_submitMwserv_la = htm_submitMwserv.c htm_submitMwserv.h 
     75htm_submitMwserv_la_LDFLAGS = -module -no-undefined -avoid-version 
     76endif 
     77 
    6978install-exec-am: 
    7079        $(mkinstalldirs) $(DESTDIR)/$(sysconfdir)/honeytrap/plugins 
  • honeytrap/trunk/src/modules/htm_b64Decode.c

    r1279 r1283  
    3434#include "htm_b64Decode.h" 
    3535 
    36 const char module_name[]="htm_b64Decode"; 
     36const char module_name[]="b64Decode"; 
    3737const char module_version[]="0.3.1"; 
    3838 
  • honeytrap/trunk/src/modules/htm_vncDownload.c

    r1279 r1283  
    2828#include "htm_vncDownload.h" 
    2929 
    30 const char module_name[]="htm_vncDownload"; 
     30const char module_name[]="vncDownload"; 
    3131const char module_version[]="0.3"; 
    3232 
  • honeytrap/trunk/src/nfqmon.c

    r1281 r1283  
    7474                } else { 
    7575                        logmsg(LOG_ERR, 1, "Error - Protocol %u is not supported.\n", ip->ip_p); 
     76                        if (nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL) == -1) { 
     77                                logmsg(LOG_ERR, 1, "Error - Could not set verdict on packet.\n"); 
     78                                nfq_destroy_queue(qh); 
     79                                exit(EXIT_FAILURE); 
     80                        } 
    7681                        return(-1); 
    7782                }