Path: utzoo!attcan!uunet!decwrl!ucbvax!CS.NIU.EDU!rickert From: rickert@CS.NIU.EDU (Neil Rickert) Newsgroups: comp.mail.sendmail Subject: Re: RFC-compliant UUCP mail Message-ID: <9007301525.AA06048@cs.niu.edu> Date: 30 Jul 90 15:25:34 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 106 mark@DRD.Com wrote: > We're an MX served uucp-only site. I note that when mail originated from > here arrives at some recipient, transported via the good graces of our > local friendly neighborhood internet gateway, the headers look like: > > From drd!DRD.Com!user (is this the From_ referred to above?) > From: user@DRD.Com To this I replied: > > If you are using a standard Sun sendmail.main.cf, try using the 'smartuucp' > mailer to forward mail to the internet gateway. Then experiment with changing: > Msmartuucp, P=/usr/bin/uux, F=CmsDFMhuU, S=22, R=22, > to: > Msmartuucp, P=/usr/bin/uux, F=CmsDFMhu, S=22, R=22, > In otherwords, try removing the 'U' from the end of the F= flags. > your mail should then go out as > From user@DRD.com Unfortunately this may not work reliably. I suggested this because I had just implemented this scheme recently on a UUCP node for which I provide Internet gateway services. It worked well. But I forgot about one piece of the puzzle which I happened to have put in place some time ago. Here, specifically, is what is happening: If you use the 'smartuucp' mailer as originally defined, sendmail.cf formats the addresses in domain format. Thus the envelope address is formatted as 'user@DRD.com'. However, because of the 'U' mailer flag, code within the sendmail binary converts this to: From DRD.com!user date and time remote from drd At the Internet gateway host (hereinafter known as i.g.h), the 'rmail' converts the 'From_' line into drd!DRD.com!user, and invokes sendmail as: /usr/lib/sendmail -f drd!DRD.com!user If, not, you remove the 'U' flag from the mailer, the address is formatted as From user@DRD.com date and time. Once again the receiving 'rmail' interprets this from line, and invokes sendmail as: /usr/lib/sendmail -f user@DRD.com At first glance this looks to be exactly what is required. Unfortunately, however, most versions of 'sendmail' normally ignore the '-f' option on the command line, unless invoked by a 'trusted user'. This is to prevent the forging of sender addresses. There is one exception to this sendmail restriction. If the sender address contains a '!', sendmail accepts the '-f' option, even if from a non-trusted user - UUCP mail would not work otherwise. The problem now, is that when the from line contains an '@' instead of a '!' the address may go out as: From drd@i.g.h instead of From user@DRD.com. It all depends on how the UUCP connection is made. If the UUCP connection is started by i.g.h from 'crontab' everything should be fine, because 'uucp' is usually a Trusted user. If the uucp connection in initiated by 'drd', everything will be file PROVIDED that the login name 'drd' uses is a trusted user in 'sendmail.cf'. But if the uucp connections is initiated by, for instance, a user on i.g.h issuing the 'uucp' command, this will not work. Any of the following should solve the problem: 1. Make sure that the outgoing UUCP mail says: From_DRD.com!user date&time. The idea here is that there should be a bang in the address. This could be managed by restoring the U flag and replacing uux by a shell script uux.sh which strips off the 'remote from drd' (with sed) and feeds its output to the real uux. 2. Create a new rewrite ruleset in sendmail.cf which converts all addresses to domain!user format. Use this on the S= line of the mailer definition. It probably need only consist of something simple like: R$+ $:$>22$1 R$+ $@$>5$1 The disadvantate is that the header line will also go out as: From: DRD.com!user This is probably not serious, for i.g.h will probably convert that into user@DRD.com. 3. Make sure that all UUCP calls are initiated from 'drd' and that the login name used is on the trusted user list at i.g.h. 4. Modify 'rmail' on i.g.h. This is the method I am currently using. My 'rmail', which came with the sendmail/IDA package, is suid root, and sets its real uid to 0 before invoking sendmail. This means that it is always trusted. I also set 'rmail' to be in group 'daemon' and executable only by 'user' or 'group'. Uucp usually runs sgid daemon, so can execute rmail, but typical users cannot. Of course a user who wants to forge mail can still do it by using '!' in the from address. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Sci Dept, Northern Illinois U., DeKalb IL 60115 InterNet, unix: rickert@cs.niu.edu Bitnet, VM: T90NWR1@NIUCS =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=