Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-21-2003, 02:38 PM
|
#1
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Rep:
|
Sendmail 'From' header rewrite
Our mailserver is on host 'castor', but we have only one registered domain name: mail.foo.bar.
When I write a mail with the mail command:
mail someuser@somedomain.onthe.internet
the from address is correctly rewritten: myusername@mail.foo.bar, and the mail is sent.
However, when I use pine or any other MUA on castor, the From address is always rewritten as castor.foo.bar, and the mails are rejected by our ISP ('Sender domain must exist')
Why are mails sent by mail rewritten differently than those sent by pine, mutt, or neomail and the like?
How can I make sendmail to always rewrite the from header as 'mail.foo.bar'? (Or rather not to rewrite the header at all, as pine is already configured to use mail.foo.bar as From header)
Last edited by J_Szucs; 08-21-2003 at 02:47 PM.
|
|
|
08-21-2003, 02:57 PM
|
#2
|
Member
Registered: Jul 2003
Distribution: Fedora 3
Posts: 133
Rep:
|
Cool! Did you notice that in your post, when you wrote someuser@somedomain.onthe.internet, it only automatically hyperlinked everything until the "inte" and left out the rnet in internet...why is that? because there can only be a maximum of four letters in a top level domain, and the automatic hyperlinker knows that? hmmm...
Now back to your problem...i'm not sure if this would solve your problem, but try it
go to /etc/mail/ and look at sendmail.mc (or whatever your m4 config file is, ending in ".mc")
go to the end, and if you are using RH9 and looking at the config that came with the kernel, you should see:
Code:
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
If you don't see it, add it. Get rid of the begginning dnl's (keep the end dnl's) and edit the domain names to fit your domain named
Then, compile sendmail.mc into sendmail.cf
On my machine, i simply use
m4 sendmail.mc > sendmail.cf
and then restart your sendmail server...not sure if the m4 step would apply to you or not (RH9 i have)
Have fun
|
|
|
08-21-2003, 03:21 PM
|
#3
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
Is it possible to do this by directly editing sendmail cf?
It was not me who setup this sendmail, and seems to have made all his changes by directly editing sendmail.cf, or he may have generated sendmail.cf on his own machine, as I cannot find any .mc file the settings in which would be at least close to those found in sendmail.cf.
Actually, the only .mc file I find does not contain the lines on masquerading at all, so there is nothing to uncomment.
Can I add those lines to the mc file?
Would I reset other settings in the present sendmail.cf file if I run the m4 macro on a seemingly incomplete .mc file or an mc file that only contains the masquerading lines?
Meanwhile I tried
m4 sendmail.mc > sendmail.cf
and it did nothing but inserted the lines of sendmail.mc in sendmail.cf exactly as they look like in the .mc file
Last edited by J_Szucs; 08-21-2003 at 05:00 PM.
|
|
|
08-21-2003, 06:22 PM
|
#4
|
Member
Registered: Jul 2003
Distribution: Fedora 3
Posts: 133
Rep:
|
Thats a slight problem...
If i were you, I would first save a copy of the original sendmail.cf file. Then, in the sendmail.mc file, make sure you have the line at the top of the file, after "divert(-1)dnl":
Code:
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
Then try m4 again. If that still doesnt work, try "make -C /etc/mail"
If it produces a sendmail.cf file, then yay!
Then just add the MASQUERADE lines into the .mc file, and do m4 again, and restart sendmail.
Oh yah, you can try editing sendmail.cf directly, but don't blame me for the headaches.  There are lots of sources on the internet, just google for them. Maybe there's something about how to add MASQUERADE into .cf, but i've never tried, or thought about trying. Have fun
EDIT
Quote:
I cannot find any .mc file the settings in which would be at least close to those found in sendmail.cf
|
What do you mean, you can figure out what .mc definitions correspond with .cf definitions? Because they look nothing alike..so..
Last edited by jqcaducifer; 08-21-2003 at 06:25 PM.
|
|
|
08-21-2003, 07:28 PM
|
#5
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
Well, looking more closely into the present sendmail.cf I see it was generated on 03/02/2000 somewhere in Germany by a German guy for a previous sendmail version (all mc file versions used for generating the sendmail.cf are ancient).
We (me and the server) are in Hungary in 08/22/2003 with a newer sendmail version, so it seems that the guy who installed sendmail on this server simply google searched the web for a sample sendmail.cf then made some manual corrections to it until it began to work.
So I think I had better start with the clean mc files and configure everything from the beginning.
Meanwhile I am getting familiar with the m4 macro, now I know how to generate a sendmail.cf :-).
|
|
|
08-21-2003, 09:12 PM
|
#6
|
Member
Registered: Jul 2003
Distribution: Fedora 3
Posts: 133
Rep:
|
For what its worth, here's the mc file that came with my RH9, so you can have a starting point:
Code:
divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl # make -C /etc/mail
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for Red Hat Linux')dnl
OSTYPE(`linux')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl define(`SMART_HOST',`smtp.your.provider')
dnl #
dnl define(`confDEF_USER_ID',``8:12'')dnl
define(`confTRUSTED_USER', `smmsp')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
dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
dnl define(`confAUTH_OPTIONS', `A')dnl
dnl #
dnl # The following allows relaying if the user authenticates, and disallows
dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links
dnl #
dnl define(`confAUTH_OPTIONS', `A p')dnl
dnl #
dnl # PLAIN is the preferred plaintext authentication method and used by
dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do
dnl # use LOGIN. Other mechanisms should be used if the connection is not
dnl # guaranteed secure.
dnl #
dnl 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 #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl # make -C /usr/share/ssl/certs usage
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 #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL',`groupreadablekeyfile')dnl
dnl #
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
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
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
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 #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl # NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl # a kernel patch
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
good luck
|
|
|
08-23-2003, 09:20 PM
|
#7
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
Thanx for your help!
I could solve the problem, it actually turned out to be a misconfiguration in sendmail.cf.
I pulled together a site mc file from scratch, and built a new sendmail.cf.
I also took the occasion to download, compile and install a new version of sendmail.
The RTFM operations took several hours, but now everything works.
|
|
|
09-10-2003, 11:45 PM
|
#8
|
LQ Newbie
Registered: Sep 2003
Posts: 17
Rep:
|
Another way (quick and dirty) would be to edit .pinerc in your home directory and set
user-domain=
to whatever you want . Ie "user-domain=domain.bhah".
But the better way is to do what you did - regenerate your MC from scratch after RTFM. You learn much more that way. Will take awhile but in the long run your better off.
|
|
|
All times are GMT -5. The time now is 06:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|