LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-04-2009, 05:43 PM   #1
kevinslair
LQ Newbie
 
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17

Rep: Reputation: 0
Postfix Amavisd-New Autosignature


Hey, everyone.

I hope this is the right place for this question.

I am trying to get autosignature working on my postfix and Amavisd-new.

Here is the info:


Here is my master.cf:
Code:

==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
#
==========================================================================
smtp 	inet	n	-	n	-	-	smtpd
     -o content_filter=signature

amavisfeed unix    -       -       n       -       2     smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

127.0.0.1:10025 inet n    -       n       -       -     smtpd
     -o content_filter=
     -o smtpd_delay_reject=no
     -o smtpd_client_restrictions=permit_mynetworks,reject
     -o smtpd_helo_restrictions=
     -o smtpd_sender_restrictions=
     -o smtpd_recipient_restrictions=permit_mynetworks,reject
     -o smtpd_data_restrictions=reject_unauth_pipelining
     -o smtpd_end_of_data_restrictions=
     -o smtpd_restriction_classes=
     -o mynetworks=127.0.0.0/8
     -o smtpd_error_sleep_time=0
     -o smtpd_soft_error_limit=1001
     -o smtpd_hard_error_limit=1000
     -o smtpd_client_connection_count_limit=0
     -o smtpd_client_connection_rate_limit=0
     -o
receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
     -o local_header_rewrite_clients=
     -o smtpd_milters=
     -o local_recipient_maps=
     -o relay_recipient_maps=

# END Added for amavis support

# Signature/Disclaimer
signature           unix    -       n       n       -       -       pipe
   flags=Rq user=filter argv=/etc/postfix/signature/disclaimer.sh -f
${sender} -- ${recipient}

Here is disclaimer.sh:

Code:
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

# 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; }

/usr/bin/altermime --input=in.$$ \
   --disclaimer=/etc/postfix/signature/disclaimer.txt \
   --disclaimer-html=/etc/postfix/signature/disclaimer.html \
   --xheader="X-CUSTOM-MOTD: Have a great day" || \
   { echo Message content rejected; exit $EX_UNAVAILABLE; }

$SENDMAIL "$@" <in.$$
                                                                      
exit $?
I created the user and here is the code:

Code:
# chmod 750 disclaimer.sh
# chown root:filter /etc/postfix/signature/disclaimer.sh
Please, if anyone knows an easier way to do this...please let me know.

The error I keep getting is permission denied on the pipe for the file disclaimer.sh.

thanks,
Kevin
 
Old 11-08-2009, 12:53 AM   #2
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
What are the file permissions and ownership for /usr/bin/altermime?

You might try to debug this by brute force; insert a few 'echo' commands and redirect unique strings into a log...see the exact line where disclaimer.sh fails.
 
Old 11-08-2009, 05:00 AM   #3
kevinslair
LQ Newbie
 
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17

Original Poster
Rep: Reputation: 0
/usr/bin/altermime is owned by root with user root.

Should this be changed to root:filter?
 
Old 11-09-2009, 12:44 AM   #4
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
Quote:
Originally Posted by kevinslair View Post
Code:
# Signature/Disclaimer
signature           unix    -       n       n       -       -       pipe
   flags=Rq user=filter argv=/etc/postfix/signature/disclaimer.sh -f
${sender} -- ${recipient}
You run this as user 'filter' as indicated in red, above.

Does user 'filter' have rights to execute /usr/bin/altermime? Does this executable have +x for 'other' users?
 
Old 11-09-2009, 04:07 AM   #5
kevinslair
LQ Newbie
 
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17

Original Poster
Rep: Reputation: 0
No, the file is owned by root:root.

I am going to change it to root:filter and see if that works.

Thanks,
Kevin
 
Old 11-14-2009, 07:08 PM   #6
kevinslair
LQ Newbie
 
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17

Original Poster
Rep: Reputation: 0
Ok, I got it to work. I didn't know it but amavis has it's own signature disclaimer.

I will post with info on how to get it turned on.
 
Old 11-14-2009, 07:26 PM   #7
kevinslair
LQ Newbie
 
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17

