Sendmail Masquerading Explained
If you want your mail to appear to come from user@mysite.com and not user@bigboy.mysite.com, then you have two choices:
• Configure your email client, such as Outlook Express, to set your email address to user@mysite.com. (I'll explain this in the "Configuring Your POP Mail Server" section.).
• Set up masquerading to modify the domain name of all traffic originating from and passing trough your mail server.
Configuring masquerading
In the DNS configuration, you made bigboy the mail server for the domain my-site.com. You now have to tell bigboy in the sendmail configuration file sendmail.mc that all outgoing mail originating on bigboy should appear to be coming from my-site.com; if not, based on our settings in the /etc/hosts file, mail will appear to come from mail.my-site.com. This isn't terrible, but you may not want your Web site to be remembered with the word "mail" in front of it. In other words you may want your mail server to handle all email by assigning a consistent return address to all outgoing mail, no matter which server originated the email.
You can solve this by editing your sendmail.mc configuration file and adding some masquerading commands and directives:
FEATURE(always_add_domain)dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`allmasquerade')dnl
MASQUERADE_AS(`my-site.com')dnl
MASQUERADE_DOMAIN(`my-site.com.')dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
The result is that:
• The MASQUERADE_AS directive makes all mail originating on bigboy appear to come from a server within the domain my-site.com by rewriting the email header.
• The MASQUERADE_DOMAIN directive makes mail relayed via bigboy from all machines in the another-site.com and localdomain domains appear to come from the MASQUERADE_AS domain of my-site.com. Using DNS, sendmail checks the domain name associated with the IP address of the mail relay client sending the mail to help it determine whether it should do masquerading or not.
• FEATURE masquerade_entire_domain makes sendmail masquerade servers named *my-site.com, and *another-site.com as my-site.com. In other words, mail from sales.my-site.com would be masqueraded as my-site.com. If this wasn't selected, then only servers named my-site.com and my-othersite.com would be masqueraded. Use this with caution when you are sure you have the necessary authority to do this.
• FEATURE allmasquerade makes sendmail rewrite both recipient addresses and sender addresses relative to the local machine. If you cc: yourself on an outgoing mail, the other recipient sees a cc: to an address he knows instead of one on localhost.localdomain.
Note: Use FEATURE allmasquerade with caution if your mail server handles email for many different domains and the mailboxes for the users in these domains reside on the mail server. The allmasquerade statement causes all mail destined for these mailboxes to appear to be destined for users in the domain defined in the MASQUERADE_AS statement. In other words, if MASQUERADE_AS is my-site.com and you use allmasquerade, then mail for peter@another-site.com enters the correct mailbox but sendmail rewrites the To:, making the e-mail appear to be sent to peter@my-ste.com originally.
• FEATURE always_add_domain always masquerades email addresses, even if the mail is sent from a user on the mail server to another user on the same mail server.
• FEATURE masquerade_envelope rewrites the email envelope just as MASQUERADE_AS rewrote the header.
Masquerading is an important part of any mail server configuration as it enables systems administrators to use multiple outbound mail servers, each providing only the global domain name for a company and not the fully qualified domain name of the server itself. All email correspondence then has a uniform email address format that complies with the company's brand marketing policies.
Note: E-mail clients, such as Outlook Express, consider the To: and From: statements as the e-mail header. When you choose Reply or Reply All in Outlook Express, the program automatically uses the To: and From: in the header. It is easy to fake the header, as spammers often do; it is detrimental to e-mail delivery, however, to fake the envelope.
The e-mail envelope contains the To: and From: used by mailservers for protocol negotiation. It is the envelope's From: that is used when e-mail rejection messages are sent between mail servers.
Testing Masquerading
The best way of testing masquerading from the Linux command line is to use the "mail -v username" command. I have noticed that "sendmail -v username" ignores masquerading altogether. You should also tail the /var/log/maillog file to verify that the masquerading is operating correctly and check the envelope and header of test email received by test email accounts.
Other Masquerading Notes
By default, user "root" will not be masqueraded. To remove this restriction use:
EXPOSED_USER(`root')dnl
command in /etc/mail/sendmail.mc. You can comment this out if you like with a "dnl" at the beginning of the line and running the sendmail start script.
Using Sendmail to Change the Sender's Email Address
Sometimes masquerading isn't enough. At times you may need to change not only the domain of the sender but also the username portion of the sender's e-mail address. For example, perhaps you bought a program for your SOHO office that sends out notifications to your staff, but the program inserts its own address as sender's address, not that of the IT person.
Web-based CGI scripts tend to run as user apache and, therefore, send mail as user apache too. Often you won't want this, not only because apache's e-mail address may not be a suitable, but also because some anti-spam programs check to ensure that the From:, or source e-mail address, actually exists as a real user. If your virtusertable file allows e-mail to only predefined users, then queries about the apache user will fail, and your valid e-mail may be classified as being spam.
With sendmail, you can change both the domain and username on a case-by-case basis using the genericstable feature:
1) Add these statements to your /etc/mail/sendmail.mc file to activate the feature:
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
2) Create a /etc/mail/generics-domains file that is just a list of all the domains that should be inspected. Make sure the file includes your server's canonical domain name, which you can obtain using the command:
sendmail -bt -d0.1
Here is a sample /etc/mail/generics-domains file:
my-site.com
another-site.com
bigboy.my-site.com
3) Create your /etc/mail/genericstable file. First sendmail searches the /etc/mail/generics-domains file for a list of domains to reverse map. It then looks at the /etc/mail/genericstable file for an individual email address from a matching domain. The format of the file is
linux-username username@new-domain.com
Here is an example:
alert security-alert@my-site.com
peter urgent-message@my-site.com
apache mailer@my-site.com
4) Run the sendmail restart script from the beginning of the chapter and then test.
Your e-mails from linux-username should now appear to come from username@new-domain.com.
Troubleshooting Sendmail
There are a number of ways to test sendmail when it doesn't appear to work correctly. Here are a few methods you can use to fix some of the most common problems.
Testing TCP connectivity
The very first step is to determine whether your mail server is accessible on the sendmail SMTP TCP port 25. Lack of connectivity could be caused by a firewall with incorrect permit, NAT, or port forwarding rules to your mail server. Failure could also be caused by the sendmail process being stopped. It is best to test this from both inside your network and from the Internet.
Chapter 4, "Simple Network Troubleshooting", covers troubleshooting with TELNET.
Further Testing of TCP connectivity
You can also mimic a full mail session using TELNET to make sure everything is working correctly. If you get a "500 Command not recognized" error message along the way, the cause is probably a typographical error. Follow these steps carefully.
1) Telnet to the mail server on port 25. You should get a response with a 220 status code.
[root@bigboy tmp]# telnet mail.my-site.com 25
Trying mail.my-site.com...
Connected to mail.my-site.com.
Escape character is '^]'.
220 mail.my-site.com ESMTP server ready
2) Use the hello command to tell the mail server the domain you belong to. You should receive a message with a successful status 250 code at the beginning of the response.
helo another-web-site.org
250 mail.my-site.com Hello c-24-4-97-110.client.comcast.net [24.4.97.110], pleased to meet you.
3) Inform the mail server from which the test message is coming with the MAIL FROM: statement.
MAIL FROM:sender@another-web-site.org
250 2.1.0 sender@another-web-site.org... Sender ok
4) Tell the mail server to whom the test message is going with the " RCPT TO:" statement.
RCPT TO: user@my-site.com
250 2.1.5 user@my-site.com... Recipient ok
5) Prepare the mail server to receive data with the DATA statement
DATA
354 Enter mail, end with "." on a line by itself
6) Type the string "subject:" then type a subject. Type in your text message, ending it with a single period on the last line. For example.
Subject: Test Message
Testing sendmail interactively
.
250 2.0.0 iA75r9si017840 Message accepted for delivery
7) Use the QUIT command to end the session.
QUIT
221 2.0.0 mail.my-site.com closing connection
Connection closed by foreign host.
[root@bigboy tmp]#
Now verify that the intended recipient received the message, and check the system logs for any mail application errors.
The /var/log/maillog File
Because sendmail writes all its status messages in the /var/log/maillog file, always monitor this file whenever you are doing changes. Open two TELNET, SSH, or console windows. Work in one of them and monitor the sendmail status output in the other using the command
[root@bigboy tmp]# tail -f /var/log/maillog
cao thủ cấp bậc Đấu thần. Còn thủy hệ ma lực của hắn, trực tiếp vượt cấp
ReplyDeletetới cấp mười hai rồi. Đoạn Vân là người tu luyện chân khí, dựa theo cấp
bậc bình thường thì hẳn là ma pháp và chân khí cũng như nhau, nhưng vì
ma pháp của hắn phát triển chậm, do đó ma lực trong cơ thể hắn cũng
giống như xe đạp chạy trên đường cao tốc. Tinh thần lực cường hãn như
vậy, chỉ có chừng đó ma lực, nói ra thật sự có chút buồn cười. Lúc này,
cuối cùng cũng đã có thể coi như trở thành một cái xe mô tô chạy trên
ngoài cao tốc rồi. Nhưng, ma lực của Đoạn Vân xem ra có chút không ổn,
phải trải qua một thời gian nữa để củng cố mấy thứ vừa hấp thu.
Âu Đặc Tư, lại là người thu hoạch năng lượng lớn nhất. Bởi vì, bằng vào
thần lực của Hải Thần, Âu Đặc Tư vượt giai tới Đấu thần trung giai. Một
tên vừa mới bước vào hàng ngũ Đấu thần sơ giai mà lại tiến nhanh tới Đấu
thần trung giai, việc này không thể không nói là một kỳ tích. Hơn nữa,
trong cơ thể hắn, vẫn tồn trữ không ít thần lực Hải Thần như trước, đợi
thần lực Hải Thần bị tiêu hóa hấp thu hoàn toàn, Âu Đặc Tư rất có thể
lại một lần nữa tiến giai tới cấp hậu giai.
học kế toán tại hà đông
eco city long biên
học kế toán tại tphcm
trung tâm kế toán tại quảng ninh
học kế toán tại thanh xuân
khoá học kế toán thuế
trung tâm kế toán tại long biên
luyện thi toeic
trung tâm kế toán tại nghệ an
trung tâm kế toán tại cầu giấy
trung tâm dạy kế toán tại cầu giấy
trung tâm kế toán tại bình dương
tiếng anh cho người mới bắt đầu
học kế toán tại đà nẵng
học kế toán thực hành tại đồng nai
Thu hồi linh hồn đã chết kia xong, Đoạn Vân rất nhìn nhìn đám thủ hạ ở
đây với vẻ hài lòng, nói rất đểu giả :
- Được rồi, thu bảo tàng đi. Diệp Cô Thành, ngươi vể Á Cương một chuyến,
bảo Lai Bố Ni Tư điều một vạn Địa Tinh tới thu thập mấy ma hạch cấp thấp
và mấy bộ xương hải thú hữu dụng. Nhớ bảo chúng mang theo đủ trang bị