5. Synchronisez le système de l’horloge

C’est une bonne idée de synchroniser le système heure/horloge avec un serveur NTP (network time protocol) par Internet quand vous lancez un serveur physique.  Si vous lancez un serveur virtuel, alors vous devrez passer cette étape.

Exécutez juste

$ apt-get -y install ntp

et votre système d’horloge sera toujours synchronisé. 


6. Installez Postfix, Dovecot, MariaDB, rkhunter et binutils

Pour installer postfix, vous devez vous assurer que sendmail n’est pas installé et n’est pas en train de fonctionner. Pour arrêter et retirer sendmail, exécutez cette commande :

$ service sendmail stop; update-rc.d -f sendmail remove

Le message d’erreur apparaîtra :

Failed to stop sendmail.service: Unit sendmail.service not loaded.

Ce n’est rien, cela veut juste dire que sendmail n’était pas installé, de telle sorte qu’il n’y a rien à retirer.

Maintenance nous pouvons installer Postfix, Dovecot, MariaDB (à la place de MySQL), rkhunter, et binutils avec la simple commande :

$ apt-get -y install postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd sudo

Il vous sera posé les questions suivantes :

General type of mail configuration: <-- Internet Site
System mail name: <-- server1.example.com

Il est important d’utiliser un sous domaine pour le "system mail name" tel que server1.example.com  ou server1.yourdomain.com  et pas un domaine que vous voudrez utiliser comme domaine d’email plus tard (e.g. yourdomain.tld).

Ensuite, ouvez le TLS/SSL et les ports de soumission dans Postfix:

$ nano /etc/postfix/master.cf

Décommentez submission et les sections  smtps  comme ceci – ajoutez la ligne -o smtpd_client_restrictions=permit_sasl_authenticated,reject à toutes les sections et laissez ensuite commenté :

[...]

submission inet n       -       -       -       -       smtpd

  -o syslog_name=postfix/submission

  -o smtpd_tls_security_level=encrypt

  -o smtpd_sasl_auth_enable=yes

  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

#  -o smtpd_reject_unlisted_recipient=no

#  -o smtpd_client_restrictions=$mua_client_restrictions

#  -o smtpd_helo_restrictions=$mua_helo_restrictions

#  -o smtpd_sender_restrictions=$mua_sender_restrictions

#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject

#  -o milter_macro_daemon_name=ORIGINATING

smtps     inet  n       -       -       -       -       smtpd

  -o syslog_name=postfix/smtps

  -o smtpd_tls_wrappermode=yes

  -o smtpd_sasl_auth_enable=yes

  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

#  -o smtpd_reject_unlisted_recipient=no

#  -o smtpd_client_restrictions=$mua_client_restrictions

#  -o smtpd_helo_restrictions=$mua_helo_restrictions

#  -o smtpd_sender_restrictions=$mua_sender_restrictions

#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject

#  -o milter_macro_daemon_name=ORIGINATING

[...]

NOTE: les espaces vides devant le  "-o .... " de chaque ligne sont importants !

Redémarrez ensuite  Postfix:

$ service postfix restart

On veut que MySQL agisse avec toutes les interfaces, pas seulement avec l’hôte local.  En conséquence, on édite /etc/mysql/mariadb.conf.d/50-server.cnf  et on rend inactive la ligne bind-address = 127.0.0.1  et on ajoute la ligne

 sql-mode="NO_ENGINE_SUBSTITUTION":

$ nano /etc/mysql/mariadb.conf.d/50-server.cnf

[...]

# Instead of skip-networking the default is now to listen only on

# localhost which is more compatible and is not less secure.

#bind-address           = 127.0.0.1

sql-mode="NO_ENGINE_SUBSTITUTION"

[...]

Maintenant on rentre le mot de passe « root » (du super-utilisateur ) dans MariaDB. Exécutez :

$ mysql_secure_installation

Il vous sera posé ces questions :

Entrez votre mot de passe « root » actuel (n’inscrivez rien): <-- appurez sur Entrée
choisir un nouveau mot de passe « root » ? [Y/n] <-- oui
nouveau mot de passe: <-- Entrez le nouveau mot de passe racine de MariaDB ici  here
répéter le nouveau mot de passe: <-- Répétez le mot de passe
retirez les utilisateurs anonymes Remove ? [Y/n] <-- oui
Ne pas autoriser l’accès avec le mot de passe « root » supprimé ? [Y/n] <-- oui
Rétablir les accès prévilégiés maintenant now ? [Y/n] <-- oui

