0135.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Advanced Setup of hMailServer E-Mail Server Create and Apply SSL Cert</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="HMailServer,E-Mail Server,Self-Hosted,SSL,PKI,Home Lab,Private Key Infrastructure,Windows,Home Lab Ideas,Certificate Authority,Certificates,Certificate,Encryption,SSL Certificates,Secure Communication,Self-Signed SSL,System Administration,X Certificate And Key Management,X Certificate Key Manager,XCA,Self-Signed PKI,Public Key Infrastructure,System Administrator,SMTP,Mail Server,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Advanced Setup of hMailServer E-Mail Server Create and Apply SSL Cert">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="10/24/2022 10:12:50 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Advanced Setup of hMailServer E-Mail Server Create and Apply SSL Cert</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>Prerequisites</h2>
  26. <ul>
  27. <li class="noCheckbox">A XCA PKI database <a href="https://youtu.be/ezzj3x207lQ" target="_blank">https://youtu.be/ezzj3x207lQ</a></li>
  28. </ul>
  29. <h2>Create Your SSL Certificate</h2>
  30. <ol>
  31. <li>Launch XCA</li>
  32. <li>Open the PKI database if it is not already (File &gt; Open DataBase), enter password</li>
  33. <li>Click on the Certificates tab, right click on your Intermediate CA certificate</li>
  34. <li>Select New</li>
  35. <li>On the Source tab, make sure Use this Certificate for signing is selected</li>
  36. <li>Verify your Intermediate CA certificate is selected from the drop down</li>
  37. <li>Click the Subject tab</li>
  38. <li>Complete the Distinguished Name section
  39. <p>internalName: Email Server SSL<br />
  40. countryName: US<br />
  41. stateOrProvinceName: Virginia<br />
  42. localityName: Northern<br />
  43. organizationName: i12bretro<br />
  44. organizationUnitName: i12bretro Certificate Authority<br />
  45. commonName: smtp.i12bretro.local</p>
  46. </li>
  47. <li>Click the Generate a New Key button</li>
  48. <li>Enter a name and set the key size to at least 2048</li>
  49. <li>Click Create</li>
  50. <li>Click on the Extensions tab</li>
  51. <li>Select End Entity from the type list</li>
  52. <li>Click Edit next to Subject Alternative Name</li>
  53. <li>Add any DNS or IP addresses that the certificate will identify
  54. <p>smtp.domain<br />
  55. imap.domain<br />
  56. pop3.domain</p>
  57. </li>
  58. <li>Update the validity dates to fit your needs</li>
  59. <li>Click the Key Usage tab</li>
  60. <li>Under Key Usage select Digital Signature, Key Encipherment</li>
  61. <li>Under Extended Key Usage select Web Server Authentication</li>
  62. <li>Click the Netscape tab</li>
  63. <li>Select SSL Server</li>
  64. <li>Click OK to create the certificate</li>
  65. </ol>
  66. <h2>Exporting Required Files</h2>
  67. <ol>
  68. <li>In XCA, click on the Certificates tab</li>
  69. <li>Right click the SSL certificate &gt; Export &gt; File</li>
  70. <li>Set the file name with a .crt extension and verify the export format is PEM (*.crt)</li>
  71. <li>Click OK</li>
  72. <li>Click the Private Keys tab</li>
  73. <li>Right click the private key generated for the SSL certificate &gt; Export &gt; File</li>
  74. <li>Set the file name with a .key extension and verify the export format is PEM private (*.pem)</li>
  75. <li>Click OK</li>
  76. </ol>
  77. <h2>Setting Up SSL in hMailServer</h2>
  78. <ol>
  79. <li>Launch hMailServer Administrator</li>
  80. <li>Select localhost &gt; Click Connect &gt; Login with the administrative password</li>
  81. <li>Expand Settings &gt; Advanced &gt; SSL Certificates &gt; Click Add...</li>
  82. <li>Give the certificate a friendly name</li>
  83. <li>Browse to the certificate and key files exported earlier
  84. <p>NOTE: The .crt and .key files need to stay on the file system to be read by hMailServer. I place them in the hMailServer installation directory in a real world scenario</p>
  85. <ul>
  86. </ul>
  87. </li>
  88. <li>Click Save</li>
  89. <li>Expand Settings &gt; Advanced &gt; IP Ranges</li>
  90. <li>Select the LAN IP Range created previously</li>
  91. <li>Check the Require SSL/TLS for authentication box</li>
  92. <li>Click Save</li>
  93. <li>Expand Settings &gt; Advanced &gt; TCP/IP Ports</li>
  94. <li>Click on 0.0.0.0 / 25 / SMTP</li>
  95. <li>Update the port to 465, Select SSL/TLS from the Connection Security dropdown, Select the SSL certificate imported previously</li>
  96. <li>Click Save</li>
  97. <li>Click No to the popup to restart the service</li>
  98. <li>Click on 0.0.0.0 / 143 / IMAP</li>
  99. <li>Update the port to 993, Select SSL/TLS from the Connection Security dropdown, Select the SSL certificate imported previously</li>
  100. <li>Click Save</li>
  101. <li>Click Yesto the popup to restart the service</li>
  102. </ol>
  103. <h2>Setting Up SSL in the Client</h2>
  104. <ol>
  105. <li>Launch Thunderbird</li>
  106. <li>Right click on the e-mail address setup previously &gt; Settings &gt; Server Settings</li>
  107. <li>Set Connection security to SSL/TLS</li>
  108. <li>Verify the port updated to 993</li>
  109. <li>Click Outgoing Server (SMTP)</li>
  110. <li>Set Connection security to SSL/TLS</li>
  111. <li>Verify the port updated to 465</li>
  112. <li>Click OK</li>
  113. <li>Click OK</li>
  114. <li>Click Tools &gt; Options &gt; Advanced &gt; Security &gt; Manage Certificates</li>
  115. <li>Click Import...</li>
  116. <li>Browse to the CA-chain.pem file exported earlier</li>
  117. <li>Click OK</li>
  118. </ol>
  119. <h2>Testing Your New E-Mail Server</h2>
  120. <ol>
  121. <li>In hMailServer Administrator, Expand Utilities &gt; Server sendout</li>
  122. <li>Select Specific domain and select the domain created earlier from the dropdown</li>
  123. <li>Fill out the form to send a test e-mail &gt; Click Send</li>
  124. <li>Back in Thunderbird, click the Get Messages button</li>
  125. <li>The test email should arrive in the inbox</li>
  126. </ol> </div>
  127. </div>
  128. </body>
  129. </html>