diff -ur portsentry_beta/Makefile portsentry_new/Makefile --- portsentry_beta/Makefile 2003-05-24 03:10:13.000000000 +0900 +++ portsentry_new/Makefile 2008-06-15 04:56:29.000000000 +0900 @@ -20,13 +20,13 @@ # # # Generic compiler (usually linked to gcc on most platforms) -CC = cc +#CC = cc # GNU.. -#CC = gcc +CC = gcc # Normal systems flags -CFLAGS = -O -Wall +CFLAGS = -O2 -Wall -march=pentium3 # Debug mode for portsentry #CFLAGS = -Wall -g -DNODAEMON -DDEBUG @@ -37,7 +37,7 @@ #CFLAGS = -pg -O -Wall -DNODAEMON #LIBS = /usr/lib/libefence.a -INSTALLDIR = /usr/local/psionic +INSTALLDIR = /usr/local CHILDDIR=/portsentry all: diff -ur portsentry_beta/portsentry.c portsentry_new/portsentry.c --- portsentry_beta/portsentry.c 2003-05-24 03:10:13.000000000 +0900 +++ portsentry_new/portsentry.c 2008-06-15 04:56:36.000000000 +0900 @@ -1077,7 +1077,7 @@ { struct sockaddr_in client, server; - int length, portCount = 0, ports[MAXSOCKS]; + int length, portCount = 0, configports[MAXSOCKS], ports[MAXSOCKS]; int openSockfd[MAXSOCKS], incomingSockfd, result = TRUE; int count = 0, scanDetectTrigger = TRUE, showBanner = FALSE, boundPortCount = 0; int selectResult = 0; @@ -1094,11 +1094,11 @@ /* break out the ports */ if ((temp = (char *) strtok (configToken, ",")) != NULL) { - ports[0] = atoi (temp); + configports[0] = atoi (temp); for (count = 1; count < MAXSOCKS; count++) { if ((temp = (char *) strtok (NULL, ",")) != NULL) - ports[count] = atoi (temp); + configports[count] = atoi (temp); else break; } @@ -1124,22 +1124,25 @@ for (count = 0; count < portCount; count++) { Log ("adminalert: Going into listen mode on TCP port: %d\n", - ports[count]); + configports[count]); if ((openSockfd[boundPortCount] = OpenTCPSocket ()) == ERROR) { Log ("adminalert: ERROR: could not open TCP socket. Aborting.\n"); return (ERROR); } - if (BindSocket (openSockfd[boundPortCount], client, server, ports[count]) == + if (BindSocket (openSockfd[boundPortCount], client, server, configports[count]) == ERROR) { Log ("adminalert: ERROR: could not bind TCP socket: %d. Attempting to continue\n", - ports[count]); + configports[count]); } else /* well we at least bound to one socket so we'll continue */ + { + ports[boundPortCount] = configports[count]; boundPortCount++; } + } /* if we didn't bind to anything then abort */ @@ -1581,8 +1584,7 @@ Usage (void) { printf ("PortSentry - Port Scan Detector.\n"); - printf ("Copyright 1997-2003 Craig H. Rowland \n"); + printf ("Copyright 1997-2003 Craig H. Rowland \n"); printf ("Licensing restrictions apply. Please see documentation\n"); printf ("Version: %s\n\n", VERSION); #ifdef SUPPORT_STEALTH diff -ur portsentry_beta/portsentry.conf portsentry_new/portsentry.conf --- portsentry_beta/portsentry.conf 2003-05-24 03:10:13.000000000 +0900 +++ portsentry_new/portsentry.conf 2008-06-15 04:56:29.000000000 +0900 @@ -70,9 +70,9 @@ # all but the most isolated systems/networks. # # Default TCP ident and NetBIOS service -ADVANCED_EXCLUDE_TCP="113,139" +ADVANCED_EXCLUDE_TCP="21,22,25,53,80,110,113,143,443,465,722,822,953,993" # Default UDP route (RIP), NetBIOS, bootp broadcasts. -ADVANCED_EXCLUDE_UDP="520,138,137,67" +ADVANCED_EXCLUDE_UDP="520,123,67,53" ###################### @@ -80,11 +80,11 @@ ###################### # # Hosts to ignore -IGNORE_FILE="/usr/local/psionic/portsentry/portsentry.ignore" +IGNORE_FILE="/usr/local/portsentry/portsentry.ignore" # Hosts that have been denied (running history) -HISTORY_FILE="/usr/local/psionic/portsentry/portsentry.history" +HISTORY_FILE="/usr/local/portsentry/portsentry.history" # Hosts that have been denied this session only (temporary until next restart) -BLOCKED_FILE="/usr/local/psionic/portsentry/portsentry.blocked" +BLOCKED_FILE="/usr/local/portsentry/portsentry.blocked" ############################## # Misc. Configuration Options# @@ -203,7 +203,7 @@ #KILL_ROUTE="/sbin/ipchains -I input -s $TARGET$ -j DENY" # # iptables support for Linux -#KILL_ROUTE="/usr/local/bin/iptables -I INPUT -s $TARGET$ -j DROP" +KILL_ROUTE="/usr/local/sbin/iptables -I INPUT -s ! $TARGET$ -j ACCEPT" # # For those of you running FreeBSD (and compatible) you can # use their built in firewalling as well. @@ -226,7 +226,7 @@ # Format One: Old Style - The default when extended host processing # options are not enabled. # -KILL_HOSTS_DENY="ALL: $TARGET$" +#KILL_HOSTS_DENY="ALL: $TARGET$" # Format Two: New Style - The format used when extended option # processing is enabled. You can drop in extended processing @@ -278,7 +278,7 @@ # SSL [TCP port 443] and you immediately block them). Some of you # may even want this though. Just be careful. # -SCAN_TRIGGER="0" +SCAN_TRIGGER="1" ###################### # Port Banner Section# diff -ur portsentry_beta/portsentry_config.h portsentry_new/portsentry_config.h --- portsentry_beta/portsentry_config.h 2003-05-24 03:10:13.000000000 +0900 +++ portsentry_new/portsentry_config.h 2008-06-15 04:56:29.000000000 +0900 @@ -22,7 +22,7 @@ /* These are probably ok. Be sure you change the Makefile if you */ /* change the path */ -#define CONFIG_FILE "/usr/local/psionic/portsentry/portsentry.conf" +#define CONFIG_FILE "/usr/local/portsentry/portsentry.conf" /* The location of Wietse Venema's TCP Wrapper hosts.deny file */ #define WRAPPER_HOSTS_DENY "/etc/hosts.deny"