We will establish password policies through the samba-tool domain passwordsettings command for domain users, in this way, we will reduce the possibility of weak passwords being used.
Additionally, it should be mentioned that starting from Samba 4.9, it is possible to define more particular password policies as explained in this link. However, using this functionality has a resource increase as mentioned in the link, so I will not use this specific functionality in my particular case.
The policies that I will define are:
I will enable password complexity.
I will set a minimum of 8 characters that passwords must have.
A password will have a maximum validity period of 6 months.
The following are the actions to be performed to apply these policies:
Password information for domain 'DC=icecrown,DC=es'
Password complexity: off
Store plaintext passwords: off
Password history length: 24
Minimum password length: 0
Minimum password age (days): 0
Maximum password age (days): 365
Account lockout duration (mins): 30
Account lockout threshold (attempts): 0
Reset account lockout after (mins): 30
Password information for domain 'DC=icecrown,DC=es'
Password complexity: on
Store plaintext passwords: off
Password history length: 24
Minimum password length: 8
Minimum password age (days): 0
Maximum password age (days): 180
Account lockout duration (mins): 30
Account lockout threshold (attempts): 0
Reset account lockout after (mins): 30
Finally, we try to create a user with a weak password to confirm that the policies are in operation:
SPF will be the first one we will implement. The goal that SPF tries to cover is to protect our domain against spoofing and phishing attacks. Basically, we will create a record in our DNS which will indicate which servers can send emails from our domain. For more information, see this link.
Through this website, we will generate the necessary DNS record to implement this authentication method:
We create the TXT record both in the DNS module and in the DNS provider - in my case, Route53 -:
For Zentyal, we go to DNS -> Domains -> TXT records:
For Route 53:
We check the resolution of the new record both internally and externally:
DKIM will be the next security implementation we will carry out. The objective of DKIM is that the receiver can verify that the received email is legitimate. The necessary configuration steps have been taken from here.
We install the necessary packages for the implementation of DKIM:
We create the configuration file /etc/opendkim/KeyTable which will have the selector name and the path to the private key responsible for signing the emails.
Once the DNS record is confirmed, we will proceed to configure the Postfix (SMTP) service to make use of this service. To do this, we add the following lines at the end of the stub /etc/zentyal/stubs/mail/main.cf.mas.
## DKIM Configuration created on 19-02-2023 by Daniel
milter_protocol = 6
milter_default_action = accept
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = inet:127.0.0.1:8891
If we do not have this file, we will have to execute the following commands:
The last implementation we will perform will be DMARC. This authentication mechanism will integrate with SPF and DKIM, so it will be necessary to have them previously implemented.
Through this website, we will generate the necessary DNS record to implement this authentication method:
We create the DNS record of type TXT on both the Zentyal server and the DNS provider:
For the Zentyal server, we go to DNS -> Domains -> TXT records:
For Route53:
We check the resolution of the new record both internally and externally:
The Webmail module serves its content through the Apache service, which by default displays too much information, which can be used for a possible attack.
By default, it is possible to obtain the version of Ubuntu and Apache used by the web service. Additionally, the default Apache page is very characteristic. Therefore, we will proceed to reduce the information that is possible to obtain by querying the service and also create a very simple page.
We modify the following configuration parameters in the file /etc/apache2/conf-enabled/security.conf to reduce the service information: