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
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
11-04-2009, 05:43 PM
#1
LQ Newbie
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17
Rep:
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
11-08-2009, 12:53 AM
#2
Member
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164
Rep:
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.
11-08-2009, 05:00 AM
#3
LQ Newbie
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17
Original Poster
Rep:
/usr/bin/altermime is owned by root with user root.
Should this be changed to root:filter?
11-09-2009, 12:44 AM
#4
Member
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164
Rep:
Quote:
Originally Posted by
kevinslair
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?
11-09-2009, 04:07 AM
#5
LQ Newbie
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17
Original Poster
Rep:
No, the file is owned by root:root.
I am going to change it to root:filter and see if that works.
Thanks,
Kevin
11-14-2009, 07:08 PM
#6
LQ Newbie
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17
Original Poster
Rep:
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.
11-14-2009, 07:26 PM
#7
LQ Newbie
Registered: May 2009
Location: Binghamton, NY
Distribution: FC9, FC10, FC11 beta
Posts: 17
Original Poster
Rep:
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
All times are GMT -5. The time now is 06:38 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News