LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-05-2005, 04:19 PM   #1
jrafalek
LQ Newbie
 
Registered: Dec 2004
Posts: 20

Rep: Reputation: 0
content filter in postfix


Hi.
I try to configure postfix to check content per content_filter
my main.cf:

alias_database=hash:/usr/local/etc/postfix/aliases
alias_maps =hash:/usr/local/etc/postfix/aliases
command_directory = /usr/local/sbin
config_directory=/usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix

debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5

debug_peer_level = 3

default_destination_concurrency_limit = 10
disable_vrfy_command = yes

# header_checks = mysql:/usr/local/etc/postfix/mysql_virtual_header_maps.cf
header_checks = regexp:/usr/local/etc/postfix/header_checks

# header_checks = mysql:/usr/local/etc/postfix/mysql_virtual_header_maps.cf, re gexp:/usr/local/etc/postfix/header_checks,

# hash_queue_depth = 1
# hash_queue_names = incoming, active,deferred,bounce,defer,flush,hold

home_mailbox=Maildir/

inet_interfaces = all
local_destination_concurrency_limit = 2
mail_name=Postfix
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_size_limit = 102400000
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
maximal_queue_lifetime=3d
# message_size_limit = 51200000
message_size_limit = 0
mydomain=abc.kom.pl
myhostname = 78-tor-7.acn.waw.pl
myorigin = $myhostname
mynetworks = 192.168.1.0/24, 127.0.0.1
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
queue_run_delay=30m
readme_directory = no
relay_domains = 127.0.0.0/8
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtpd_banner = Fuck you yellow Taiwanese spammer!
broken_sasl_auth_clients = yes

smtpd_client_restrictions =
reject_unknown_sender_domain,
reject_rbl_client rbl.rafi.pl.eu.org

smtpd_error_sleep_time = 3

smtpd_hard_error_limit = 5

smtpd_recipient_limit=10

smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination
# check_recipient_access mysql:/usr/local/etc/postfix/mysql-virt-userspam.cf,

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain =

smtpd_sasl_security_options = noanonymous

smtpd_sender_restrictions = reject_unknown_sender_domain

smtpd_soft_error_limit = 3

unknown_local_recipient_reject_code = 450

virtual_alias_maps=mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf

virtual_gid_maps=static:125

virtual_mailbox_base=/usr/local/virtual

virtual_mailbox_domains=mysql:/usr/local/etc/postfix/mysql_virtual_domains_maps. cf

virtual_mailbox_maps=mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_mailbox_limit=102200000

# virtual_transport=courier
virtual_transport=virtual

transport_maps=mysql:/usr/local/etc/postfix/mysql_virtual_transport.cf

virtual_uid_maps=static:125

# dodane

virtual_create_maildirsize = yes

virtual_mailbox_extended = yes
virtual_maildir_extended = yes

virtual_mailbox_limit_maps = mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_ limit_maps.cf

virtual_mailbox_limit_override = yes

virtual_mailbox_limit_message = Użytkownik przekroczył rozmiar swojej skrzynki. Prosimy spróbować później. / User quota is exceed. Please try again later.
virtual_maildir_limit_message = Użytkownik przekroczył rozmiar swojej skrzynki. Prosimy spróbować później. / User quota is exceed. Please try again later.

virtual_overquota_bounce = yes

virtual_mailbox_limit_inbox = yes


debug_peer_level = 2

html_directory = no

hash_queue_names= incoming, active, deffered, bounce, defer, flush, hold
hash_queue_depth=1


reject_non_fqdn_hostname = yes
# reject_unknown_hostname = yes
reject_invalid_hostname = yes
# reject_naked_ip_address = yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_helo_restrictions =
permit_mynetworks,
check_helo_access hash:/usr/local/etc/postfix/helo_access,
permit

# reject_invalid_hostname, permit
body_checks=regexp:/usr/local/etc/postfix/body_checks

content_filter=filter


my master.cf:

smtp inet n - n - - smtpd
-o content_filter=filter:dummy
filter unix - n n - 10 pipe
flags=Rq user=filter argv=/test/spamnowy/filter -f ${sender} -- ${recipient}
#
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 nqmgr
#tlsmgr fifo - - n 300 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
-o content_filter=filter:dummy
relay unix - - n - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - - local
virtual unix - n n - - virtual

and my filter in /test/spamnowy/

#!/bin/sh

# Simple shell-based filter. It is meant to be invoked as follows:
# /path/to/script -f sender recipients...

# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -i"

# 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 exists; exit $EX_TEMPFAIL; }

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

# Specify your content filter here.
# filter < in.$$ || {
# echo Message content rejected; exit $EX_UNAVAILABLE; }

$SENDMAIL "$@" < in.$$

exit $?

when postfix receive mail message loops in queue and is not deliver to mailbox.
Why and how to fix it?
 
  


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
Content Filter for Firefox ubuntu-addict General 5 01-06-2005 01:25 PM
Which Content Filter? jabird Linux - Networking 1 10-11-2004 06:09 PM
Internet content filter Bamse123 Linux - Software 4 12-31-2003 08:33 PM
Sendmail Filter Content Question shelby Linux - Software 1 06-13-2003 04:25 AM
content filter on firewall Nerun Linux - Security 3 02-21-2002 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:30 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
Open Source Consulting | Domain Registration