Click to See Complete Forum and Search --> : smtp authentication: sendmail vs. the rest


gkedrovs
07-08-2003, 10:53 AM
I'm using sendmail basically out of the RH8.0 box. I have configured it to send my mail through an external server that houses my web site. However, I need to reconfigure it to send mail through my IP server which requires smpt authentication (using my assigned username and password).

After searching my brains out, it seems the consensus is that sendmail is a big hairy deal to configure for smtp authentication. I could not find any simple HowTos on setting it up.

I am working through Rute's book and he says plainly that sendmail is cryptic and hard to configure. Okay... He suggests exim, although postfix and qmail are mentioned as favorites of many.

I guess I'd like some advice...

1. Does anyone have a link to a simple HowTo to get sendmail running my smtp authentication?

2. If I go with exim, then do I need to "disable" sendmail somehow? Would that me as simple as commenting out the line that calls sendmail in one of my rc start-up scrips (I boot RH runlevel 3 - full multiuser mode, but not "graphical interface" which is runlevel 5)? Then, I guess I'd have to include a line that calls my rightly configured exim?

I apologize if this is vague, but I just ran into this hitch, and after searching and reading... it's all a haze... :-)

Thanks!

-Greg

mdwatts
07-08-2003, 11:01 AM
There was another thread on smtp authentication this morning. Perhaps it will help.

Just disable the sendmail service from starting.

gkedrovs
07-08-2003, 11:51 AM
Originally posted by mdwatts
There was another thread on smtp authentication this morning. Perhaps it will help.

Didn't find it. But, don't worry about it. You sound busy.

Originally posted by mdwatts
Just disable the sendmail service from starting.

Okay. That, then, would be the subject of another search, RTFM, and possibly a post or two later on.

Thanks.

-gk