Définissez la méthode d’authentification par mot de passe dans MariaDB comme étant d’origine de telle sorte que l’on puisse utiliser plus tard PHPMyAdmin pour se connecter comme un super utilisateur (utilisateur autorisé) :

$ echo "update mysql.user set plugin = 'mysql_native_password' where user='root';" | mysql -u root

Editez le fichier  /etc/mysql/debian.cnf et inscrivez le mot de passe « root »  MYSQL / MariaDB deux fois ici dans les espaces qui commencent par « mot de passe »

$ nano /etc/mysql/debian.cnf

Le mot de passe « root » MySQL qui doit être ajouté est indiqué en rouge, dans cet exemple le mot de passe est "howtoforge".

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = root
password = 
howtoforge
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
howtoforge
socket = /var/run/mysqld/mysqld.sock
basedir = /usr

Ensuite on redémarre MariaDB :

$ service mysql restart

Maintenant verifiez que le réseau est actif. Exécutez

$ netstat -tap | grep mysql

Le résultat doit ressembler à ceci :

[email protected]:~# netstat -tap | grep mysql
tcp6 0 0 [::]:mysql [::]:* LISTEN 30591/mysqld
[email protected]:~#

7. Installez Amavisd-new, SpamAssassin, et Clamav

Pour installer amavisd-new, SpamAssassin, et ClamAV, on exécute

$ apt-get -y install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl postgrey

L’interface  ISPConfig 3 utilise Amavisd qui charge le filtre interne du répertoire SpamAssassin, aussi on peut arrêter SpamAssassin pour liberer des RAM:

$ service spamassassin stop
$ update-rc.d -f spamassassin remove

Pour démarrer ClamAV  utilisez:

$ freshclam
$ service clamav-daemon start

L’erreur suivante peut être ignore lors de la première execution de freshclam.

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).


7.1 Installez le serveur Metronome XMPP Server (optionnel)

Le serveur Metronome XMPP Server fournit un serveur de « Chat » XMPP.  Cette étape est optionnelle. Si vous n’avez pas besoin d’un serveur de Chat, alors passez cette étape. Aucune autre fonction de ISPConfig ne dépend de ce module.

Installez  le pack suivant avec apt.

$ apt-get -y install git lua5.1 liblua5.1-0-dev lua-filesystem libidn11-dev libssl-dev lua-zlib lua-expat lua-event lua-bitop lua-socket lua-sec luarocks luarocks

$ luarocks install lpc

Ajoutez un utilisateur Shell pour Metronome.

$ adduser --no-create-home --disabled-login --gecos 'Metronome' metronome

Téléchargez Metronome dans le répertoire /opt directory et sauvegardez le .

$ cd /opt; git clone https://github.com/maranda/metronome.git metronome
$ cd ./metronome; ./configure --ostype=debian --prefix=/usr
$ make
$ make install

Metronome a maintenant été installé dans  /opt/metronome.

Editez /etc/apt/sources.list. Rendez inactif ce code ou retirez l’installation du ficher et assurez-vous que les répertoires universe et multiverse sont actifs. Cela doit ressembler à cela:

$ nano /etc/apt/sources.list

Et insérer :

# deb cdrom:[Ubuntu-Server 17.10 _Artful Aardvark_ - Release amd64 (20171017.1)]/ artful main restricted

#deb cdrom:[Ubuntu-Server 17.10 _Artful Aardvark_ - Release amd64 (20171017.1)]/ artful main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ artful main restricted
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ artful-updates main restricted
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ artful universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful universe
deb http://de.archive.ubuntu.com/ubuntu/ artful-updates universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ artful multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful multiverse
deb http://de.archive.ubuntu.com/ubuntu/ artful-updates multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu artful partner
# deb-src http://archive.canonical.com/ubuntu artful partner

deb http://security.ubuntu.com/ubuntu artful-security main restricted
# deb-src http://security.ubuntu.com/ubuntu artful-security main restricted
deb http://security.ubuntu.com/ubuntu artful-security universe
# deb-src http://security.ubuntu.com/ubuntu artful-security universe
deb http://security.ubuntu.com/ubuntu artful-security multiverse
# deb-src http://security.ubuntu.com/ubuntu artful-security multiverse

Ensuite exécutez

$ apt-get update

pour mettre à jour le pack de données apt et

$ apt-get upgrade

pour installer les dernières mises à jour (s’il y en a).

Si vous voyez qu’un nouveau kernel s’est installé parmi les mises à jour, alors vous devrez rebooter le système comme ceci :

$ reboot

 

Cliquez sur "Page suivante" pour accéder à la suite de ce tutoriel.