Friday, May 11, 2007

How to route your outgoing mail through your Internet Service Provider's mail servers

How to route your outgoing mail through your Internet Service Provider's mail servers





Sendmail

Add these lines to your sendmail.mc file:

define(`SMART_HOST',`mail.yourisp.net')dnl <--- Your ISP's mail server name goes here
MASQUERADE_AS(yourisp.net)dnl <--- Your ISP's domain name goes here
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl

These instruct Sendmail to direct all outgoing mail through "mail.yourisp.net" or whatever you specify as your outgoing mail server.

The "masquerade_as" setting will change the sender envelope (MAIL FROM: contents, also known as the Envelope Sender) in case your ISP's outgoing server denies outbound mail with different domains in the MAIL FROM: or Envelope Sender line.

Suresh Ramasubramanian has more to say on Sendmail on dial-up lines:

There are a couple of other things if the server's on a dialup (like the ability to queue mail on the local box when offline). I've written a short howto at http://www.hserus.net/dlhowto.html which explains how to configure a linux box to be used on a dialup. The specific page dealing with sendmail config is at http://www.hserus.net/pop_smtp.html.

I'd be honored if this is included in your docs.

Glad to be of some use. Also, sorry for the delays and no, I'm not going to put your email address here just so it can be strip-mined by spammers. :-)




Qmail



Qmail takes explicit routes from the file /var/qmail/control/smtproutes. If your ISP's mail host is smtp.yourisp.net, put in it a line containing

:smtp.yourisp.net

(The part before the colon is the domain to route through that server, with nothing before the colon meaning to make it the default.)

You may also want to put your ISP's domain name into /var/qmail/control/defaulthost so that name appears as the domain part of From: and envelope "mail from" addresses. The defaulthost setting lets you work with mail servers that permit relay based on domain name. You can also control the outgoing domain with environment variables, see the man page for qmail-inject.


Postfix


Add these lines to your mail.cf file:

mydomain = yourisp.net
myorigin = $mydomain
relayhost = mail.yourisp.net

The myorigin parameter specifies the domain that appears in mail that is posted on this machine. The above setting forces it to be the domain name of your ISP instead of the full name of your system, and works with mail servers that permit relay based on domain name (much like Sendmail's Masquerade feature). The relayhost parameter routes all outgoing mail through the mailserver of your ISP.

Postfix has a FAQ which includes how to use it on dial-up connections, http://www.postfix.org/faq.html.




Microsoft Exchange Server

Much of this applies to Exchange Server 5.5 or later. You may need to upgrade older versions, especially to prevent relay theft by spammers.

The Exchange Server Administrator program has a Connections tab that lets you specify how to route mail for specific domains (Message Delivery). It also has a default route. Select "Forward all messages to host:" and type in the name of your Internet provider's outgoing mail server. You can override this rule for specific domains (such as your own).

For specifics see this Exchange Server how-to:
http://support.microsoft.com/default.aspx?scid=/support/Exchange/Content/HowTos/dialupims.asp.

Route an incoming message

What is the typical route an incoming message takes?

Here's the full pipeline of programs that get run between incoming remote SMTP connection and mail delivery on a "typical" toaster:

A) SMTP phase
1. softlimit (makes sure the connection doesn't use too much RAM)
2. tcpserver (handles the incoming TCP connection and applies local rules)
3. rblsmtpd (applies RBL and RWL rules to incoming connections)
4. qmail-smtpd (manages the conversation with the remote SMTP client)
5. simscan
a) clamav (run by simscan)
b) spamassassin (run by simscan)
6. qmail-queue (places non-rejected mail into local queue)
B) Local Delivery Phase
1. qmail-send (reads mail from local queue)
2. qmail-lspawn (decides whether to deliver the mail locally)
3. qmail-local (.qmail processing)
4. maildrop (runs the mailfilter script)
5. deliverquota
qmail-local reads the .qmail files and passes control of the message to programs specified there.

deliverquota is called by the mailfilter script to check quotas and deliver the message to the appropriate Maildir if the quota is okay.



How do I route outgoing mail through my ISP's SMTP server?

A: If your ISP's mailserver is mail.someisp.net, add

:mail.someisp.net
to the bottom of /var/qmail/control/smtproutes. This will only work if your ISP allows relaying from its entire dynamic IP range. This is usually the case.

Saturday, May 5, 2007

SARG How to

SQUID ANALYZER REPORT GENERATION



Download the Source from the given Link.

http://prdownloads.sourceforge.net/sarg/sarg-2.2.3.1.tar.gz

If you use native squid log format, the elapsed time will be in reports (emulate_httpd_log off).

1. run ./configure

configure options: --enable-bindir=where sarg binary will be saved
default: /usr/bin

--enable-sysconfdir - where the configuration directory is
default: /usr/local/sarg

--enable-htmldir - where the www html root dir is
default: /var/www/html

--enable-mandir - where the sarg man page will be saved
default: /usr/local/man/man1


3. make

4. make install

5. Go to /usr/local/sarg (or file entered with --sysconfdir on configure)
and change sarg.conf as you need.

6. Notes about sarg:

Date/Time report:
Every minute that a request is logged your time is incremented by the smaller
of 1 minute or the total time for the requests.

Usage: sarg -h

Also Daily , weekly scripts are available on
http://sarg.sourceforge.net/sarg.php