Hi Sandy.
El Viernes, 25 de Enero de 2008, Sandy Drobic escribió: > Carlos Lorenzo Matés wrote: > >>> I'm having a lot of feedback in the hylafax list, i'm playing around a > >>> few ideas they told me. But i will try in the postfix list if i don't > >>> find a good solution > >> > >> Have you tried to use the command in mailbox_command as I suggested? > >> That would take care of the user rights problem, provided the user is a > >> system user. > > > > I tried with a custom script but i cant find how to get the mail to a > > variable to pass it to the mailfax command, i get the rest of the > > parameters, but no idea of how to get the mail itself (it comes form the > > pipe) > > > > I don't really understand right what you mean with mailbox:command, sorry > > :-( > > http://www.postfix.org/postconf.5.html#mailbox_command > > This is only available for recipient address in $mydestination. The > documentation also lists the variables that can be used in mailbox_command. I'm going to read this just now. > > > the users ara autentified against pam and ldap, but there is not problem, > > the command is executed as user fax, this is right , but i can pass it a > > That is what would be different with mailbox_command. The script is called > as the user, that the command is run for. > > > parameter to set the job owner, the problem is that parameter is not in > > the proper way in the postfix master.cf. > > > > What i tried to do is call a custom script in the master.cf like that > > > > fax unix - n n - 1 pipe > > flags= user=fax argv=/usr/local/bin/customfax.sh $(user) $(sender) > > > > then the customfax.sh shoul do > > > > #owner sender > > owner='cut -f 1 -d @ $sender' > > > > #destination is user > > destination=$1 > > > > faxmail -o $owner -d -n $destination (and here should pass the piped > > mail) > > > > this is the point i'm stoped in this way > > Okay, I finally realized just what you wanted to do. This is a script I > adjusted for your purpose. > > You need to add error handling to your faxmail routine to achieve a robust > transport. > > > #----------------------------------------------------- > #!/bin/sh > # I set this up in /var/lib/filter > INSPECT_DIR=/var/lib/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 > > # Start processing. > cd $INSPECT_DIR || { > echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; } > > cat >in.$$ || { > echo Cannot save mail to file; exit $EX_TEMPFAIL; } > > # Specify your content filter here. > # filter <in.$$ || { > # echo Message content rejected; exit $EX_UNAVAILABLE; } > > #owner sender > owner=`echo $2|cut -f 1 -d"@"` > > #destination is the user > destination=$1 > > faxmail -o $owner -d -n $destination <in.$$ > > exit $? > #----------------------------------------------------- > -- Thank you very much, Sandy, I will try with your script on monday, as i need this in my job. just to enhance my knowledge, could you explain a bit this sentences please? cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } I assume this gets the piped mail into "in.PID" I need no content filter, as faxmail parses teh mail contents and convers teh multiparts to postscripts faxmail -o $owner -d -n $destination <in.$$ then the way to pass the piped mail is with the < in.$$ saved previously, rigth? how should i call this script form master.cf like i was calling mine? Many Thanks again. -- Un saludo. Carlos Lorenzo Matés. clmates AT mundo-r DOT com
signature.asc
Description: This is a digitally signed message part.
