{"id":1189,"date":"2017-02-24T10:51:31","date_gmt":"2017-02-24T15:51:31","guid":{"rendered":"http:\/\/easy-admin.ca\/?p=1189"},"modified":"2017-02-24T10:51:31","modified_gmt":"2017-02-24T15:51:31","slug":"cram-md5-authentication-for-dovecot","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2017\/02\/24\/cram-md5-authentication-for-dovecot\/","title":{"rendered":"CRAM-MD5 authentication for Dovecot"},"content":{"rendered":"<p class=\"line874\">This entry documents the basic process for setting up CRAM-MD5 authentication for Dovecot. <span id=\"line-3\" class=\"anchor\"><\/span><span id=\"line-4\" class=\"anchor\"><\/span><\/p>\n<p class=\"line862\">Firstly, you need to enable the mechanism and specify a passwd database file in Dovecot. The mechanism and passdb file are specified in the <tt>dovecot.conf<\/tt> configuration file, on a Red Hat or similar system this is located in the <tt>\/usr\/local\/etc\/<\/tt> directory. <span id=\"line-5\" class=\"anchor\"><\/span><span id=\"line-6\" class=\"anchor\"><\/span><\/p>\n<pre><span id=\"line-1\" class=\"anchor\"><\/span># Space separated list of wanted authentication mechanisms:\r\n<span id=\"line-2\" class=\"anchor\"><\/span># plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi\r\n<span id=\"line-3\" class=\"anchor\"><\/span>auth_mechanisms = plain login cram-md5\r\n<span id=\"line-4\" class=\"anchor\"><\/span>\r\n<span id=\"line-5\" class=\"anchor\"><\/span># passwd-like file with specified location \r\n<span id=\"line-6\" class=\"anchor\"><\/span>passdb { \r\n<span id=\"line-7\" class=\"anchor\"><\/span>  driver = passwd-file\r\n<span id=\"line-8\" class=\"anchor\"><\/span>  # Path for passwd-file. Also set the default password scheme.\r\n<span id=\"line-9\" class=\"anchor\"><\/span>  args = scheme=cram-md5 \/etc\/cram-md5.pwd \r\n<span id=\"line-10\" class=\"anchor\"><\/span>}<\/pre>\n<p class=\"line862\">You see that I\u2019ve added the cram-md5 mechanism to the <tt>mechanisms<\/tt> statement and then added a passdb file, <tt>\/etc\/cram-md5.pwd<\/tt>. <span id=\"line-20\" class=\"anchor\"><\/span><span id=\"line-21\" class=\"anchor\"><\/span><\/p>\n<p class=\"line874\">Next, you need to create this passdb file and set appropriate permissions. <span id=\"line-22\" class=\"anchor\"><\/span><span id=\"line-23\" class=\"anchor\"><\/span><\/p>\n<pre><span id=\"line-1-1\" class=\"anchor\"><\/span># touch \/etc\/cram-md5.pwd \r\n<span id=\"line-2-1\" class=\"anchor\"><\/span># chmod 0600 \/etc\/cram-md5.pwd<\/pre>\n<p class=\"line874\">After creating the file you need to add your users and hashed passwords to the passdb file. The users and passwords are added in the format: <span id=\"line-29\" class=\"anchor\"><\/span><span id=\"line-30\" class=\"anchor\"><\/span><\/p>\n<pre><span id=\"line-1-2\" class=\"anchor\"><\/span>username:passwordhash<\/pre>\n<p class=\"line874\">You can generate password hashes using &#8220;doveadm pw&#8221;: <span id=\"line-35\" class=\"anchor\"><\/span><span id=\"line-36\" class=\"anchor\"><\/span><\/p>\n<pre><span id=\"line-1-3\" class=\"anchor\"><\/span># doveadm pw\r\n<span id=\"line-2-2\" class=\"anchor\"><\/span>Enter new password: password\r\n<span id=\"line-3-1\" class=\"anchor\"><\/span>Retype new password: password\r\n<span id=\"line-4-1\" class=\"anchor\"><\/span>{CRAM-MD5}26b633ec8bf9dd526293c5897400bddeef9299fad<\/pre>\n<p class=\"line862\">Enter the user\u2019s password when prompted and it will be converted and outputted as a hash. The default hashed output is in the CRAM-MD5 scheme. You can change the scheme of the outputted hashes using the <tt>-s<\/tt> command line switch. <span id=\"line-44\" class=\"anchor\"><\/span><span id=\"line-45\" class=\"anchor\"><\/span><\/p>\n<p class=\"line862\">Now add the generated password to the passdb file, <tt>\/etc\/cram-md5.pwd<\/tt>. <span id=\"line-46\" class=\"anchor\"><\/span><span id=\"line-47\" class=\"anchor\"><\/span><\/p>\n<pre><span id=\"line-1-4\" class=\"anchor\"><\/span>username:26b633ec8bf9dd526293c5897400bddeef9299fad<\/pre>\n<p class=\"line874\">Finally, restart Dovecot and test authentication by enabling the appropriate mechanism in your email client. For example, to enable CRAM-MD5 authentication in Thunderbird you need to check the \u201cUse secure authentication\u201d checkbox in the Account Settings page. <span id=\"line-52\" class=\"anchor\"><\/span><span id=\"line-53\" class=\"anchor\"><\/span><\/p>\n<p class=\"line874\">I recommend that you also use TLS\/SSL to encrypt the authentication process as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This entry documents the basic process for setting up CRAM-MD5 authentication for Dovecot. Firstly, you need to enable the mechanism and specify a passwd database file in Dovecot. The mechanism and passdb file are specified in the dovecot.conf configuration file, on a Red Hat or similar system this is located in the \/usr\/local\/etc\/ directory. # &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2017\/02\/24\/cram-md5-authentication-for-dovecot\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">CRAM-MD5 authentication for Dovecot<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"CRAM-MD5 authentication for Dovecot - HP Server","description":"This entry documents the basic process for setting up CRAM-MD5 authentication for Dovecot. Firstly, you need to enable the mechanism and specify a passwd databa"},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1189","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/1189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=1189"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/1189\/revisions"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=1189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=1189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=1189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}