mdwatts
07-08-2003, 12:09 PM
The only hit with a JL forum search (for the last day) for 'smtp auth' (http://justlinux.com/forum/showthread.php?s=&threadid=106275&highlight=smtp+auth).

Doesn't Redhat use something like

chkconfig <service> off

??

I'm sure it's in the Redhat online documentation. Be right back.

<edit>

I'm sure it's somewhere in

http://www.redhat.com/support/resources/howto/rhl80.html

gkedrovs
07-08-2003, 09:19 PM
I got it working. But, my gosh, man... talk about a pain in the hootchy. I'm gonna try to give a recount of what I did here below for anyone who searches and hits this.

I do have one question, though, about my /etc/mail/authinfo(.db) file for anyone who knows. I set "M:" to read "PLAIN" (as suggested in a sight I found) instead of DIGEST-MD5 (as suggested in another site I found). Both work to get mail through my isp and out to the destination. What's the difference - encryption? Which is better? Or does it even matter. That authinfo file is chmod 600 (text file). But, I'm concerned about sending a plain text username and password over the net. Any input?

Here's what solved my problem of getting smtp authentication working on my RH8 machine:

First the sites that will walk you through the process:

This is sendmai's HowTo for smtp auth for versions 8.10-8.12:
http://www.sendmail.org/~ca/email/auth.html
Look in the section "configuration" and you'll see a link which says: sendmail 8.12 offers a significantly better way to specify the client authentication information. That will take you to:

http://www.sendmail.org/~ca/email/sm-812.html#812AUTH

The above page is very helpful. Look for the section titled "AUTH related." I included the suggested AuthInfo line in my /etc/mail/authinfo that was hash mapped (?) to my /etc/mail/authinfo.db. More on that below. This AuthInfo line will work with only U: and P: (username and password, respectively).

You can find a really quick HowTo with a clear example of how to do this AuthInfo here:

http://support.real-time.com/linux/email/server/sendmail.html

The only thing on the above linked page that is not clear is how to "remake your cf and hash maps and restart."

To remake your cf (/etc/mail/sendmail.cf) you need to:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

That "compiles" the mc file into the cf file. If you need m4, read the comments at the top of sendmail.mc and sendmail.cf.

To remake your hash map of /etc/mail/authinfo:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo.db
(Notice the direction of the <)

Mini-HowTo (http://www.urbanophile.com/arenn/coding/sendmail-with-sbc-dsl.html) reviewing the above. Sometimes saying the same thing a different way can help.

RedHat FAQ (http://www.redhat.com/support/resources/faqs/RH-sendmail-FAQ/x26.html) on how to get your sendmail to "masquerade" your e-mail address for your localhost user name. (My ISP would not accept mail from greg@localhost.localdomain. So, I masqueraded sendmail to change that to my ISP-provided e-mail address.)

Another masquerading link. (http://mail-abuse.org/dul/gateways.htm) More HowTo's on routing your outgoing mail through your Internet provider's mail servers.

Easy Road to Sendmail (http://users.binary.net/dturley/linux/sendmail.html) gives a pretty good review of most of this stuff - again, same thing said a different way. Maybe it'll help.

In a nutshell:

1. I had to add the following lines to my sendmail.mc and then m4 "compile" it into sendmail.cf:

define(`SMART_HOST',`smtp.racsa.co.cr')
MASQUERADE_AS(racsa.co.cr)dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
FEATURE(`authinfo', `hash -o /etc/mail/authinfo')
MAILER(local) <--- you need to put this down toward the bottom (gk)

After adding these lines, you must:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

2. I created the genericstable and the genericsdomain according to the instructions on the RedHat FAQ link above.

3. Then, I had to create the following /etc/mail/authinfo and map it to /etc/mail/authinfo.cf

AuthInfo:smtp.racsa.co.cr "U:gkedrovs" "P:xxxxx" "M:PLAIN"

After creating that line in authinfo, you need to run this at command line:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo.db

4. Restart sendmail, and it works. In RedHat, sendmail can be restarted by typing the following at command line:
service sendmail restart

And that's what I did all day today... I need some barley pop...

-Greg

gkedrovs
07-09-2003, 01:54 PM
Originally posted by gkedrovs

GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl


That file is a plain text file containing the result of hostname -f (as per the RH instructions).

I ran into a problem, and I really don't understand it. But, I had to change this line (remove it) to:

GENERICS_DOMAIN(localhost.localdomain localhost localhost)

That got things working (I think). What a mess... No wonder everyone wants to use exim, postfix, qmail...

Another link that was helpful in fixing this:
http://www.linuxfocus.org/English/May2000/article130.shtml

-gk

mdwatts
07-09-2003, 02:17 PM
I had a hell of a time when I had to configure Sendmail on AIX for System Expert a few years ago. Even our contract support experts couldn't figure out what was required. I eventually did though.

I try not to think about it. :(

Good job though gkedrovs. The searching/documentation certainly does help.

gkedrovs
07-09-2003, 02:37 PM
Originally posted by mdwatts
Good job though gkedrovs.

Thanks. I appreciate it.

I think my problem with the GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
has something to do with my /etc/hosts file:

127.0.0.1 gregkedro localhost.localdomain localhost

When I put gkedro in the genericsdomain file, my sendmail doesn't work (for some reason it doesn't find/use genericstable).

But, when I simply give it GENERICS_DOMAIN and point it to my localhost, it works fine.

I have no earthly idea why... But, that's what I've come up with as the major problem that took me so long to hunt down.

Hey at least it works...

-Greg

DragonHead
07-10-2003, 08:12 AM
About a year and half ago, I did the same thing. I used "Linux Sendmail Administration" by Craig Hunt. It is a really good book.

gkedrovs
07-10-2003, 12:47 PM
I wish I had had that book. Someone else (on one of the myriad of sites I was on) suggested "The Bat Book" (O'Reily's offering for sendmail). It's interesting that in my Rute User's Tutorial book, Sheer plainly says to use exim because sendmail is a cryptic nightmare. And I say, "No... really?!" :-)

Thanks!

-Greg