Original Poster
Rep: Reputation: 0
Ok,
Here is the code I used to get the auto signature disclaimer working:

/etc/postfix/

main.cf:

Code:
content_filter=amavisfeed:[127.0.0.1]:10024
smtp_send_xforward_command = yes
smtpd_authorized_xforward_hosts = $mynetworks
master.cf:

Code:
# Added 11/14/09 for amavis support
#[...]


amavisfeed unix    -       -       n       -       2     smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

127.0.0.1:10025 inet n    -       n       -       -     smtpd
     -o content_filter=
     -o smtpd_delay_reject=no
     -o smtpd_client_restrictions=permit_mynetworks,reject
     -o smtpd_helo_restrictions=
     -o smtpd_sender_restrictions=
     -o smtpd_recipient_restrictions=permit_mynetworks,reject
     -o smtpd_data_restrictions=reject_unauth_pipelining
     -o smtpd_end_of_data_restrictions=
     -o smtpd_restriction_classes=
     -o mynetworks=127.0.0.0/8
     -o smtpd_error_sleep_time=0
     -o smtpd_soft_error_limit=1001
     -o smtpd_hard_error_limit=1000
     -o smtpd_client_connection_count_limit=0
     -o smtpd_client_connection_rate_limit=0
     -o
receive_override_options=no_header_body_checks,no_unknown_recipient_checks
     -o local_header_rewrite_clients=
     -o smtpd_milters=
     -o local_recipient_maps=
     -o relay_recipient_maps=
     -o smtp_send_xforward_command=yes
     -o disable_dns_lookups=yes
     -o local_header_rewrite_clients=
     -o smtpd_milters=



# END Added for amavis support







/etc/amavisd/

amavisd.conf:


find: MYNETS policy bank:

Code:
$allow_disclaimers = 1;
$terminate_dsn_on_notify_success = 1;
$policy_bank{'MYNETS'} = {  # mail originating from @mynetworks
#   terminate_dsn_on_notify_success => 0,
#   spam_kill_level_maps => 6.9,
#   syslog_facility => 'LOCAL4',  # tell syslog to log to a separate
file
#   virus_admin_maps => ["virusalert\@$mydomain"], # alert of internal
viruses
#   spam_admin_maps  => ["spamalert\@$mydomain"],  # alert of internal
spam
#   bypass_spam_checks_maps   => [1],  # or: don't spam-check internal
mail
#   bypass_banned_checks_maps => [1],  # don't banned-check internal
mail
#   warnbadhsender => 1,  # warn local senders about their broken MUA
#   banned_filename_maps => ['MYNETS-DEFAULT'], # more permissive
banning rules
#   spam_quarantine_cutoff_level_maps => undef, # quarantine all local
spam
#   spam_dsn_cutoff_level_maps => undef,  # ensure NDN regardless of
spam level
#   spam_dsn_cutoff_level_bysender_maps => # but only from local domain
senders


  originating => 1,
  allow_disclaimers => 1,

#     [ { lc(".$mydomain") => undef,  '.' => 15 } ],



};

@altermime_args_disclaimer =
  qw(--verbose  --disclaimer=/var/spool/amavisd/disclaimer.txt \
--disclaimer-html=/var/spool/amavisd/disclaimer.html);
  $defang_maps_by_ccat{+CC_CLEAN} = [ 'disclaimer' ];


/var/spool/amavisd/

disclaimer.txt

text message here.




disclaimer.html


Code:
<p>html disclaimer message here</p>


Just edit the txt and html disclaimer file to what you would like it to say.

Thanks,
Kevin
 
  


Reply

Tags
postfix


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
postfix+amavisd megerdin Linux - Security 8 10-10-2007 09:38 PM
amavisd and postfix saavik Linux - Networking 4 10-27-2006 07:10 PM
Spamassassin setup with Postfix, Dovecot and Amavisd snurckle Linux - General 2 04-07-2005 12:16 PM
Postfix - amavisd (?) localhost.com joseph_1970 Linux - Software 1 02-13-2004 05:42 PM
Postfix/amavisd-new virus scaning only thesnaggle Linux - Software 0 12-16-2003 10:08 AM


All times are GMT -5. The time now is 05:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration