Quote:
Originally posted by Cagao
Currently i have...
<my ip> mysub.mydomain.com mysub
i'm not sure if that's the problem (wouldn't have thought so), so prob looking into problem with /etc/sysconfig/network
Or maybe other config files I've forgotten about.
|
The format you have in your hosts file is correct. A copy/paste from the man pages on the format of /etc/hosts
Code:
IP_address canonical_hostname aliases
Now, from the man pages (README) on sendmail...
Code:
+-----------+
| WHO AM I? |
+-----------+
Normally, the $j macro is automatically defined to be your fully
qualified domain name (FQDN). Sendmail does this by getting your
host name using gethostname and then calling gethostbyname on the
result. For example, in some environments gethostname returns
only the root of the host name (such as "foo"); gethostbyname is
supposed to return the FQDN ("foo.bar.com"). In some (fairly rare)
cases, gethostbyname may fail to return the FQDN. In this case
you MUST define confDOMAIN_NAME to be your fully qualified domain
name. This is usually done using:
Dmbar.com
define(`confDOMAIN_NAME', `$w.$m')dnl
Based on your problem description in your first post, sendmail "properly" derived its FQDN. So changing the above sendmail settings or your /etc/hosts file are not necessary. I included the above for reference.
To verify your systems hostname and domain name are properly configured, type:
Code:
[scowles@voyager mail]$ hostname --fqdn
voyager.mydomain.com
[scowles@voyager mail]$ hostname --domain
mydomain.com
[scowles@voyager mail]$ hostname --short
voyager
[scowles@voyager mail]$ sendmail -bt -d0.1 </dev/null
Version 8.12.10
Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF STARTTLS TCPWRAPPERS
USERDB USE_LDAP_INIT
============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = voyager
(canonical domain name) $j = voyager.mydomain.com
(subdomain name) $m = mydomain.com
(node name) $k = voyager.mydomain.com
========================================================
[root@voyager mail]# cd /etc
[root@voyager etc]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.9.3 voyager.mydomain.com voyager
Obvioulsy your hostname and domain name will be different, but the output format from the above commands should be identical. If its not... DO NOT PASS GO, DO NOT COLLECT $200! Fix your systems hostname/resover lib configuration prior to configuring sendmail to add the domain name instead of the fdqn. See: man hostname
Finally, the problem you describe in your post has to do with how sendmail handles a "from" address that is not fully qualified. i.e.
From: scowles instead of
From: scowles@mydomain.com Sendmail is always going to add the derived FQDN it obtained at startup to any NON-FQDN "from" e-mail address. A NON-FQDN e-mail address usually happens with cronjobs or when using the "mail command.
With the above in mind, there are a couple of ways to configure sendmail to NOT add the FQDN to NON-FQDN e-mail addresses. Implement one or the other, not both.
1) Global solution - Enable the sendmail feature "MASQUERADE AS" by...
* add the following two lines to your sendmail.mc file.
Code:
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(masquerade_envelope)dnl
* Create the new sendmail.cf file
Code:
# cd /etc/mail
# m4 sendmail.mc >sendmail.cf
* restart sendmail and test
Note: The root account is never masqueraded becuase it should be listed as an "exposed" user (as it should be). So root cronjobs will still have the from address set to
root@hostname.mydomain.com, not
root@mydomain.com, but all other accounts should now appear as
user@mydomain.com when submitted locally.
2) Per user - Enable the sendmail genericstable feature.
* add the following two lines to /etc/mail/sendmail.mc. I added them after the "virtusertable" lines.
Code:
FEATURE(`genericstable',`hash /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
* create the following two files:
Code:
# cd /etc/mail
# touch genericstable generics-domains
* in the genericstable file, add the users you want to rewite with the domain name.
* In /etc/mail/generics-domains, add your systems fqdn. Basically, only e-mails that are submitted from the entries (FQDN) listed in this file will be re-written.
Code:
# cat /etc/mail/generocs-domains
hostname.mydomain.com
* Now create the genericstable database.
Code:
# cd /etc/mail
makemap hash genericstable.db <genericstable
* Restart sendmail and test