Getting Comcast Email on Home Linux Box
Getting Comcast Email on Home Linux Box
Mike Chirico
Copyright (c) 2004 (GPU Free Documentation License)
Last Updated: Fri Oct 15 15:44:23 EDT 2004
Link To Latest Version:
http://prdownloads.sourceforge.net/souptonuts/README_COMCAST_EMAIL.txt?d...
Passing Outbound Mail, plus Masquerading User and Hostname
The following instructions explain how to send and receive Comcast
email from a home Linux box, which is connected to the Internet via
Comcast cable model. To make things interesting, assume the Comcast
email is different from the account on the Linux computer. Yet, through
"mutt", "elm" or whatever, make it possible to send email to other
comcast users, or anyone else on the Internet. When receiving email,
have it forwarded to the local Linux account.
These instructions are written with "mchirico@comcast.net" being
the Comcast account and "chirico@third-fl-71" being the Linux
local account. Note the missing "m" in "mchirico" on the local
account.
These instructions my be helpful when using other "ISP" as
well.
STEP 1:
Create ".fetchmailrc" in your home directory. For me it was
/home/chirico
Note, again, comcast email is "mchirico" but the Linux account is "chirico".
Also, here email is kept on the server, since the "keep" option
is specified. Removing "keep" will prevent the Comcast account from
filling up.
The following gets email via ssl. Note, put in your password. Don't
leave the password shown below.
#
#
# Sample .fetchmailrc file for Comcast
#
# Check mail every 90 seconds
set daemon 90
set syslog
set postmaster chirico
#set bouncemail
#
# Comcast email is mchirico but computer is chirico
poll mail.comcast.net with proto POP3 and options no dns
user 'mchirico' with pass "secretpassword" is 'chirico' here
options ssl sslcertck sslcertpath '/usr/share/ssl/certs' keep
smtphost comcast.net
# end .fetchmailrc
Note, some of the lines above wrapped. The complete ".fetchmailrc"
can be downloaded from the following location:
http://prdownloads.sourceforge.net/souptonuts/fetchmailrc?download
To start fetchmail the following command is issued:
$ fetchmail
STEP 2:
When these instructions were written, 8.13.0 was the latest version
and it was downloaded via ftp as follows:
ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.13.0.tar.gz
Use "./Build -c" and "./Build Install", instead of configure, make
make install. Compile options are specified in
"devtools/Site/site.config.m4".
The following is an example "site.config.m4" file with "SASL"
and "STARTTLS" as configured on Redhat 9. Note, Redhat 9 "openssl"
relys on "kerberos" files in a separate directory as shown below.
APPENDDEF(`conf_sendmail_ENVDEF',`-DSTARTTLS')
APPENDDEF(`conf_sendmail_LIBS',`-lssl -lcrypto ')
APPENDDEF(`conf_sendmail_ENVDEF',`-DSASL')
APPENDDEF(`conf_sendmail_LIBS',`-lsasl')
APPENDDEF(`confINCDIRS',`-I/usr/kerberos/include')
APPENDDEF(`confINCDIRS',`-I/usr/include/openssl/include')
APPENDDEF(`confLIBDIRS',`-L/usr/kerberos/lib -L/usr/include/openssl/lib')
A complete "site.config.m4" can be found at the following location:
http://prdownloads.sourceforge.net/souptonuts/site.config.m4?download
It's a good idea to backup the configuration files, if they exist:
$ cp /etc/mail/sendmail.mc /etc/mail/OLDsendmail.mc
$ cp /etc/mail/sendmail.cf /etc/mail/OLDsendmail.cf
Next, from the sendmail directory "Build" and "Install"
$ ./Build -c
$ ./Build install
Although not necessary, it's possible to build a "private CA (Certificate Authority)".
The step below isn't necessary; but, since it's very simple, it's included here
$ cd /etc/mail
$ mkdir certs
$ /usr/share/ssl/misc/CA -newca
Next, the build process prompts for a lot of questions:
Making CA certificate ...
Generating a 1024 bit RSA private key
.++++++
..++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:secretpassword
Verifying - Enter PEM pass phrase:secretpassword
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:US
US
State or Province Name (full name) [Berkshire]:Pennsylvania
Elkins Park
Locality Name (eg, city) [Newbury]:Philadelphia
Philadelphia
Organization Name (eg, company) [My Company Ltd]:DiaperChanger
DiaperChanger
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:mike.localhost.com
mike.localhost.com
Email Address []:mchirico@comcast.net
Next, the directory "demoCA" should be move to "CA" and access
rights of 0700 should be applied to "private".
$ mv demoCA CA
$ cd CA
$ chmod 0700 private
Next, to create "sendmailssl.cnf"
$ cp /usr/share/ssl/openssl.cnf sendmailssl.cnf
The following changes must be made to "sendmailssl.cnf". In this file
dir = ./demoCA # Where everything is kept
Needs to be changed to
dir = /etc/mail/certs/CA # Where everything is kept
STEP 3:
Making changes to "sendmail.mc"
Next, "/etc/mail/sendmail.mc" should be changed as follows:
MASQUERADE_AS(`comcast.net')dnl
FEATURE(masquerade_envelope) FEATURE(genericstable, `hash -o
/etc/mail/genericstable')
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
Careful the second line above wraps...it should be one line. It's
best to download the sample "sendmail.mc" file for the following
location:
http://prdownloads.sourceforge.net/souptonuts/sendmail.mc?download
The MASQUERADE_AS('comcast.net') translates the return email for
user "chirico" to be "chirico@comcast.net" Note, it's still
necessary to convert "chirico" to "mchirico", which is shown
in step 4.
The changes won't go into effect until it's been run through "m4"
as follows:
$ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
STEP 4:
A "genericstable" is needed an can be created as follows. There is
a single space between the names:
chirico mchirico@comcast.net
This translates "chirico" to "mchirico".
Next, it's necessary to build the hash table "/etc/mail/genericstable.db"
$ makemap -r hash genericstable.db < genericstable
STEP 5:
Next, for the domain, "/etc/mail/genericsdomain" has to be created
$hostname --long > /etc/mail/genericsdomain
STEP 6:
In "/etc/mail/sendmail.mc" make sure the following "define" line
is uncommented and `smtp.comcast.net' is added.
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST',`smtp.comcast.net')
STEP 7:
Restart sendmail. For Redhat, the following command works:
$/etc/init.d/sendmail restart
STEP 8:
Test The Connection:
$ sendmail -bv mchirico@comcast.net
mchirico@comcast.net... deliverable: mailer relay,
host smtp.comcast.net, user mchirico@comcast.net
STEP 9:
Creating Simple Spam Filters with Procmail.
The following is a sample "/home/chirico/.forward" which
contains the following:
"|exec /usr/bin/procmail"
Procmail with look in "/home/chirico/.procmailrc" for the
procmail rules. Below is a sample file:
#####################################################
# Sample Procmail File "/home/chirico/.procmailrc" #
#####################################################
# Do a "man procmail" for more examples
#
PATH=/bin:/usr/bin:/usr/local/bin
MAILDIR=/var/spool/mail
DEFAULT=/var/spool/mail/chirico
LOGFILE=/home/chirico/MailBAG
#
#
:0 HB
* ^Content-Type.*image.*gif.*name.*\.gif
* ^Content-Disposition.*attachment.*filename.*\.gif"
{
:0
/dev/null
}
REFERENCES:
A copy of my "sendmail.mc" can be found here:
http://prdownloads.sourceforge.net/souptonuts/sendmail.mc?download
A copy of my ".fetchmailrc" can be found here:
http://prdownloads.sourceforge.net/souptonuts/fetchmailrc?download
A copy of my "site.config.m4" can be found here:
http://prdownloads.sourceforge.net/souptonuts/site.config.m4?download
A copy of my "genericstable" can be found here:
http://prdownloads.sourceforge.net/souptonuts/genericstable?download
A copy of my "genericsdomain" can be found here:
http://prdownloads.sourceforge.net/souptonuts/genericsdomain?download
Excellent Book Reference:
"Sendmail Cookbook: Administering, Securing & Spam-Fighting", Craig Hunt
2004, O'Reilly.
Please send feedback to:
https://sourceforge.net/forum/forum.php?forum_id=270737
REF:http://easynews.dl.sourceforge.net/sourceforge/souptonuts/README_COMCAST_EMAIL.txt
