LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-02-2013, 06:51 AM   #1
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Rep: Reputation: Disabled
Postfix + altermime on RHEL 6


Hey All,

I am trying to add Disclaimer to all outgoing mails
My MTA is Postfix - 2.6
OS RHEL 6
altermime-0.3

I googled and tried lots of links but what ever URL had i tried its not adding disclaimer to outgoing mails.

Thanks in advance.
Waiting for quick response

Last edited by faisuddin; 06-02-2013 at 06:57 AM.
 
Old 06-03-2013, 04:52 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
Hey All,
I am trying to add Disclaimer to all outgoing mails
My MTA is Postfix - 2.6
OS RHEL 6
altermime-0.3

I googled and tried lots of links but what ever URL had i tried its not adding disclaimer to outgoing mails.

Thanks in advance. Waiting for quick response
This is a volunteer forum...asking for/expecting a 'quick response' is a bit rude. And when you say you "tried lots of links", you don't tell us WHICH links, what you did, or what results/messages you got, so it's hard for anyone to give a good response. The first hit in Google for "linux postfix add disclaimer to outgoing email" is:
http://www.howtoforge.com/add-discla...ix-debian-etch

...which is a step-by-step guide, and is easy to follow. What part of that did you encounter trouble with? The altermime website also has documentation:
http://www.pldaniels.com/altermime/
 
1 members found this post helpful.
Old 06-04-2013, 07:58 AM   #3
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Dear Mr.TBOne

Thanks for the response.

I followed the below link
http://www.studioc.hu/doc/altermime/...e-howto-2.html

I wrote the below lines in main.cf file
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

I wrote the below lines in master.cf
smtp inet n - y - - smtpd
-o content_filter=dfilt:
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f $sender -- $recipient

This is my disclaimer script
#!/bin/sh
#localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

####### Changed From Original Script #######
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
####### Changed From Original Script END #######

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15

# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }

cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

####### Changed From Original Script #######
# obtain From address
from_address=`grep -m 1 "From:" in.$$ | cut -d "<" -f 2 | cut -d ">" -f 1`

