LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Newbie: Network setup required for sendmail (https://www.linuxquestions.org/questions/linux-general-1/newbie-network-setup-required-for-sendmail-88852/)

deepika 09-03-2003 11:28 AM

Newbie: Network setup required for sendmail
 
Hi,

I want to learn settng up a mail server to send and recieve mails to/from any address on any m/c. But first I want to be sure that I have correct network setup for this purpose.

I have my computer connected to wireless router which is in turn connected to internet. Can anyone tell me if I can configure my computer as a mail server. What I understand is since this is on LAN it may not be possible to send a mail to any user on this computer from a m/c outside the LAN. Please suggest me.

I also want to know what are these options mean in /etc/mail/sendmail.mc file?

define(SMART_HOST,mail.yourdomain.com)
MASQUERADE_AS(yourdomain.net)
FEATURE(allmasquerade)
FEATURE(masquerade_envelope)

What is the difference between define(SMART_HOST) and MASQUERADE_AS options?

I would greatly appreciate any help. hThank you.

Regards,
Deepika

david_ross 09-03-2003 02:47 PM

I would leave sendmail config files alone for now. They should work ok to start with. You will need to get your router to forward port 25 to the internal IP of your server. Then get your mx record changed for your domain to point to your routers IP address.

Once that is done. Try sending an e-mail to your server as a client on your network. and try sending mails back in.

If these fail then make sure that:
1) You don't have any firewall rules blocking port 25
2) That sendmail isn't just listening on the loopback:
netstat -nlp

Medievalist 09-03-2003 03:51 PM

Quote:

define(SMART_HOST,mail.yourdomain.com)
MASQUERADE_AS(yourdomain.net)
FEATURE(allmasquerade)
FEATURE(masquerade_envelope)
If you define SMART_HOST, all your outgoing mail will be forwarded to that host for delivery. For example, if you are on a comcast cable modem you might want to use the smtp.comcast.net mail relay so your mail doesn't get shortstopped by comcast's cybernetic droogies.

If you define MASQUERADE_AS, your system will use the masquerade name you define; for example, if you are masquerading as "clockwork.org" and your username is "alex", any mail you send will appear to have come from "alex@clockwork.org".

If you enable envelope masqerading, the envelopes of your mail messages will have the masquerade name clockwork.org, not just the message itself. Remember, humans (with the occasional exception such as myself) do not ever see email envelopes, they are only used by the server. Mail clients like Outlook, Pine, Eudora et al cannot show you a mail envelope - they are not mail servers and do not receive this information. Sendmail does though.

I'm afraid I've forgotten what enabling allmasquerade does. Look here for more information,

deepika 09-03-2003 05:28 PM

Thank you all for your help.

david_ross, I don't understand what you mean by

Quote:

Then get your mx record changed for your domain to point to your routers IP address.
Perhaps because I don't know anything about DNS configuration. But does this also mean that I need to have a 'registered domain' for mail server configuration? Please advice.

Medievalist, you say
Quote:

If you define SMART_HOST, all your outgoing mail will be forwarded to that host for delivery. For example, if you are on a comcast cable modem you might want to use the smtp.comcast.net mail relay so your mail doesn't get shortstopped by comcast's cybernetic droogies.
How do I know what should I configure my SMART_HOST to? I am using optimum cable modem. How can I find that information?

Thanks a lot.

joseph 09-03-2003 11:39 PM

why you don't leave sendmail alone and try to get postfix.
postfix is a secure MTA and easy to configure.

Robert0380 09-04-2003 02:17 AM

Quote:

Originally posted by deepika
Thank you all for your help.
Perhaps because I don't know anything about DNS configuration. But does this also mean that I need to have a 'registered domain' for mail server configuration? Please advice.


If you want to use a domain name to send/recieve mail then yes, you would have to purchase one. You can alternatively use the IP address:

root@[128.23.257.345]

by using IP's you take DNS out of the loop and therefore a domain name is not required.

(note i used an invalid ip on puropse)

Medievalist 09-04-2003 07:41 AM

Quote:

