{"id":4688,"date":"2017-10-18T14:50:40","date_gmt":"2017-10-18T12:50:40","guid":{"rendered":"https:\/\/contabo.com\/blog\/?p=4688"},"modified":"2021-06-30T15:22:56","modified_gmt":"2021-06-30T13:22:56","slug":"hmailserver-security","status":"publish","type":"post","link":"https:\/\/contabo.com\/blog\/hmailserver-security\/","title":{"rendered":"E-mail server in Windows Server, part 2: Security"},"content":{"rendered":"<p>This is a follow-up to the tutorial <a href=\"https:\/\/contabo.com\/blog\/install-e-mail-server-windows\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to install an e-mail server in Windows<\/a>, directed to those <strong>who already have an hMailserver and want to increase the security<\/strong>.<\/p>\n<p><strong>Spam protection<\/strong><\/p>\n<p>To activate the spam protection, please go to Settings &gt;&gt; Anti-spam in the hMailserver Administrator.<\/p>\n<p>In the tab &#8220;General&#8221; you can leave the settings the way they are, as shown in the image. Of course you can adjust them later according to your needs.<\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/spam.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4561\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/spam-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/spam-300x225.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/spam-768x576.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/spam.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the second tab &#8220;Spam tests&#8221; you should select all four spam detection parameters:<\/p>\n<p>&#8211; Use SPF (3)<br \/>\n&#8211; Check host in the HELO command (2)<br \/>\n&#8211; Check that sender has DNS-MX records (2)<br \/>\n&#8211; Verify DKIM-Signature header (5)<\/p>\n<p><strong>Malware protection<\/strong><\/p>\n<p>As already mentioned in the previous tutorial, you have the possibility to use different anti malware software in hMailServer. The most easy solution is to use the free ClamWin anti virus scanner. You can download it there:<\/p>\n<p><a href=\"https:\/\/sourceforge.net\/projects\/clamwin\/\" rel=\"nofollow\">https:\/\/sourceforge.net\/projects\/clamwin\/<\/a><\/p>\n<p>Please follow the installation wizard. Installing the browser extension is not required for your e-mail server. Normally ClamWin will now appear in the Windows system tray and start to update its database once a day. It will also protect your system from malware. You are of course free to change those settings individually in the ClamWin menu. The integration in the hMailServer is easy. Please go to Settings &gt;&gt; Anti-Virus &gt;&gt; ClamWin. The button &#8220;autodetect&#8221; will find the correct path to your ClamWin anti virus installation and you can finish the setup with &#8220;Save&#8221;.<\/p>\n<p><strong>TLS encryption<\/strong><\/p>\n<p>To enable your clients to start an encrypted connection to your server, so nobody can steal your data, you have to enable this in your settings first. You will need an SSL certificate to achieve this. If you do not have already one for the host name of your server, you can create a self signed one on your own. Self signed certificates are free. But you will have to add an exception manually each time you set up a new client for your server. Most clients like Thunderbird or Outlook will ask you for that after the credentials got entered and they start the first connection. You can use XCA to create such a certificate:<\/p>\n<p><a href=\"https:\/\/sourceforge.net\/projects\/xca\/\" rel=\"nofollow\">https:\/\/sourceforge.net\/projects\/xca\/<\/a><\/p>\n<p>After the software got installed and opened, you have to create a new database on the upper left side. You can choose any name, you do not even have to remember the password. We will need this tool only once to create the new certificate. You can remove it again afterwards.<\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/new-Database.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4563\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/new-Database-300x241.png\" alt=\"\" width=\"300\" height=\"241\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/new-Database-300x241.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/new-Database.png 717w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>After the new database got created you can choose the tab &#8220;Certificates&#8221;. In the following menu please choose &#8220;New Certificate&#8221; on the right side. A new window will open. In this new window please choose the tab &#8220;Subject&#8221; and add your host name next to &#8220;commonName&#8221;. In our example screenshot this is mail.yourdomain.com. Now please create a key for the certificate by pressing the button &#8220;Generate a new key&#8221;. The options in the window normally will be\u00a0 inserted correctly per default as shown in the image. You can finish the creation with &#8220;create&#8221;.<\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4565\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate-300x174.png\" alt=\"\" width=\"300\" height=\"174\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate-300x174.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate-1024x594.png 1024w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate-768x445.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificate.png 1168w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The next step is to switch to the tab &#8220;Extensions&#8221;. Enter a date until the certificate will be valid. You can be generous at this point. In our example we set a date in the year 2030 for &#8220;Validity not after&#8221;. With the &#8220;OK&#8221; button in the bottom right corner you will finally create the certificate.<\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/duration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4567\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/duration-300x277.png\" alt=\"\" width=\"300\" height=\"277\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/duration-300x277.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/duration.png 730w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now you have to export the certificate and the according key. Please choose in the tab &#8220;Certificates&#8221; the certificate and click on &#8220;Export&#8221; on the right side. You can let the path the way it is. In our case it is:<\/p>\n<p style=\"text-align: left;\"><span style=\"color: #008000;\">C:\\Program Files (x86)\\xca\\mail.yourdomain.com.crt<\/span><\/p>\n<p>In the tab &#8220;Private Keys&#8221; please do the same for the previously created key. The path should be:<\/p>\n<p style=\"text-align: left;\"><span style=\"color: #008000;\">C:\\Program Files(x86)\\xca\\mail.yourdomain.com.pem<\/span><\/p>\n<p>Please open the hMailServer Administrator and navigate to Settings &gt;&gt; Advanved &gt;&gt; SSL certificates and click on &#8220;Add&#8221;. Now you have to add the previously exported certificate and key as shown in the image below and save the settings.<\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificates.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4570\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificates-300x226.png\" alt=\"\" width=\"300\" height=\"226\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificates-300x226.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificates-768x578.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/certificates.png 801w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>For the last step please go to Settings &gt;&gt; Advanced &gt;&gt; TCP\/IP ports. There you have to modify the three entries below &#8220;0.0.0.0 \/ 25 \/ SMTP&#8221; as shown in the following images. At &#8220;SSL Certificate&#8221;, please choose your recently created certificate. &#8220;0.0.0.0 \/ 25 \/ SMTP&#8221; has to stay in its original state as the only one. If you change it, your e-mail server will not work properly!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4574\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/25-300x224.png\" alt=\"\" width=\"300\" height=\"224\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/25-300x224.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/25-768x573.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/25.png 799w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/465.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4575\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/465-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/465-300x225.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/465-768x576.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/465.png 799w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/993.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4576\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/993-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/993-300x225.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/993-768x575.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/993.png 801w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-4577\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/995-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/995-300x225.png 300w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/995-768x576.png 768w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2017\/06\/995.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Now you have to open the new ports in your firewall. For that you can edit the rule from the previous tutorial. We called it &#8220;Ports for hMailServer&#8221; there. Please change the &#8220;local ports&#8221; from 25, 110, 143, 587 to 25, 465, 993, 995. (Windows Firewall with Advanced Security on Local computer &gt;&gt; Inbound Rules &gt;&gt; Ports for hMailServer &gt;&gt; Protocols and Ports)<\/p>\n<p>The settings for your clients have changed too:<\/p>\n<p><em>ingoing server:<br \/>\n<\/em><\/p>\n<p>protocol: IMAP; port: 143; security: SSL\/TLS; server: the IP or hostname of your server<\/p>\n<p><em>outgoing server:<\/em><\/p>\n<p>protocol: SMTP; port: 587; security: SSL\/TLS; server: the IP or hostname of your server<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a follow-up to the tutorial How to install an e-mail server in Windows, directed to those who already have an hMailserver and want to increase the security. Spam protection To activate the spam protection, please go to Settings &gt;&gt; Anti-spam in the hMailserver Administrator. In the tab &#8220;General&#8221; you can leave the settings [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[18],"tags":[254,265,301,422,719,894,942],"ppma_author":[1494],"class_list":["post-4688","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-dedicated-server","tag-dedizierte-server","tag-e-mail-server","tag-hmailserver","tag-root-server","tag-vps","tag-windows-server"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Johannes","author_link":"https:\/\/contabo.com\/blog\/author\/johannes\/"},"uagb_comment_info":0,"uagb_excerpt":"This is a follow-up to the tutorial How to install an e-mail server in Windows, directed to those who already have an hMailserver and want to increase the security. Spam protection To activate the spam protection, please go to Settings &gt;&gt; Anti-spam in the hMailserver Administrator. In the tab &#8220;General&#8221; you can leave the settings&hellip;","authors":[{"term_id":1494,"user_id":23,"is_guest":0,"slug":"johannes","display_name":"Johannes","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/0a7d28963f0d24426df1d30365c93b64858f4d4b75a123dcb2d6b0c49f2dcda4?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/4688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/comments?post=4688"}],"version-history":[{"count":0,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/4688\/revisions"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=4688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=4688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=4688"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=4688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}