OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Block sender based on IP

From: Banyan He (banyanrootong.com)
Date: Tue Oct 16 2007 - 05:17:24 CDT


Hi Simone,

I think this is what you want.

       /etc/postfix/main.cf:
           smtpd_client_restrictions =
               check_client_access mysql:/etc/postfix/access

       /etc/postfix/access:
           1.2.3 REJECT
           1.2.3.4 OK

Simone Felici wrote:
> Hi to all,
>
> I've implemented a db query on SQL database to ban unauthorized
> sender. I use this to block spam from some email-addresses.
> main.cf:
>
> smtpd_sender_restrictions =
> check_sender_access mysql:/etc/postfix/mysql_check_blacklist.cf,
> # for MySQL
> # check_sender_access hash:/etc/postfix/hash_check_blacklist,
> # for file db
> permit
>
> This works with hash file, example:
>
> address1domain1.com REJECT
> address2domain2.com REJECT
> address3domain3.com REJECT
> address4domain4.com REJECT
>
> or on database with query like this:
>
> user = <username>
> password = <password>
> hosts = <host>
> dbname = <database>
> query = SELECT action FROM banned where domain='%d' and
> account='%u'
>
>
> How can I implement a check to ban requests from an IP address or from
> a net instead from an email-address?
> I've tested with:
>
> IPADDRESS REJECT
>
> into the same hash_check_blacklist with no success :(
> An example would be apreciated, overall to compose a right query. I
> can send the domain (%d), the account (%u) but no idea how send the IP
> of the sender to compose a query.
>
>
> Thank's in advice!
>
> Simon
>
>

--
Banyan He
Mail&Web Security
Mobile: +86 13641777622
MSN: banyan.hehotmail.com
Skype: banyan.he
Email: banyanrootong.com
AntiSpam Test: antispammail.rootong.com
AntiVirus Test: antivirusmail.rootong.com
Wemaster Mail: webmastermail.rootong.com
Website: http://www.rootong.com