Introduction
greetdelay is a program to introduce a small delay before an SMTP
greeting. It also enforce RFC 2821's recommendation that SMTP
clients not send any commands before receiving the greeting
message.
If RELAYCLIENT is set in environment variable, greetdelay will be skipped.
Set environment variable GREETDELAY to any numberic value greater than 0
to enable greetdelay to wait for the set value before executing other program.
If SMTP clients send any commands during the greet delay period,
"554 smtp protocol violation (#5.5.1)" will be responsed with
"premature input on stdin" will be printed in stderr and exit
with exit code 111.
Disclaimer
YOU ARE FREE TO USE THIS SCRIPT/PATCHES/GUIDE BUT I AM NOT RESPONSIBLE FOR ANY DAMAGE CAUSED! YOU HAVE BEEN WARNED!!!
Changes
- 08 Sep 2009 GMT +8 : Version 0.03
- Fix the description
- 03 Sep 2009 GMT +8 : Version 0.02
- Fix wait delay by checking the stdin first
- 02 Sep 2009 GMT +8 : Version 0.01
- Initial release
Source
Requirements
How to compile, install and use?
1. Download the source:
wget http://choon.net/opensource/greetdelay.c -P /usr/local/src
2. Compile:
cd /usr/local/src
gcc -O -o greetdelay greetdelay.c
3. Install:
chmod 0755 /usr/local/src/greetdelay
cp -pvf /usr/local/src/greetdelay /usr/local/bin/greetdelay
4. In your smtpd run file, place greetdelay before qmail-smtpd (assuming greetdelay and qmail-smtpd is in your PATH):
tcpserver -R -h 0 smtp greetdelay qmail-smtpd
5. Set environment variable GREETDELAY to any numberic value greater than 0 and export it in smtpd run file
if you want to enable greetdelay globally or set it in your smtpd tcpserver rules.