How do I know what should I configure my SMART_HOST to? I am using optimum cable modem. How can I find that information?
Unfortunately, that is not a technical question. If your cable ISP is friendly, you just ask them: " I want to run my own mailserver; what node should I use for an SMTP relay?". If your cable ISP is hostile or incompetent (which unfortunately describes most of them; the rank and file do not understand the benefits of co-operation with customers) you will have to find someone in the local Linux Users Group that knows this information.
You can also just guess - try mail.isp.net (substitute your ISP's domain name for isp.net) and smtp.isp.net and relay.isp.net and pop.isp.net and whatever else you can think of.

If your ISP does not block outgoing connections for port 25 (that's the port used by all Email engines, including postfix, qmail, and sendmail) you don't need SMART_HOST anyway - you can deliver directly from your own sendmail. But with the proliferation of worms like SoBig and Yaha, most ISPs are blocking that sort of traffic now and require you to use a relay host. I was delivering my mail directly for three years or so, but comcast recently blocked me out and I had to implement SMART_HOST.

You really should study up on DNS a bit, IMHO - it's not really very difficult conceptually and it's pretty critical to understanding the kind of tasks you want to do. The O'Reilly book "DNS and BIND in a nutshell" is good, although it's dry as dinosaur bone.

Medievalist 09-04-2003 07:52 AM

Incidentally, if you post your sendmail.mc file I can critique it for you. I disagree with the previous poster; configuring postfix is not significantly easier than sendmail, especially for a newbie.

Sendmail has a bad rep because it used to be mind-numbingly difficult to configure (I have written sendmail.cf files, so I know what I'm talking about) and it is so ancient is has had more bugs discovered (and patched) in it than any other mailserver.

Postfix is less mature, far less configurable, arguably less powerful, and somewhat less compatible with other mail software (such as MailScanner, SpamAssassin, etc. etc. etc) but it is more secure than sendmail by design and arguably simpler to configure.

deepika 09-04-2003 10:44 AM

Thanks once again.

I guess I'll first learn a bit about DNS configuration and then try Sendmail configuration.

joseph 09-04-2003 08:28 PM

Good Luck

deepika 09-30-2003 10:12 AM

Sendmail configuration with DNS server!!!
 
Hi all,

I am back to sendmail configuration after setting up my own DNS server. I have registered my domain 'deepawan.com' and it seems to be working fine. DNS server is running on my linux m/c behind the router and now I want to run my mail server on the same m/c.

I have added an MX entry for my domain in zone file 'deepawan.com.zone' as below. 24.46.176.178 is external IP address of my router.

Quote:

$TTL 86400
$ORIGIN deepawan.com.
@ 1D IN SOA ns.deepawan.com. root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS ns.deepawan.com.
1D IN MX 10 mail.deepawan.com.
//ns 1M IN A 192.168.0.2
ns 1M IN A 24.46.176.178
pawan 1M IN A 192.168.0.3
ftp 1M IN A 192.168.0.4
mail 1M IN A 24.46.176.178
I have also enabled port forwarding at router for both port 25 (sendmail) and 53(DNS queries).

And also modified my sendmail.cf to accept mail from any interface as shown in below file.
Quote:

include(`/usr/share/sendmail-cf/m4/cf.m4')
VERSIONID(`linux setup for Red Hat Linux')dnl
OSTYPE(`linux')
dnl Uncomment and edit the following line if your mail needs to be sent out
dnl through an external mail server:
dnl define(`SMART_HOST',`smtp.your.provider')
dnl define(`SMART_HOST',`RH80.deepika.com')
define(`confDEF_USER_ID',``8:12'')dnl
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnldnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confCACERT_PATH',`/usr/share/ssl/certs')
dnl define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
dnl define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
dnl ***************** Deepika added below line *****************dnl FEATURE(allmasquerade)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl The '-t' option will retry delivery if e.g. the user runs over his quota.
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
dnl ************ Deepika commented out below line *****************
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl a kernel patch
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not have 24x7 DNS do need this.
FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnlMAILER(smtp)dnl
MAILER(procmail)dnl
Cwlocalhost.localdomain
dnl Specifies domain to use in FROM and envelope addresses.
MASQUERADE_AS(deepa.com)
BUt when I send a test mail addressed to deepika@deepawan.com from my yahoo account I get follwoing error message.

Message from yahoo.com.
Unable to deliver message to the following address(es).

<deepika@deepawan.com>:
24.46.176.178 does not like recipient.
Remote host said: 550 5.7.1 <deepika@deepawan.com>... Relaying denied
Giving up on 24.46.176.178.

I can't figure out what is the problem. Can anyone help me with something?
I will appreciate any help.

Thanks & Regards,
Deepika

Medievalist 09-30-2003 11:20 AM

You should probably get rid of the
FEATURE(`accept_unresolvable_domains')dnl
because it really does make a difference in the amount of spam you will receive. That's not what your current problem is, though.

Shouldn't this line
MASQUERADE_AS(deepa.com)
look like this
MASQUERADE_AS(deepawan.com)
?

Did you run sendmail.mc through the m4 process and restart sendmail afterwards?

#m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
#service sendmail restart

Does your cw file (/etc/mail/local-host-names) contain

deepawan.com
mail.deepawan.com
[24.46.176.178]
localhost
localhost.localdomain

If you make sure those last two are in there, you can remove the line
Cwlocalhost.localdomain
from your sendmail.mc (it won't hurt anything if you don't remove it, though).

deepika 09-30-2003 11:29 AM

should it be /etc/sendmail.cf or /etc/mail/sendmail.cf ??

Medievalist 09-30-2003 11:39 AM

Since you've got
OSTYPE(`linux')
your sendmail configuration is in /etc/sendmail.cf as of this writing.

I expect it will change to /etc/mail at some point in the future, probably at a moment calculated to cause the greatest possible havoc for me personally.

deepika 09-30-2003 12:13 PM

Hi Medievalist, Thanks a lot.

I have succeeded in receiving outside mail on my mail server. The problem was that I didn't have 'deepawan.com' in my /etc/mail/local-host-names. After adding that it works fine.

I also discovered that both /etc/sendmail.cf and /etc/mail/sendmail.cf work. Looks like first sendmail looks for /etc/sendmail.cf and uses it if this exists and if /etc/sendmail.cf doesn't exists then uses /etc/mail/sendmail.cf. May be you can confirm this.

Thanks for other suggestions in /etc/sendmail.mc file too.

Now if I want to configure my mail server for receiving mails for other virtual domains say deepika.com. do I have to register this domain too? Or is there other way to do it.

Thanks once again.
Regards,
Deepika


All times are GMT -5. The time now is 10:38 PM.