From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain MIME-Version: 1.0 (NeXT Mail 3.3ciscupdate v148.2.1) From: arisawa@ar.aichi-u.ac.jp To: 9fans@cse.psu.edu Subject: Re: [9fans] plan9 username is not desired e-mail source References: <76c4ce07e21c4afd8f6f34bfa8a4eaf9@plan9.bell-labs.com> Message-Id: <20020804203928.B78B8199A3@mail.cse.psu.edu> Date: Mon, 5 Aug 2002 05:39:22 +0900 Topicbox-Message-UUID: d80903ca-eaca-11e9-9e20-41e7f4b1d025 >Aliasmail -f is invoked by /mail/lib/remotemail, >but only to get a sender's domain. The sender >name can't be changed with it. > >Russ The senders name can be chnaged in qmail. The following is qmail for sender masquerade: alice@aichi-u ac.jp is converted to arisawa@ar.aichi-u.ac.jp where ar.aichi-u.ac.jp is this dom name. Kenji Arisawa #!/bin/rc # # qmail derivers a mail to a remote host # $* are as follows: # # mail from arisawa@pc.aichi-u.ac.jp to junk@junk.com # pc.aichi-u.ac.jp!arisawa net!junk.com junk # (don't post to junk.com. this dom really exist now!) # # mail from postmaster to arisawa@pc.aichi-u.ac.jp: # /dev/null net!pc.aichi-u.ac.jp arisawa # sender=$1 shift addr=$1 shift # # for example # $sender: # alice -- from local mailes # now smptd rejects a sender who pretends local user. # *!alice -- from remote machin # ar!*!alice -- from remote machin via pipeto # /dev/null -- from postmaster # $addr: # net!vega -- to remote hosts vega # $*: recipient # bob -- a user on vega # # OK flag # 1: do sender masquering # 0: no sender masquering OK=0 # # relay service and the sender masquering # dom=aichi-u.ac.jp if(~ $sender (pc al)^.$dom!* ar!^(pc al)^.$dom!*){ ifs0=$ifs ifs='!' s=`{echo -n $sender} ifs=$ifs0 sender=$s(2) if(~ $s(1) ar) sender=$s(3) # echo $sysname: qmail-masq pettern OK $sender >> /sys/log/test switch($sender){ case alice OK=1 sender=arisawa } } if(~ $OK 1){ # sender masquering awk ' /^From |^Received:|^MBOX-Line:|^Message-ID:/{f=1;next} /^From:/{f=1; print "From:","'$sender@ar.aichi-u.ac.jp'"; next} /^[ \t]/ && f==1 {next} /^$/{ print; while (getline>0) print $0} /.+/{f=0;print $0}'|\ /bin/upas/qer /mail/queue mail $sender $addr $* || exit 1 /bin/upas/runq /mail/queue /mail/lib/remotemail/dev/null >[2=1] exit } # # controll the sender's request to relay. # If this is not a relay host, you should not answer the request. # # relay request from a remote sender. # # local user can send a mail to anywhere # # full-path is required for $sender to be translated correctlly # otherwise the name is regarded as local name. # example: if pc!arisawa is translated to pc!arisawa@ar.aichi-u.ac.jp # /bin/upas/qer /mail/queue mail $sender $addr $* || exit 1 /bin/upas/runq /mail/queue /mail/lib/remotemail/dev/null >[2=1] exit 0