Hello Alessandro,

> > 1)  /usr/sbin/rcptfilter
> It is enabled by
>    echo /usr/sbin/rcptfilter > /etc/courier/maildropfilter

I have this already...

> You may want to also test stderr, e.g.
>     printf '#err\n##warning\n###notice\n####info\n' >&2
> (handling those '#'s is the only cumbersome code of rcptfilter.c)

I have tested it, but it sees, "rcptfilter" is NEVER executed

> Did you try invoking it manually, just to check it runs? E.g.
>     HOME=/home/testlooser rcptfilter -M rcptfilter -D nnn/mmm
> (where nnn/mmm are some numeric uid/gid)

If I log into my mailserver as "root" and execute from that account

----[ comand 'HOME=/home/electronica rcptfilter -M rcptfilter -D 1028/1027' ]--
rd= 5, next= 0
rd=29, next= 0
rcptfilter[13347]: received signal 17
rd= 0, next= 0
------------------------------------------------------------------------

OK, now I run it under strace

----[ comand 'HOME=/home/electronica strace rcptfilter -M rcptfilter -D 
1028/1027' ]--
execve("/usr/sbin/rcptfilter", ["rcptfilter", "-M", "rcptfilter", "-D", 
"1028/1027"], [/* 20 vars */]) = 0
uname({sys="Linux", node="samba3", ...}) = 0
brk(0)                                  = 0x804c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f30000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f2f000
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=21944, ...}) = 0
mmap2(NULL, 21944, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f29000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240O\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1241392, ...}) = 0
mmap2(NULL, 1247388, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xb7df8000
mmap2(0xb7f1f000, 28672, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x127) = 0xb7f1f000
mmap2(0xb7f26000, 10396, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f26000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7df7000
mprotect(0xb7f1f000, 20480, PROT_READ)  = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7df76c0, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
munmap(0xb7f29000, 21944)               = 0
geteuid32()                             = 0
setgid32(1027)                          = 0
setuid32(1028)                          = 0
rt_sigaction(SIGALRM, {0x8048ce4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {0x8048ce4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x8048ce4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGTERM, {0x8048ce4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGHUP, {0x8048ce4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x8048ce4, [], 0}, NULL, 8) = 0
geteuid32()                             = 1028
getegid32()                             = 1027
chdir("/home/electronica")              = 0
stat64("rcptfilter.sh", {st_mode=S_IFREG|0755, st_size=479, ...}) = 0
brk(0)                                  = 0x804c000
brk(0x806d000)                          = 0x806d000
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0xb7df7708) = 13956
close(4)                                = 0
alarm(30)                               = 0
read(3, "#err\n", 2046)                 = 5
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 3), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f2e000
write(1, "rd= 5, next= 0\n", 15rd= 5, next= 0
)        = 15
time([1271319297])                      = 1271319297
open("/etc/localtime", O_RDONLY)        = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f2d000
read(4, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\10"..., 4096) = 842
close(4)                                = 0
munmap(0xb7f2d000, 4096)                = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
getpid()                                = 13955
socket(PF_FILE, SOCK_DGRAM, 0)          = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
connect(4, {sa_family=AF_FILE, path="/dev/log"}, 16) = 0
send(4, "<19>Apr 15 10:14:57 rcptfilter[1"..., 51, MSG_NOSIGNAL) = 51
read(3, "##warning\n###notice\n####info\n", 2046) = 29
write(1, "rd=29, next= 0\n", 15rd=29, next= 0
)        = 15
time([1271319297])                      = 1271319297
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
send(4, "<20>Apr 15 10:14:57 rcptfilter[1"..., 55, MSG_NOSIGNAL) = 55
time([1271319297])                      = 1271319297
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
send(4, "<21>Apr 15 10:14:57 rcptfilter[1"..., 54, MSG_NOSIGNAL) = 54
time([1271319297])                      = 1271319297
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
send(4, "<22>Apr 15 10:14:57 rcptfilter[1"..., 52, MSG_NOSIGNAL) = 52
read(3, "", 2046)                       = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(2, "rcptfilter[13955]: received sign"..., 38rcptfilter[13955]: received 
signal 17
) = 38
sigreturn()                             = ? (mask now [])
write(1, "rd= 0, next= 0\n", 15rd= 0, next= 0
)        = 15
alarm(0)                                = 30
close(3)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 13956
time([1271319297])                      = 1271319297
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=842, ...}) = 0
send(4, "<23>Apr 15 10:14:57 rcptfilter[1"..., 93, MSG_NOSIGNAL) = 93
munmap(0xb7f2e000, 4096)                = 0
exit_group(0)                           = ?
Process 13955 detached
------------------------------------------------------------------------

Hmmm...  

---[ '/var/log/mail.log' ]----------------------------------------------
Apr 15 10:14:57 samba3 rcptfilter[13955]: script: err
Apr 15 10:14:57 samba3 rcptfilter[13955]: script: warning
Apr 15 10:14:57 samba3 rcptfilter[13955]: script: notice
Apr 15 10:14:57 samba3 rcptfilter[13955]: script: info
Apr 15 10:14:57 samba3 rcptfilter[13955]: /home/electronica/rcptfilter.sh with  
exited 0, rtc=0
------------------------------------------------------------------------

So why does it work from the commandline and not from courier?

However, I do not understand how "rcptfilter" ist working because  there
are no infos which I can use to determiner whether the incoming messages
are acceptable or not.

My script

----[ '~/rcptfilter.sh' ]-----------------------------------------------
#!/bin/bash

printf "#err\n##warning\n###notice\n####info\n" >&2

LOGFILE=${HOME}/log/$(date +%Y%m%d_%H%M%S).log

echo "$*" >>${LOGFILE}
echo >>${LOGFILE}
echo "########################################################################" 
>>${LOGFILE}
echo >>${LOGFILE}
env  >>${LOGFILE}
echo >>${LOGFILE}
echo "########################################################################" 
>>${LOGFILE}
echo >>${LOGFILE}
cat  >>${LOGFILE}

exit 0
------------------------------------------------------------------------

capure only

----[ '/home/electronica/log/20100415_102336.log' ]---------------------
RCPT

########################################################################

HOST=
TERM=xterm
SHELL=/bin/bash
TMPDIR=/tmp/root.t18834
LC_ALL=en_US.UTF-8
USER=root
TEMP=/tmp/root.t18834
LOCAL=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
TEMPDIR=/tmp/root.t18834
PWD=/home/electronica
LANG=en_US
SHLVL=2
HOME=/home/electronica
LANGUAGE=en_US
LOGNAME=root
TMP=/tmp/root.t18834
CACHEFILE=
_=/usr/bin/env

########################################################################

------------------------------------------------------------------------

if I use the commandline:

HOME=/home/electronica rcptfilter -M rcptfilter -D 1028/1027 
<1271319687.22602_1.samba3

and there are some VARS interesting, because the logfile is  written  as
user 1028/1027 (electronica) but the script use the  wrong  USER,  MAIL,
and TMPDIR, TEMP, TEMPDIR and TMP...

Also very important is, that PATH is wrong

It seems there are infos missing...
From the output of my script I can not see how to use it.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France           itsyst...@tdnet UG (haftungsbeschränkt)
Gesch. Michelle Konzack          Gesch. Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz               Kinzigstraße 17
67100 Strasbourg/France         77694 Kehl/Germany
Tel: +33-6-61925193 mobil       Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4miche...@jabber.ccc.de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

Attachment: signature.pgp
Description: Digital signature

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to