Postfix with dkfilter (DomainKeys Implementation)
|
Submitted by sohaileo (Contact Author) (Forums) on Mon, 2006-12-04 12:42. :: Anti-Spam/Virus | Postfix
Postfix with dkfilter (DomainKeys Implementation)Author: Sohail Riaz <sohail AT fastadmins DOT com> DomainKeys is an anti-spam software application in development at Yahoo that uses a form of public key cryptography to authenticate the sender's domain. dkfilter is an SMTP-proxy designed for Postfix. It implements DomainKeys message signing and verification. It comprises two separate filters, an "outbound" filter for signing outgoing email on port 587, and an "inbound" filter for verifying signatures of incoming email on port 25. This document is to describe step by step how to install dkfilter for postfix to deploy domainkeys signing and verification.
1 Install PostfixInstall postfix for your domain to send and receive mails.
2 Resolving Dependencies - Installing Perl ModulesDkfilter is written in Perl. It requires the following Perl Modules from CPAN archive. * Crypt::OpenSSL::RSA Following commands would help. perl -MCPAN -e'CPAN::Shell->install("Crypt::OpenSSL::RSA")' Note: Also resolve any dependent Perl Module required in installing the above Perl modules.
3 Installing dkfilterThe following steps are recommended for installing dkfilter: i. Download dkfilter from following URL: ii. Installing dkfilter tar xvf dkfilter-0.11.tar.gz The filter scripts will be installed in /usr/local/dkfilter/bin and the Perl module files will be in /usr/local/dkfilter/lib.
4 Setting up Inbound FilterWe need to make relevant changes inside Postfix configuration files to check incoming mails for the signature. vi /etc/postfix/master.cf #
# Before-filter SMTP server. Receive mail from the network and
# pass it to the content filter on localhost port 10025.
#
smtp inet n - n - - smtpd
-o smtpd_proxy_filter=127.0.0.1:10025
-o smtpd_client_connection_count_limit=10
#
# After-filter SMTP server. Receive mail from the content filter on
# localhost port 10026.
#
127.0.0.1:10026 inet n - n - - smtpd
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=
-o mynetworks=127.0.0.0/8
-o receive_override_options=no_unknown_recipient_checks
Insert above lines in the last of the files. Here we define that mail will received after smtp for verification on 127.0.0.1 with port 10026. You can define your own desired IP address on which you want to listen for signature checking.
5 Setting up the outbound filterThe outbound filter needs access to the private key used for signing messages. In addition, in needs to know the name of the key selector being used, and what domain it should sign messages for. This information is specified with command-line arguments to dkfilter.out. 1. Generate a private/public key pair and publish the public key in DNS. cd /usr/local/dkfilter This creates the files private.key and public.key in the current directory, containing the private key and public key. Make sure private.key is not world-readable, but still readable by the dkfilter user. 2. Pick a selector name... e.g. m1 3. Put the public-key data in DNS, in your domain, using the selector name you picked. Copy the contents of the public.key file and remove the PEM header and footer, and paste it in dns zone file by creating a TXT entry, like this: _domainkey.sohailriaz.com IN TXT “t=y; o=-;” m1._domainkey.sohailriaz.com IN TXT "g=; k=rsa; p=MHwwDQYJK ... OprwIDAQAB;" where m1 is the name of the selector chosen in the last step and the p= parameter contains the public-key as one long string of characters. Finally, configure Postfix to filter outgoing, authorized messages only through the dkfilter.out service on port 10027. In the following example, messages sent via SMTP on port 587 (the submission port) will go through an After-Queue content filter that signs messages with DomainKeys. vi /etc/postfix/master.cf #
# modify the default submission service to specify a content filter
# and restrict it to local clients and SASL authenticated clients only
#
submission inet n - n - - smtpd
-o smtpd_etrn_restrictions=reject
-o smtpd_sasl_auth_enable=yes
-o content_filter=dksign:[127.0.0.1]:10027
-o receive_override_options=no_address_mappings
-o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
#
# specify the location of the DomainKeys signing filter
#
dksign unix - - n - 10 smtp
-o smtp_send_xforward_command=yes
-o smtp_discard_ehlo_keywords=8bitmime
#
# service for accepting messages FROM the DomainKeys signing filter
#
127.0.0.1:10028 inet n - n - 10 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
Execute postfix reload for Postfix to respond to changes in /etc/postfix/master.cf. postfix reload
6 Startup ScriptDownload a startup/shutdown script from the following site: Copy that script in /etc/rc.d/init.d and edit it as per your requirement.
7 Referenceshttp://www.postfix.org
|






Recent comments
6 hours 24 min ago
7 hours 17 min ago
7 hours 42 min ago
10 hours 1 min ago
10 hours 20 min ago
10 hours 49 min ago
11 hours 43 min ago
14 hours 4 min ago
14 hours 21 min ago
14 hours 53 min ago