title: Postfix cannot get RSA private key from file /etc/ssl/private/server.key: disabling TLS support
body: <p>I installed a postfix mail server. But it is wrong when I use thunderbird to login a user.
  This is configuration.</p>
  
  <p><strong>Postconf -n:</strong></p>
  
  <pre><code>alias_database = hash:/etc/aliases
  alias_maps = hash:/etc/aliases
  broken_sasl_auth_clients = yes
  command_directory = /usr/sbin
  config_directory = /etc/postfix
  daemon_directory = /usr/libexec/postfix
  data_directory = /var/lib/postfix
  debug_peer_level = 2
  home_mailbox = Maildir/
  html_directory = no
  inet_interfaces = all
  inet_protocols = all
  mail_owner = postfix
  mailbox_size_limit = 20000000000
  mailq_path = /usr/bin/mailq.postfix
  manpage_directory = /usr/share/man
  message_size_limit = 200000000
  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
  mydomain = stack.daolicloud.com
  myhostname = mail.stack.daolicloud.com
  mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
  myorigin = $mydomain
  newaliases_path = /usr/bin/newaliases.postfix
  queue_directory = /var/spool/postfix
  readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
  relay_domains = $mydestination
  relayhost =
  sample_directory = /usr/share/doc/postfix-2.6.6/samples
  sendmail_path = /usr/sbin/sendmail.postfix
  setgid_group = postdrop
  smtp_tls_note_starttls_offer = yes
  smtpd_helo_required = yes
  smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
  smtpd_sasl_auth_enable = yes
  smtpd_sasl_authenticated_header = yes
  smtpd_sasl_local_domain = $myhostname
  smtpd_sasl_path = private/auth
  smtpd_sasl_security_options = noanonymous
  smtpd_sasl_type = dovecot
  smtpd_sender_restrictions = reject_unknown_sender_domain
  smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
  smtpd_tls_auth_only = no
  smtpd_tls_cert_file = /etc/ssl/certs/cacert.pem
  smtpd_tls_key_file = /etc/ssl/private/server.key
  smtpd_tls_loglevel = 1
  smtpd_tls_received_header = yes
  smtpd_tls_session_cache_timeout = 3600s
  smtpd_use_tls = yes
  tls_random_source = dev:/dev/urandom
  unknown_local_recipient_reject_code = 550
  </code></pre>
  
  <p><strong>dovecot -n:</strong></p>
  
  <pre><code># 2.0.9: /etc/dovecot/dovecot.conf
  # OS: Linux 2.6.32-431.1.2.0.1.el6.x86_64 x86_64 CentOS release 6.4 (Final) 
  auth_mechanisms = plain login
  mail_location = maildir:~/Maildir
  mail_privileged_group = mail
  mbox_write_locks = fcntl
  passdb {
    driver = pam
  }
  protocols = imap pop3
  service auth {
    unix_listener /var/spool/postfix/private/auth {
      mode = 0666
      user = postfix
    }
  }
  service imap-login {
    inet_listener imap {
      port = 143
      ssl = yes
    }
    inet_listener imaps {
      port = 993
      ssl = yes
    }
  }
  ssl_cert = &lt;/etc/ssl/certs/cacert.pem
  ssl_key = &lt;/etc/ssl/private/server.key
  userdb {
    driver = passwd
  }
  </code></pre>
  
  <p>And this is log:</p>
  
  <pre><code> dovecot: imap-login: Fatal: Can't load private ssl_key: Key is for a different cert than ssl_cert
  dovecot: master: Error: service(imap-login): command startup failed, throttling
  dovecot: pop3-login: Fatal: Can't load private ssl_key: Key is for a different cert than ssl_cert
  dovecot: master: Error: service(pop3-login): command startup failed, throttling
  postfix/smtpd[13891]: warning: cannot get RSA private key from file /etc/ssl/private/server.key: disabling TLS support
  postfix/smtpd[13891]: warning: TLS library problem: 13891:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:x509_cmp.c:331:
  postfix/smtpd[13893]: warning: cannot get RSA private key from file /etc/ssl/private/server.key: disabling TLS support
  postfix/smtpd[13893]: warning: TLS library problem: 13893:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:x509_cmp.c:331:
  postfix/smtpd[13894]: warning: cannot get RSA private key from file /etc/ssl/private/server.key: disabling TLS support
  postfix/smtpd[13894]: warning: TLS library problem: 13894:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:x509_cmp.c:331:
  postfix/smtpd[13895]: warning: cannot get RSA private key from file /etc/ssl/private/server.key: disabling TLS support
  postfix/smtpd[13895]: warning: TLS library problem: 13895:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:x509_cmp.c:331:
  </code></pre>
  
  <p>I think the <code>pem</code> and <code>key</code> file were wrong. So I generate this files again followed by <a href="https://help.ubuntu.com/10.04/serverguide/certificates-and-security.html" rel="nofollow">this link</a>. But it still goes the same error. Any ideas? Could someone helps me? Thanks a lot!</p>