Debian mailserver with Postfix & Dovecot + Thunderbird demo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody and welcome to my tutorial / screencast where today I'll be teaching you how to set up a IMAP mail server in debian with the packages postfix and dolf cut we will be authenticating with TLS slash SSL today so without further ado let's get into it I am running a VMware Workstation with a mail client and a mail server the server should always have a static IP so let's open this with our favorite text editor Nano etc network interfaces right here you can see that I've chose a static IP and I've chose Auto eth0 this will make your interface go up and down automatically so let's pick an address a gateway and a netmask for our designer network and let's get out of here every single time you edit the interfaces config file make sure to do a service networking restart this way every single change in the config file will be applied and if we have some patience the service will restart automatically and after restarting the networking service we could do a ifconfig to check if our IP address has been applied and yes so let's see if we can ping that from our mail client ping and then the IP address of the server and yes we can ping from the client to the server let's see if we can do it other way around so my P here is point one point nine so let's bring it from the server to the client and we're off to a good start we can ping both devices so we're in the same network for this tutorial I chose to use a buy nine DNS server so if we go into nano etc bind and then I show you the zone file you'll see that I've made some a records for NS studio mail and mail itself so this is just some basic a records if you're using a DNS server make sure that you do the same thing then we go over to the client and we also make sure that we are using that DNS server so we can resolve every single thing that we just made an a record for so we go to network and we check it for DNS server is the same so we can get out of here and every single time you use bind make sure to also include the zone file in name Kampf which is right here make sure to include the file as you can see right here so so we can go ahead and app get install postfix so we installed the post fake package the - why is just so we don't have to type by ourselves we will be prompted with a screen and we choose internet site right here we enter the qualified domain name that we want so if you want to use Tom at - domain comm we choose to do male com let's go and now postfix will be creating every single config file that we need so we have to be a little patient because we're using TLS and SSL we'll need some certificates so we'll need a private key we also need a certificate sign requests and we will request the certificate itself so let's go ahead and type in open SSL we need to generate an error psyche with the parameter the s3 we want to output that into two domains key so this is our private key we need to enter a pass phrase that we will remember so test123 will need this throughout the whole tutorial so be sure to pick one that you'll remember then we have to set the correct permissions for that file so chmod 602 doumeki we also need to generate a certificate sign request so we go ahead and type in open SSL we request with our private key that is sudo mail key and we output a to doe mail CSR a certificate sign request this way we can request a certificate we need to enter the same pass phrase so test one two three there we go this doesn't really matter so we can skip through it and clear the screen with that certificate sign request we can request an actual certificate so we need to go ahead and type in open SSL x5 9 we need to request a certificate for 365 days so which will count for a whole year and we put in our certificate signed request so tudo mail dot CSR and we will sign that with our private key which is to do mail key and then we will output that to the certificate that we need so tudo mail dot CRT there we go now we have to specify our same passphrase again so right now every single time we want to access our private key we have to specify a passphrase we don't want to do this all the time so we will generate something that is called a no pass so we put in our private key and we want to output that to a tudo mail keno path so that way we don't have to use the passphrase every single time but now we still have to so let's type it in test 1 2 3 there we go let's clear the screen and right now we just have to move that no pass into the original key so move to the method kita no pass into to the mail key right now we still have to create a certificate authority so let's type in open SSL we need to request a new certificate authority so x.509 we want to use the extension version 3 of the certificate authority so version 3 certificate authority and we want to out that into CA keep EEM so we create a key and we also would like to create a certification so see a cert and we want that to last a whole year so days 365 we need to enter passphrase the same passphrase again and this doesn't really matter as I said before so let's skip through it and clear the screen now we still have to set the right permissions for every single file that we made so chmod 602 doumeki we have to do the same thing for CAPM once we're done with the permissions we still have to move every single certificate and key into the right directory so let's go ahead and move to the mail key into etc SSL private we need to move to the mail dot CRT so it is certificate in two etc SSL certs then we still have to move our CA so or certificate authority so let's move CA certificate authority e at PE m in to etc SSL private and then we still have to move our certificate authority certificate itself in to etc SSL certificate there we go once we're done with moving every single file to the right directory we can go ahead and configure postfix so we can do it is with our favorite text editor into etc postfix main CF this is actually the main config files so if we have to apply changes we'll do this in here so let's make sure that we will use my domain and set that to to toe mail comm which is our fully qualified domain name for the email address as well so let's put my origin dollar sign my domain so this is just showing my origin to use the parameter my domain so it's also to do mail calm and since we will be using postfix and dovecot we will be using the same mailbox so we need the right directory so let's specify this by type in in a home mailbox and let's set this to meld ur slash then we also need to specify that we will be using no mailbox command because we won't be using this prop mail so we can put this into comments there we go and leave mailbox underscore command empty we also need to specify some things for SASL so smtp d sa SL and we will say that we will be using dovecot and then we need to specify some authenticating stuff so smtp d SASL path private authentication and then we still have to enable it so let's do this by typing in smtp d SASL authentication enable and then yes so we're all done with this once we're done with editing the main dot C F postfix config we could also just do the same thing with post Kampf - e so perhaps we want to edit some lines in the config but we don't want to open this with our favorite text editor so we can do post Kampf - e and let's say SMTP DTLS oath only no because we will be using SSL as well then we have to specify that we will use TLS for SMTP and SMTP D so both SMTP D and SMTP use TLS yes and we have to specify some other basic SMTP and SMTP D commands as well so SMTP TLS node start TLS offer - yes so we offer a TLS service when we connect to the mail server we also need to specify the private key that we've made so SMTP TLS key and then our file so this is just showing the directory that we've put the keys in so etc SSL private - no mail key and then we also have to specify our certificate that we've generated so cert file is etcetera SSL certs - dome LCR D we also have safai or CA so our certificate authority that we've created so see a file is etc SSL certs /c a third dot PE M then we also have to still configure some basic SMTP TLS stuff like log level we have to enable the log level so we can see the log files we have to put received header one these are just some basic commands that have to be in the conflict work and we also have to do a cache timeout so session cache timeout set to 3600 seconds and that's basically it and then we'll see that all these lines have been added to the postfix main CF so let's go ahead and enter etcetera postfix main dot C F let's scroll to the bottom so those have been added right here but let's check if everything is correct now so we've entered our certification or private these lines have been added let's clear some space right here so we can see the difference between SASL and TLS there we go and everything should be all set just make sure that you pause the video to check if everything is correct for your liking and that's basically it now we can service postfix restart to see if postfix restart without crashing and that's the case and now we can check the status if we have any errors and now it's running perfectly fine we have no errors so that's good right now we can get into installing dovecot so we need the package called doe got common and we also need dog got IMAP D since we're using a IMAP server and then it's Tove Cod of com there we go we need to wait because loaf cut will make every single file that we need our config files will be indiv got comfy which I will show in a quick second so we go into etc dovecot Kumpf d and if we do an LS right here we'll see that every single file that we need is in here so let's start off with 10 - SSL comm we need to specify that we will be using SSL so we have to set required and then we have to set our certification directory and our key directory so let's clear this line and use etc SSL and then certs and let's use or tudo mail the CRT private key which is SSL private - Dudamel key and I messed up so this is CRT alright and everything should be set in this config file so let's get out of there and now we still have to edit some other config files like the authentication right here we have to clear this out so we use plain text out and that's basically it for this file then we still have to configure something in the 10 - master config and right here we have to specify that we will be using postfix with dovecot so we need to find a UNIX listener for postfix here we are so let's take this out of comments and the mode as well and we have to specify our user and our groups so let's use the same indentation user postfix and we also have to use group postfix and that's it so we can exit this file and save what we have just edited and now we still have to configure male comp so here we have to specify that we will be using male they're the same thing as we did in postfix so make sure to comment this line out because if we use melded with postfix we also have to specify that we use male therefore dovecot as well otherwise we will be able to send mails and not receive them or the other way around so inbox yes and then we have to find Mel privilege group if you want to sort which search with nano you can do ctrl W and then search whatever you're looking for so right here male privilege group we have to set this to male so we can access VAR Mel there we go and now we can go ahead and just restart the dovecot service so service dovecot restart it restarts without a problem and we can check status if we have issues or not so we have no issues so postfix end of god are running correctly last thing that we have to do on the server is create users for our mail so let's go ahead and add a user let's say Tom and enter enter we need to specify password so one two three clear this and then we have to add another user let's add the user called Sam another password enter enter and we're done so right now we can go and enter our username and Thunderbird on the mail client so tom at to toe mail comm with the correct password we continue and this should work just fine then we click done and now we will get a pop-up so this is just saying that we are using a certificate that create that we created ourselves so we have to confirm the security exception there we go and now we add Sam as well so add mail Sam Sammy to do mail comm we enter the password we press continue and we're all set and done so right now we should be able to send mails what we'll probably get another pop-up for the certificate so let's send a mail from Tom descent so let's write a mail to Sam at zero mail comm with a test subject and some test text let's send it this probably won't work yes so we have to find the certificate error so let's yeah right here so we have to confirm the security exception and right now we should be able to send them out and as we can see Sam just got an email and it's Inbox so let's see if we can answer that so let's reply to sender only and let's say it worked and we send it back and here we go and thumb has a mail in this inbox so the mail server is working correctly if by any chance some things aren't working you could always go into the mail server and type in tail - F so you get a live presentation of VAR logs this lock every single log from the system will be in here so if we go back to our mail client and we send a mail we should be seeing some logs in the server so let's send a mail from - Tom Tom add to the mail and now we just choose a subject and a text we send it we should be able to see that in the mail server so we right here you can see every single log file that we just used to send a mail and if you want to see a specific for the mouse only you could type and tell - F to get a live presentation of var log mail dot log and now you will only see log files for the mail service itself if you use this log you'll see every single thing that has been logged to the server if you are wondering where the Mail's are stored on the server you should go into home and then the username so for us it's Tom or Sam so let's take Tom we can do an LS here and we see that we have a mail directory so let's CD into the mail directory and then we have current new and temporary Mouse so let's send a new mail from Sam the Tom Tom attitude Oh Mel calm and let's say subject hello and we add some text hello as well and we send it if we go into our current mails we should be able to see a mail that we have just sent so let's just do an LS right here and we can see that we have three emails so let's just open up one with our favorite text editor so let's choose nano 1480 and then we just specify let's take the last one that we've sent and when we open up this mail we should be seeing that we send an email with the subject hello and we also added some text hello so right here subject hello and some text hello so that is basically it guys thanks for watching if you have any questions please make sure to leave a comment and I'll try to get to you as fast as possible thanks for watching and enjoy your day
Info
Channel: INSANE
Views: 34,959
Rating: undefined out of 5
Keywords: Mailserver, Debian, Postfix, Dovecot, SSL, TLS, ssltls, sasl, auth, mozilla, thunderbird, demo
Id: WCo7dwtgprg
Channel Id: undefined
Length: 19min 30sec (1170 seconds)
Published: Sat Dec 03 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.