if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}` ]; then
/usr/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/disclaimer.txt \
--disclaimer-html=/etc/postfix/disclaimer.txt \
--xheader="X-Copyrighted-Material: Please visit http://www.pmah.med.sa" || \
--xheader=" " || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
####### Changed From Original Script END #######

$SENDMAIL "$@" <in.$$

exit $?

Whenever I execute the disclaimer script, it's adding the disclaimer to the outgoing mail. But whenever i send mail through the postfix, it's just sending the mail but not adding the disclaimer.

Please can you point out where i'm wrong.
 
Old 06-04-2013, 10:15 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
Dear Mr.TBOne
Thanks for the response.

I followed the below link
http://www.studioc.hu/doc/altermime/...e-howto-2.html
If you noticed, that link is from 2005. Did you look at the link I provided you, which is a bit newer?
Quote:
Whenever I execute the disclaimer script, it's adding the disclaimer to the outgoing mail. But whenever i send mail through the postfix, it's just sending the mail but not adding the disclaimer.

Please can you point out where i'm wrong.
You don't mention whether or not you restarted postfix after you made the changes, or if you populated the disclaimer_addresses file (which is mentioned in the later documentation), and which addresses you put in it.
 
Old 06-04-2013, 11:40 PM   #5
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Yes,I restart the postfix service and in disclaimer_addresses file I put the from addresses.
 
Old 06-05-2013, 08:40 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
Yes,I restart the postfix service and in disclaimer_addresses file I put the from addresses.
Ok...and do your postfix logs tell you anything? Did you go and read the guide I posted, since it's a couple years newer than the one you followed, to see if there were any differences?
 
Old 06-07-2013, 05:31 AM   #7
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
I tried you links also but facing the same problem i.e, Not adding disclaimer to the outgoing mails.
I checked the log file it's showing one error i.e "postfix/master[1144]:terminating on signal 15"
 
Old 06-07-2013, 09:08 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
I tried you links also but facing the same problem i.e, Not adding disclaimer to the outgoing mails.
I checked the log file it's showing one error i.e "postfix/master[1144]:terminating on signal 15"
Are there any OTHER lines in the log file? Because the signal 15 indicates that the script is sending an abort/stop, so postfix is stopping. There is another 'tutorial' centered around CentOS that's much newer:
http://www.virtualmin.com/node/17863

What are the contents of your disclaimer_addresses and disclaimer_domains files? Because from what I've read, you need the IMAP user name, not the "somename@domain.com".
 
Old 06-07-2013, 09:20 AM   #9
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
I'm not adding anything in the main.cf file.
 
Old 06-07-2013, 10:13 AM   #10
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
I tried that link also. Still the same problem not adding disclaimer to the outgoing mails.
 
Old 06-07-2013, 10:18 AM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
I'm not adding anything in the main.cf file.
You said in post #3 that you put the appropriate lines in the main.cf file. Now you're saying you didn't?? Which is it, since both can't be true?

And again, did you read/understand my previous post, where I asked about the contents of the disclaimer_* files? Did you see where I asked about the addresses/names in those files, and if they matched the IMAP credentials?? Unless you provide answers to questions asked, there's little anyone can help with.
 
Old 06-08-2013, 06:25 AM   #12
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
-I mean to say that I'm not invoking content_filter in main.cf.

Below are you're answers
-I kept the username in disclaimer_addresses file and domain names in disclaimer_domains file.
-Yes, it matching the IMAP credentials that's why it's sending mail but not adding disclaimer to that mail.
 
Old 06-08-2013, 06:50 AM   #13
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
I think the problem is in master.cf file. Because if I give wrong path then only it's not giving any error and sending mail without adding disclaimer.
 
Old 06-08-2013, 01:29 PM   #14
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,602

Rep: Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061Reputation: 4061
Quote:
Originally Posted by faisuddin View Post
-I mean to say that I'm not invoking content_filter in main.cf.
Well, if you don't ENABLE IT, it's not going to WORK, is it??? Unless you tell postfix to use the script, it's not going to.
Quote:
Below are you're answers
-I kept the username in disclaimer_addresses file and domain names in disclaimer_domains file.
Right...and you were asked to post at least SOME of the contents of those files.
Quote:
-Yes, it matching the IMAP credentials that's why it's sending mail but not adding disclaimer to that mail.
No...it's sending the email because the email CLIENT is logging in with the credentials. If those don't match in the addresses file, then you won't get a disclaimer. Which is why you were asked to post the contents.
 
Old 06-09-2013, 03:20 AM   #15
faisuddin
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Dear TBOne,
I removed the disclaimer_addresses and disclaimer_domains from the disclaimer script, still it's not adding disclaimer to outgoing mails.

This is my modified script
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

####### Changed From Original Script #######
#DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
#DISCLAIMER_DOMAINS=/etc/postfix/disclaimer_domains
####### Changed From Original Script END #######

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15

# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }

cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

####### Changed From Original Script #######
# obtain From address
# this line checks the address in the from header
#from_address=<code>grep -m 1 &quot;From:&quot; in.$$ | cut -d &quot;&lt;&quot; -f 2 | cut -d &quot;@&quot; -f 1</code>
# and this one checks the domain.
#from_domain=<code>grep -m 1 &quot;From:&quot; in.$$ | cut -d &quot;&lt;&quot; -f 2 | cut -d &quot;&gt;&quot; -f 1 | cut -d &quot;@&quot; -f 2</code>

#if [ <code>grep -wi ^${from_domain}$ ${DISCLAIMER_DOMAINS}</code> ]; then
# if [ <code>grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}</code> ]; then
/usr/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/disclaimer_text.txt \
--disclaimer-html=/etc/postfix/disclaimer_text.htm \
--xheader="X-Copyrighted-Material: Please visit http://www.mydomain.com/emailpolicy/" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
# fi
#fi

$SENDMAIL -oi "$@" <in.$$
exit $?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: How To Automatically Add A Disclaimer To Outgoing Emails With alterMIME (Postfix On Debian Squ LXer Syndicated Linux News 1 01-16-2013 09:47 PM
LXer: Adding Disclaimers To Outgoing Emails With alterMIME (Postfix On Debian Lenny) LXer Syndicated Linux News 0 09-22-2010 12:40 AM
Postfix + Altermime on FC6 Not working simjith Linux - Server 10 10-14-2008 04:05 AM
postfix + altermime = error with delivery mkiler Linux - Server 2 06-23-2008 12:40 AM
Postfix and Altermime drumltd Linux - Software 8 08-24-2006 04:13 PM


All times are GMT -5. The time now is 12:06 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration