Le 20/11/2012 10:28, [email protected] a écrit : > Hello all, > > I'm using postfix together with LDAP from where I take information about > user addresses and their home dirs, where I want to store emails. > > I have everything configured correctly, it's working for all users > except for users that don't have created homedir yet. I want to > implement script, that will get message based on that will create > homedir + maildir for user is not exists already and then it will pass > transparently whole message to virtual, that will do delivery as usual. > Over the Internet I've found such scripts for maildrop delivery, but > with implementing same logic I had no success to apply that knowledge in > my scenario. > > My configuration is in master.cf: > ------------------------------------------- > homedir unix - n n - - pipe > user=nobody:nobody argv=/usr/libexec/postfix/home -d > ${user}@${nexthop} -f ${sender} > ------------------------------------------- > > Content of /usr/libexec/postfix/home is: > ------------------------------------------- > #!/bin/bash > > INSPECT_DIR=/var/spool/filter > > # Exit codes from <sysexits.h> > EX_TEMPFAIL=75 > EX_UNAVAILABLE=69 > > # Clean up when done or when aborting. > trap "rm -f in.$$" 0 1 2 3 15 > > cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; } > > cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } > > > /usr/libexec/postfix/virtual "$@" <in.$$ > > exit $? > ------------------------------------------- > > Now when I end email to machine, I see following in log: > ------------------------------------------- > Nov 19 15:29:01 localhost postfix/postfix-script[4343]: starting the > Postfix mail system > Nov 19 15:29:01 localhost postfix/master[4344]: daemon started -- > version 2.9.4, configuration /etc/postfix > Nov 19 15:29:05 localhost postfix/smtpd[4349]: connect from > unknown[192.168.255.201] > Nov 19 15:29:05 localhost postfix/smtpd[4349]: F117F43F2D: > client=unknown[192.168.255.201] > Nov 19 15:29:06 localhost postfix/cleanup[4353]: F117F43F2D: message-id=<> > Nov 19 15:29:07 localhost postfix/qmgr[4348]: F117F43F2D: > from=<[email protected]>, size=421, nrcpt=1 (queue active) > Nov 19 15:29:07 localhost postfix/smtpd[4349]: disconnect from > unknown[192.168.255.201] > Nov 19 15:29:07 localhost postfix/virtual[4357]: fatal: no transport > type specified > Nov 19 15:29:08 localhost postfix/pipe[4354]: F117F43F2D: > to=<[email protected]>, relay=homedir, delay=2.3, delays=1.2/0.01/0/1.2, > dsn=5.3.0, status=bounced (Command died with status 1: > "/usr/libexec/postfix/home") > ------------------------------------------- > > What I believe is wrong is way, how I pass email to virtual at the end > of script. Unfortunately when I try to run /usr/libexec/postfix/virtual > with parameters such as --help or -h I don't get any help, and also I > didn't found any documentation saying if virtual needs to get any > command line arguments or something special to STDIN. so question is how > can I specify all required inputs to virtual, in log it's asking for > transport specification, but I'm not sure it will be only one > information virtual needs. > > Thank you in advance.
the easy answer is: when you create an email account, do create the mailbox. what's so complicated about this? why do you want the mailbox be created at inbound mail reception? optimise for the common case. the common case for a mailbox is receiving email, not creating the mailbox. from a security perspective, it is "debatable" to let a network connected daemon create arbitrary directories on your system.
