LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-29-2013, 12:29 PM   #1
Softwiz
LQ Newbie
 
Registered: Mar 2013
Posts: 2

Rep: Reputation: Disabled
Question Modify sendmail.cf to hide internal IP outgoing mails


Hi,
I have Linux/Debian/sendmail setup on the gateway for my internal network. Mails going out from internal to the Internet shows the following two Received: lines and I want to remove the internal IP on the second Received: line.

Received: from pen.ese.com (6-4-6-4.adsl.snet.net [6.4.6.4])
by atl4mhib39.myregisteredsite.com (8.14.4/8.14.4) with ESMTP id r9OFixjT014615
for <test@gmail.com>; Thu, 24 Oct 2013 11:45:00 -0400

Received: from mac (mac [192.168.0.17])
by pen.ese.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id r9OFYID7014798
for <test@gmail.com>; Thu, 24 Oct 2013 08:34:20 -0700


I found the Header Received: line in sendmail.cf, and I think that if somehow I can check the incoming mail IP, which is ${if_addr}, if equal to 192.168.0.x then just change the line to shows only the internal network number (192.168.0.x) instead of the full internal number. Can anyone have any idea on how to do this?

There is a way to call a rule set such as
HReceived: $>my_rule_set_1
Smy_rule_set_1
R ......

But I really don't know to do the conditional check. I imagine that there is something I can do such as:

if ${if_addr} = 192.168.0.17 then ${valid_send_addr} = 192.168.0.x
else ${valid_send_addr} = $_

And then the header line would be like:
HReceived: $?sfrom $s $.$?{valid_send_addr}($?s$|from $.d${valid_send_addr})
$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
for $u; $|;
$.$b


Any idea?
 
Old 10-30-2013, 02:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
What you're proposing to do is against the mail RFC's as both sending and receiving MTAs need to record the route. And nobody is going to do anything with LAN range IP addresses anyway unless you run services that mistakingly allow for unrestricted recon or access. So what's the reason for mutilating mail headers?
 
Old 10-30-2013, 04:20 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by unSpawn View Post
What you're proposing to do is against the mail RFC's as both sending and receiving MTAs need to record the route.[] So what's the reason for mutilating mail headers?
We do this within our production environment as (generally) the servers generating the mail will use at least one, sometimes two relay servers before the mail exits the "production" platform. We strip the internal "hops" to remove any outgoing clues to our production architecture.
 
Old 10-30-2013, 11:23 AM   #4
Softwiz
LQ Newbie
 
Registered: Mar 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Why I want to hide the Internal IP?

I just feel too exposing when people see what's on the internal network. That's all! No hidden agenda, just defending.
So if you know how, can you show me?
 
Old 10-30-2013, 07:41 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by TenTenths View Post
We do this within our production environment
Then by all means you should be the one to educate Softwiz.
 
Old 11-01-2013, 09:56 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by unSpawn View Post
Then by all means you should be the one to educate Softwiz.
I would, but I'm not at the office, couple of days holiday for Halloween / wedding anniversary
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sendmail: outgoing mails not arriving after OS upgrade catkin Linux - Software 2 06-04-2012 10:05 AM
Count Outgoing mails sushantchawla2005 Linux - Server 3 10-15-2009 09:50 PM
I cannot determine how sendmail is relaying outgoing mails crisostomo_enrico Solaris / OpenSolaris 4 01-04-2009 05:14 PM
logging outgoing mails in mailserver????? nics Linux - Server 17 01-01-2009 05:19 AM
No outgoing mails (Hacking ???) bittus Linux - Newbie 8 03-21-2008 08:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration