Subject: Beating out Anti-'Idle Timeout' clients

From: "Rice, Kevin" <[email-masked]>
Date: Wed, 4 Feb 1998 13:35:46 -0600

Is there any way to prevent somebody from using a client like CuteFTP
2.0 to tie up a connection. CuteFTP sends a NOOP at a given interval to
keep the connection alive. I've seen people idle for days on end. Is
there anyway to prevent them from doing so?

Kevin Rice
SPSS, Inc.

---

From: Martin Kirscht <[email-masked]>
Date: Thu, 05 Feb 1998 11:20:14 +0100

> there anyway to prevent them from doing so?

There is another possibility:

You can run a cronjob which kills old ftpd processes every day or every
few hours. If you like, I will send you a script for SunOS 4 or Solaris.

Martin
-- 
  /| /|                   mailto:[email-masked]
 / |/ | /                 phone: +49-511-762-5305, fax: +49-511-762-5333
/artin|/\irscht           http://www.tnt.uni-hannover.de/~kirscht

Institut f. Theoretische Nachrichtentechnik und Informationsverarbeitung
Universitaet Hannover, Appelstrasse 9A, D-30167 Hannover, Germany

---

From: Martin Kirscht <[email-masked]>
Date: Fri, 06 Feb 1998 14:13:43 +0100

> few hours. If you like, I will send you a script for SunOS 4 or Solaris.

There seems to be greater interest for the script, so I send it to the
list. 

I run the following script once a day at 7 a.m. All processes which are
started on the last day after 7 a.m. or on the days before are killed. 
The entry in the crontab file looks like:

00 7 * * * <path>/kill_old_ftpd

and here is the script (for Solaris), called kill_old_ftpd

--- cut here ---
#!/bin/ksh
#
# killing old ftpd processes
#
ps -ef | grep 'ftpd -l' | cut -c 10-14,24-28 | while read -r pid1 std2
do
#    echo '#'$std2'#'$pid1'#'
    if [[ $std2 = '  Ja' || $std2 = 'Ja' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Fe' || $std2 = 'Fe' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Ma' || $std2 = 'Ma' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Ap' || $std2 = 'Ap' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Ju' || $std2 = 'Ju' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Au' || $std2 = 'Au' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Se' || $std2 = 'Se' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  Oc' || $std2 = 'Oc' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  No' || $std2 = 'No' ]]
    then kill -9 $pid1
    elif [[ $std2 = '  De' || $std2 = 'De' ]]
    then kill -9 $pid1
    elif [ $std2 -gt 7 ]
    then kill -9 $pid1
    fi
done
--- cut here ---

(for SunOS 4 the first line is 
'ps -aux | grep 'ftpd -l' | cut -c 10-14,43-45 | while read -r pid1
std2')

You have to adjust the script to the name and the first option of your
wu-ftpd. In this case it is 'ftpd -l'. The first 10 if/elif's are needed
in case of processes which are older than one day.
Of course, the source doesn't look fine but it works.

Martin