Problems with opendkim and postfix centos

centos5dkimpostfix

Hi im having problems with opendkim signing mail. check my log. i fixed the permission issue by chowning that file. but still emails are not being signed. any clues? running on centos5 with postfix/opendkim,dovecot

Jul 22 05:25:03 veepiz postfix/smtpd[3837]: > localhost[127.0.0.1]: 354 End data with <CR><LF>.<CR><LF>
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: public/cleanup socket: wanted attribute: status
Jul 22 05:25:03 veepiz postfix/cleanup[3846]: 72B3E16400B: message-id=<201107220525.p6M5P2l4003833@veepiz.com>
Jul 22 05:25:03 veepiz opendkim[2681]: can't load key from /etc/mail/dkim/keys/veepiz.com/default: Permission denied
Jul 22 05:25:03 veepiz opendkim[2681]: (unknown-jobid): error loading key 'default._domainkey.veepiz.com'
Jul 22 05:25:03 veepiz postfix/cleanup[3846]: 72B3E16400B: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.7.1 Service unavailable - try again later; from=<apache@veepiz.com> to=<apache@veepiz.com> proto=ESMTP helo=<veepiz.com>
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: input attribute name: status
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: input attribute value: 256
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: public/cleanup socket: wanted attribute: reason
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: input attribute name: reason
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: input attribute value: 4.7.1 Service unavailable - try again later
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: public/cleanup socket: wanted attribute: (list terminator)
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: input attribute name: (end)
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: > localhost[127.0.0.1]: 451 4.7.1 Service unavailable - try again later
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: abort all milters
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: milter8_abort: abort milter inet:127.0.0.1:20209
Jul 22 05:25:03 veepiz sendmail[3833]: p6M5P2l4003833: to=apache, ctladdr=apache (48/48), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30429, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.7.1 Service unavailable - try again later
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: < localhost[127.0.0.1]: QUIT
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: > localhost[127.0.0.1]: 221 2.0.0 Bye
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: match_hostname: localhost ~? 198.168.0.0/24
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: match_hostaddr: 127.0.0.1 ~? 198.168.0.0/24
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: match_hostname: localhost ~? 127.0.0.0/8
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: abort all milters
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: milter8_abort: abort milter inet:127.0.0.1:20209
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: disconnect event to all milters
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: milter8_disc_event: quit milter inet:127.0.0.1:20209
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: disconnect from localhost[127.0.0.1]
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: master_notify: status 1
Jul 22 05:25:03 veepiz postfix/smtpd[3837]: connection closed

here is output from postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
milter_default_action = accept
milter_protocol = 2
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
myhostname = mail.veepiz.com
mynetworks = 198.168.0.0/24, 127.0.0.0/8
myorigin = veepiz.com
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = inet:127.0.0.1:20209
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
relay_domains =
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_milters = inet:127.0.0.1:20209
unknown_local_recipient_reject_code = 550

Best Answer

Looks like you may still have the wrong permissions on your keyfile. Chowning isn't enough, it must also be chmodded to 700.

Here's a step-by-step walkthrough for setting up OpenDKIM on a CentOS box with Postfix:

http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/

Follow those steps exactly and you'll be signing mail in no time.