<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[iRedMail — Email handling issue in mail list or postfix]]></title>
		<link>http://www.iredmail.org/forum/topic661-email-handling-issue-in-mail-list-or-postfix.html</link>
		<atom:link href="http://www.iredmail.org/forum/feed-rss-topic661.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Email handling issue in mail list or postfix.]]></description>
		<lastBuildDate>Wed, 03 Mar 2010 09:03:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2854.html#p2854</link>
			<description><![CDATA[<p>can you give me an example of ldapsearch command to search one domain?&nbsp; As I tried to use <br />ldapsearch -h &lt;host&gt; &quot;objectClass=*&quot;<br /> and not work.</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Wed, 03 Mar 2010 09:03:29 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2854.html#p2854</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2850.html#p2850</link>
			<description><![CDATA[<p>You can use &#039;ldapsearch&#039; command. <img src="http://www.iredmail.org/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Wed, 03 Mar 2010 08:10:58 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2850.html#p2850</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2849.html#p2849</link>
			<description><![CDATA[<p>I found a way to do on the postfix directly using restrict_sender.&nbsp; But I would like to know how to get the a domain user list from ldap?&nbsp; Any script or way to do on shell?&nbsp; As I need to generate a script to apply the setting.</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Wed, 03 Mar 2010 08:08:45 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2849.html#p2849</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2847.html#p2847</link>
			<description><![CDATA[<p>You need to be familiar with Python programming language: <a href="http://www.python.org/">http://www.python.org/</a></p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:38:01 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2847.html#p2847</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2846.html#p2846</link>
			<description><![CDATA[<p>I have no idea about the plugin?&nbsp; Also I don&#039;t know how to apply even write this?&nbsp; So I think it&#039;s not easy and not possible to make it by ourselves?</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:36:48 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2846.html#p2846</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2845.html#p2845</link>
			<description><![CDATA[<p>This is just for your reference, you have to write a new plugin to implement what you need.</p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:32:08 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2845.html#p2845</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2844.html#p2844</link>
			<description><![CDATA[<p>I have no idea how to apply on this?&nbsp; where to put domaina.com? where to put domaina.com and domainb.com as allow.&nbsp; And how to apply?&nbsp; Please advice.</p><p>#!/usr/bin/env python<br /># encoding: utf-8</p><p># Author: Zhang Huangbin &lt;michaelbibby (at) gmail.com&gt;</p><p>import sys</p><p>ACTION_REJECT = &#039;REJECT Not Authorized&#039;</p><p>def __get_allowed_senders(ldapConn, ldapBaseDn, listDn, sender, recipient, polic<br />y,):<br />&nbsp; &nbsp; &quot;&quot;&quot;return search_result_list_based_on_access_policy&quot;&quot;&quot;</p><p>&nbsp; &nbsp; # Set search base dn, scope, filter and attribute list based on access polic<br />y.<br />&nbsp; &nbsp; if policy == &#039;membersonly&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; basedn = ldapBaseDn<br />&nbsp; &nbsp; &nbsp; &nbsp; searchScope = 2&nbsp; &nbsp; &nbsp;# ldap.SCOPE_SUBTREE<br />&nbsp; &nbsp; &nbsp; &nbsp; # Filter used to get domain members.<br />&nbsp; &nbsp; &nbsp; &nbsp; searchFilter = &quot;(&amp;(|(objectclass=mailUser)(objectclass=mailExternalUser)<br />)(accountStatus=active)(memberOfGroup=%s))&quot; % (recipient, )<br />&nbsp; &nbsp; &nbsp; &nbsp; searchAttr = &#039;mail&#039;<br />&nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; basedn = listDn<br />&nbsp; &nbsp; &nbsp; &nbsp; searchScope = 0&nbsp; &nbsp; &nbsp;# Use SCOPE_BASE to improve performance.<br />&nbsp; &nbsp; &nbsp; &nbsp; # Filter used to get domain moderators.<br />&nbsp; &nbsp; &nbsp; &nbsp; searchFilter = &quot;(&amp;(objectclass=mailList)(mail=%s))&quot; % (recipient, )<br />&nbsp; &nbsp; &nbsp; &nbsp; searchAttr = &#039;listAllowedUser&#039;</p><p>&nbsp; &nbsp; try:<br />&nbsp; &nbsp; &nbsp; &nbsp; result = ldapConn.search_s(basedn, searchScope, searchFilter, [searchAtt<br />r])<br />&nbsp; &nbsp; &nbsp; &nbsp; userList = []<br />&nbsp; &nbsp; &nbsp; &nbsp; for obj in result:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if obj[1].has_key(searchAttr):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Example of result data:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # [(&#039;dn&#039;, {&#039;listAllowedUser&#039;: [&#039;user@domain.ltd&#039;]})]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # [(&#039;dn&#039;, {&#039;listAllowedUser&#039;: [&#039;user@domain.ltd&#039;]})]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userList += obj[1][searchAttr]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass<br />&nbsp; &nbsp; &nbsp; &nbsp; return userList</p><p>&nbsp; &nbsp; except Exception, e:<br />&nbsp; &nbsp; &nbsp; &nbsp; return []</p><p>def restriction(ldapConn, ldapBaseDn, ldapRecipientDn, ldapRecipientLdif, smtpSe<br />ssionData, **kargs):<br />&nbsp; &nbsp; # Return if recipient is not a mail list object.<br />&nbsp; &nbsp; if &#039;maillist&#039; not in [ v.lower() for v in ldapRecipientLdif[&#039;objectClass&#039;]]:<br />&nbsp; &nbsp; &nbsp; &nbsp; return &#039;DUNNO&#039;</p><p>&nbsp; &nbsp; sender = smtpSessionData[&#039;sender&#039;].lower()<br />&nbsp; &nbsp; recipient = smtpSessionData[&#039;recipient&#039;].lower()<br />&nbsp; &nbsp; policy = ldapRecipientLdif.get(&#039;accessPolicy&#039;, [&#039;public&#039;])[0].lower()</p><p>&nbsp; &nbsp; if policy == &quot;public&quot;: return &#039;DUNNO&#039;&nbsp; &nbsp;# No restriction.<br />&nbsp; &nbsp; elif policy == &quot;domain&quot;:<br />&nbsp; &nbsp; &nbsp; &nbsp; # Bypass all users under the same domain.<br />&nbsp; &nbsp; &nbsp; &nbsp; if sender.split(&#039;@&#039;)[1] == recipient.split(&#039;@&#039;)[1]: return &#039;DUNNO&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; else: return ACTION_REJECT<br />&nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; # Handle other access policies: membersOnly, allowedOnly.<br />&nbsp; &nbsp; &nbsp; &nbsp; allowedSenders = __get_allowed_senders(<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ldapConn=ldapConn,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ldapBaseDn=ldapBaseDn,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listDn=ldapRecipientDn,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sender=sender,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recipient=recipient,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; policy=policy,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if sender.lower() in [ v.lower() for v in allowedSenders ]:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &#039;DUNNO&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return ACTION_REJECT</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:30:25 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2844.html#p2844</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2843.html#p2843</link>
			<description><![CDATA[<p>I&#039;m so sorry that i can&#039;t understand what you mean of case #1.</p><p>For case 2: you have to write your own plugin to implement this feature. if you need a sample plugin, just refer to src/plugins/*.py in iRedAPD source code.</p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:04:04 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2843.html#p2843</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2842.html#p2842</link>
			<description><![CDATA[<p>For case 1, if I want to allow the email address to all maillist, I need to add the email from phpldap?&nbsp; Am I correct?</p><p>For case 2, can you provide an example for me.&nbsp; As I have no idea how to apply this to the system.&nbsp; Thanks.</p><p>For all domaina.com users,&nbsp; receipent != domaina.com and domainb.com, REJECT</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Wed, 03 Mar 2010 04:00:09 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2842.html#p2842</guid>
		</item>
		<item>
			<title><![CDATA[Re: Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2841.html#p2841</link>
			<description><![CDATA[<div class="quotebox"><cite>bongdotcom wrote:</cite><blockquote><p>Case 1: all email receive from &lt;any address&gt; to the server (Something like whitelisting)</p></blockquote></div><p>You can use &#039;mynetworks&#039; in postfix for whitelisting, policyd provides whitelisting feature for external mail servers.</p><div class="quotebox"><cite>bongdotcom wrote:</cite><blockquote><p>Case 2: allow xxx@domaina.com  send to &quot;@domaina.com|@domainb.com.  The other domains are not allow.</p></blockquote></div><p>Not implemented. But should be easy to implement in iRedAPD policy daemon, and use iRedAdmin-Pro to manage it.</p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Wed, 03 Mar 2010 03:08:47 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2841.html#p2841</guid>
		</item>
		<item>
			<title><![CDATA[Email handling issue in mail list or postfix]]></title>
			<link>http://www.iredmail.org/forum/post2794.html#p2794</link>
			<description><![CDATA[<p>I received an update from the client today which is a exim filter file and 90% of rules can be handle by mail list.&nbsp; But I found few rules are in different format.&nbsp; I have simplified it and shown in below.&nbsp; &nbsp;And I would like to know whether we can support it or not.&nbsp; I can send you the full list as it included some audit on outgoing and spam rules.&nbsp; Thanks</p><p>Case 1: all email receive from &lt;any address&gt; to the server (Something like whitelisting)<br />Case 2: allow xxx@domaina.com&nbsp; send to &quot;@domaina.com|@domainb.com.&nbsp; The other domains are not allow.</p>]]></description>
			<author><![CDATA[null@example.com (bongdotcom)]]></author>
			<pubDate>Fri, 26 Feb 2010 06:54:48 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post2794.html#p2794</guid>
		</item>
	</channel>
</rss>
