mirror of
https://github.com/stylersnico/abyssproject-wiki.git
synced 2026-06-04 16:08:40 +02:00
docs: add all untracked content
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Sauvegarde de son serveur Debian avec Restic
|
||||
description:
|
||||
published: false
|
||||
date: 2021-08-24T16:08:01.306Z
|
||||
tags: debian, backup, restic, sauvegarde
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:07:59.510Z
|
||||
---
|
||||
|
||||
# Header
|
||||
Your content here
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Certificats Let's Encrypt avec Acme.SH pour Nginx
|
||||
description: Obtenez des certificats ECDSA chez Let's Encrypt avec Acme.sh
|
||||
published: true
|
||||
date: 2021-08-12T16:52:37.947Z
|
||||
tags: nginx, let's encrypt, acme.sh, ssl, debian
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-11T17:36:42.808Z
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
Le but de cet article est d'utiliser l'utilitaire acme.sh afin de générer des certificats ECDSA fournis par l'autorité Let's Encrypt et mis en place dans NGINX.
|
||||
|
||||
# Installation
|
||||
|
||||
|
||||
Installez acme.sh :
|
||||
|
||||
```bash
|
||||
curl https://get.acme.sh | sh -s email=test@tap.ovh
|
||||
cd /root/.acme.sh/
|
||||
chmod +x acme.sh
|
||||
sh acme.sh --set-default-ca --server letsencrypt
|
||||
```
|
||||
|
||||
# Émission d'un certificat
|
||||
Exécutez la commande suivante en indiquant votre vhost pour demander un certificat :
|
||||
|
||||
```bash
|
||||
sh acme.sh --issue -d website.tap.ovh --nginx /etc/nginx/sites-enabled/wordpress.vhost --keylength ec-384
|
||||
```
|
||||
|
||||
Si l’opération réussie, vous devrez juste configurer le certificat ECDSA dans votre vhost nginx :
|
||||
```bash
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert key is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] The intermediate CA cert is in: /root/.acme.sh/website.tap.ovh_ecc/ca.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] And the full chain certs is there: /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer
|
||||
```
|
||||
|
||||
# Renouvellement automatique
|
||||
|
||||
Tous les certificats sont automatiquement renouvelés tous les 60 jours.
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: Mise à jour de Debian 10 vers Debian 11
|
||||
description: Upgrade de Buster à Bullseye
|
||||
published: true
|
||||
date: 2021-08-23T15:53:38.194Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-11T17:56:25.121Z
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
Le but de cet article est de mettre à jour un serveur Debian 10 existant vers Debian 11
|
||||
|
||||
|
||||
# Mise à jour du système existant
|
||||
|
||||
Dans un premier temps, mettez le système existant à jour :
|
||||
|
||||
```bash
|
||||
apt update && apt dist-upgrade -y
|
||||
```
|
||||
|
||||
|
||||
# Modification des sources
|
||||
|
||||
Lancez la commande suivante pour modifier les sources existantes et passer sur les repository de Debian 11 :
|
||||
|
||||
```bash
|
||||
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
|
||||
```
|
||||
|
||||
|
||||
# Mise à jour vers Debian 11
|
||||
|
||||
Lancez les commandes suivantes pour passer sur Debian 11 :
|
||||
|
||||
```bash
|
||||
apt update && apt full-upgrade -y
|
||||
reboot
|
||||
```
|
||||
|
||||
## Erreur sur Debian Security
|
||||
|
||||
> Erreur rencontrée sur sur un CX11 avec l'image Debian 10 chez l'hébergeur Hetzner
|
||||
{.is-info}
|
||||
|
||||
|
||||
Si vous recevez l'erreur suivante :
|
||||
|
||||
```bash
|
||||
E: The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
|
||||
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
|
||||
```
|
||||
|
||||
Remplacez ceci :
|
||||
```bash
|
||||
deb http://security.debian.org/ bullseye/updates main contrib non-free
|
||||
# deb-src http://security.debian.org/ bullseye/updates main contrib non-free
|
||||
```
|
||||
|
||||
Par cela :
|
||||
|
||||
```bash
|
||||
deb http://security.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
# deb-src http://security.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
```
|
||||
+469
@@ -0,0 +1,469 @@
|
||||
---
|
||||
title: Monter son serveur Web avec Debian 11
|
||||
description: Découvrez comment monter votre serveur Web compatible HTT2 et TLS 1.3 avec Debian 11, NGINX, MariaDB et PHP-FPM.
|
||||
published: true
|
||||
date: 2021-08-12T17:51:20.562Z
|
||||
tags: debian 10, wordpress, web, nginx
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-11T13:32:29.070Z
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
L'idée, c'est de partir sur un système simple et stable (Debian donc), pour y installer les briques d'un serveur web performant et sécurisé (HTTP2, TLS 1.2 et 1.3 avec les best practices).
|
||||
|
||||
Et, vu qu'un serveur web ne sert à rien sans application, on va mettre un WordPress (qui reste utilisé par plus d'un tiers du web, donc on va mettre un truc qui intéressera le plus grand monde pour l'exemple).
|
||||
|
||||
Voici les briques logicielles que nous allons utiliser :
|
||||
|
||||
- Serveur Web : NGINX
|
||||
- Serveur de base de données : MariaDB
|
||||
- Moteur PHP : FastCGI Process Manager (FPM) avec gouverneur statique (on en parlera de l'optimisation de FPM, mais pas maintenant)
|
||||
|
||||
Ce n'est pas tout, pour accélérer tout cela on va également utiliser deux systèmes de cache :
|
||||
|
||||
- Redis pour MariaDB avec intégration PHP
|
||||
- OPcache en interne dans PHP-FPM
|
||||
|
||||
|
||||
|
||||
# Résultat souhaité
|
||||
|
||||
On se base sur deux sites ici, SSL Labs et Security Headers.
|
||||
|
||||
- [SSL Labs](https://www.ssllabs.com/ssltest/) : A+
|
||||
- [Security Headers](https://securityheaders.com/) : A
|
||||
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
Dans cette première partie, on va voir l'installation des packages nécessaires.
|
||||
|
||||
|
||||
## Installation des repository pour PHP 8.0
|
||||
|
||||
> Il est nécessaire de passer via le repository tiers de Sury.org pour avoir PHP 8.0 sur Debian 11
|
||||
{.is-warning}
|
||||
|
||||
```bash
|
||||
apt-get -y install apt-transport-https lsb-release ca-certificates curl
|
||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
```
|
||||
|
||||
## Installation des packages
|
||||
|
||||
On installe Nginx, MariaDB, PHP 8.0 et Redis avec cette simple commande :
|
||||
|
||||
```bash
|
||||
apt install curl git unzip imagemagick haveged mariadb-client mariadb-server nginx-extras php-common php-pear php-redis redis php-zip php8.0-cli php8.0-common php8.0-curl php8.0-dev php8.0-fpm php8.0-gd php8.0-imap php8.0-intl php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-pspell php8.0-readline php8.0-snmp php8.0-tidy php8.0-xml php8.0-zip
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
On va configurer un par un les logiciels du serveur maintenant.
|
||||
|
||||
## NGINX
|
||||
|
||||
On va commencer par mettre une configuration qui va bien et qui utilise le module headers-more.
|
||||
|
||||
```bash
|
||||
cd /etc/nginx/
|
||||
rm nginx.conf && wget https://raw.githubusercontent.com/stylersnico/nginx-secure-config/master/nginx.conf-debian-extras && mv nginx.conf-debian-extras nginx.conf
|
||||
```
|
||||
|
||||
Vous pouvez ouvrir la configuration et adapter les workers selon le nombre de cœurs sur votre serveur.
|
||||
Vous pouvez également faire le tour de toutes les best practices qui sont déjà intégrées.
|
||||
On reviendra sur Nginx après, redémarrez le service en attendant :
|
||||
|
||||
```bash
|
||||
systemctl restart nginx
|
||||
```
|
||||
|
||||
|
||||
|
||||
## MariaDB / MySQL
|
||||
|
||||
Rien de spécial ici, lancez la commande suivante pour sécuriser l'installation :
|
||||
|
||||
```bash
|
||||
mysql_secure_installation
|
||||
```
|
||||
|
||||
Ouvrez maintenant le fichier de configuration et ajoutez cela dans la partie [mysqld] :
|
||||
|
||||
```bash
|
||||
nano /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
```
|
||||
|
||||
```bash
|
||||
#
|
||||
# * Fine Tuning
|
||||
#
|
||||
max_connections = 50
|
||||
connect_timeout = 5
|
||||
wait_timeout = 600
|
||||
max_allowed_packet = 16M
|
||||
thread_cache_size = 128
|
||||
sort_buffer_size = 4M
|
||||
bulk_insert_buffer_size = 16M
|
||||
tmp_table_size = 32M
|
||||
max_heap_table_size = 32M
|
||||
#
|
||||
# * Query Cache Configuration
|
||||
#
|
||||
# Cache only tiny result sets, so we can fit more in the query cache.
|
||||
query_cache_limit = 512K
|
||||
query_cache_size = 32M
|
||||
```
|
||||
|
||||
On reviendra également sur MariaDB après pour faire la base de données, en attendant, redémarrez le service :
|
||||
|
||||
```bash
|
||||
systemctl restart mysql
|
||||
```
|
||||
|
||||
|
||||
|
||||
## PHP
|
||||
|
||||
Créez le répertoire des sockets avec la commande suivante :
|
||||
|
||||
```bash
|
||||
mkdir -p /var/lib/php8.0-fpm/
|
||||
```
|
||||
|
||||
Ouvrez la configuration de PHP-FPM et ajoutez-y les paramètres de cache ainsi que la TimeZone :
|
||||
|
||||
```bash
|
||||
nano /etc/php/8.0/fpm/php.ini
|
||||
```
|
||||
|
||||
```bash
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.interned_strings_buffer=8
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=128
|
||||
opcache.save_comments=1
|
||||
opcache.revalidate_freq=1
|
||||
date.timezone = Europe/Paris
|
||||
session.cookie_httponly = True
|
||||
max_execution_time = 300
|
||||
max_input_vars = 1740
|
||||
post_max_size=100M
|
||||
upload_max_filesize=100M
|
||||
```
|
||||
|
||||
Ouvrez la configuration de PHP-CLI et ajoutez-y les paramètres de cache ainsi que la TimeZone :
|
||||
|
||||
```bash
|
||||
nano /etc/php/8.0/cli/php.ini
|
||||
```
|
||||
|
||||
```bash
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.interned_strings_buffer=8
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=128
|
||||
opcache.save_comments=1
|
||||
opcache.revalidate_freq=1
|
||||
date.timezone = Europe/Paris
|
||||
session.cookie_httponly = True
|
||||
max_execution_time = 300
|
||||
max_input_vars = 1740
|
||||
post_max_size=100M
|
||||
upload_max_filesize=100M
|
||||
```
|
||||
|
||||
Redémarrez PHP avec la commande suivante :
|
||||
|
||||
```bash
|
||||
systemctl restart php8.0-fpm
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Redis
|
||||
|
||||
Ouvrez le fichier de configuration de Redis :
|
||||
|
||||
```bash
|
||||
nano /etc/redis/redis.conf
|
||||
```
|
||||
|
||||
Modifiez les variables suivantes (pour configurer la taille du cache et l'expiration du cache le plus ancien)
|
||||
```bash
|
||||
maxmemory 256mb
|
||||
maxmemory-policy allkeys-lru
|
||||
```
|
||||
|
||||
Redémarrez ensuite redis :
|
||||
|
||||
```bash
|
||||
systemctl restart redis
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Installation d'un blog WordPress
|
||||
|
||||
Dans cette partie, on va voir comment mettre à profit la base de serveur web que l'on vient d'installer afin d'y installer un des systèmes de gestion de contenu les plus utilisés.
|
||||
|
||||
Supprimez déjà les fichiers de configuration par défaut :
|
||||
|
||||
```bash
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
rm /etc/php/8.0/fpm/pool.d/www.conf
|
||||
```
|
||||
|
||||
## Téléchargement de WordPress
|
||||
|
||||
Téléchargez et installez la dernière version de WordPress sur votre serveur :
|
||||
|
||||
```bash
|
||||
cd /var/www/
|
||||
wget https://wordpress.org/latest.zip && unzip latest.zip && rm latest.zip
|
||||
```
|
||||
|
||||
Maintenant, créez l’utilisateur pour wordpress :
|
||||
|
||||
```bash
|
||||
adduser wordpress
|
||||
```
|
||||
|
||||
Ajoutez-lui les droits sur le site :
|
||||
|
||||
```bash
|
||||
chown -R wordpress:www-data /var/www/wordpress
|
||||
```
|
||||
|
||||
Ajoutez ensuite cet utilisateur dans le groupe www-data :
|
||||
|
||||
```bash
|
||||
adduser wordpress www-data
|
||||
```
|
||||
|
||||
## Création du fichier de configuration NGINX
|
||||
|
||||
Créez le vhost avec la commande suivante :
|
||||
|
||||
```bash
|
||||
nano /etc/nginx/sites-enabled/wordpress.vhost
|
||||
```
|
||||
|
||||
Copiez-y ceci :
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name website.tap.ovh;
|
||||
|
||||
root /var/www/wordpress/;
|
||||
|
||||
index index.php;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Création du fichier de configuration PHP
|
||||
|
||||
Créez le pool fpm avec la commande suivante :
|
||||
|
||||
```bash
|
||||
nano /etc/php/8.0/fpm/pool.d/wordpress.conf
|
||||
```
|
||||
|
||||
Copiez-y ceci :
|
||||
```bash
|
||||
[wordpress]
|
||||
|
||||
listen = /var/lib/php8.0-fpm/wordpress.sock
|
||||
listen.owner = wordpress
|
||||
listen.group = www-data
|
||||
listen.mode = 0660
|
||||
|
||||
user = wordpress
|
||||
group = www-data
|
||||
|
||||
pm = static
|
||||
pm.max_children = 15
|
||||
|
||||
|
||||
|
||||
chdir = /
|
||||
|
||||
env[HOSTNAME] = $HOSTNAME
|
||||
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
```
|
||||
|
||||
Redémarrez les services avec la commande suivante :
|
||||
|
||||
```bash
|
||||
systemctl restart nginx && systemctl restart php8.0-fpm
|
||||
```
|
||||
|
||||
## Création de la base de données
|
||||
|
||||
Connectez-vous en root avec la commande suivante :
|
||||
|
||||
```bash
|
||||
mysql -u root -p
|
||||
```
|
||||
|
||||
Créez la base de données pour WordPress :
|
||||
|
||||
```sql
|
||||
CREATE DATABASE wordpress;
|
||||
```
|
||||
|
||||
Créez l’utilisateur :
|
||||
```sql
|
||||
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password';
|
||||
```
|
||||
Donnez les droits à l’utilisateur sur la base de données :
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
|
||||
```
|
||||
Appliquez les droits et sortez :
|
||||
```sql
|
||||
FLUSH PRIVILEGES;
|
||||
exit
|
||||
```
|
||||
|
||||
|
||||
## Mise en place du certificat Let’s Encrypt
|
||||
|
||||
Installez acme.sh :
|
||||
|
||||
```bash
|
||||
curl https://get.acme.sh | sh -s email=test@tap.ovh
|
||||
cd /root/.acme.sh/
|
||||
chmod +x acme.sh
|
||||
sh acme.sh --set-default-ca --server letsencrypt
|
||||
```
|
||||
|
||||
Exécutez la commande suivante en indiquant votre vhost pour demander un certificat :
|
||||
|
||||
```bash
|
||||
sh acme.sh --issue -d website.tap.ovh --nginx /etc/nginx/sites-enabled/wordpress.vhost --keylength ec-384
|
||||
```
|
||||
|
||||
Si l’opération réussie, vous devrez juste configurer le certificat ECDSA dans votre vhost nginx :
|
||||
```bash
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert key is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] The intermediate CA cert is in: /root/.acme.sh/website.tap.ovh_ecc/ca.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] And the full chain certs is there: /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer
|
||||
```
|
||||
|
||||
Éditez votre vhost nginx pour rajouter les informations nécessaires (fullchain et clé privée) :
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl http2;
|
||||
|
||||
ssl_certificate /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer;
|
||||
ssl_certificate_key /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key;
|
||||
|
||||
|
||||
if ($scheme != "https") {
|
||||
rewrite ^ https://$http_host$request_uri? permanent;
|
||||
}
|
||||
|
||||
|
||||
server_name website.tap.ovh;
|
||||
|
||||
root /var/www/wordpress/;
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
alias /var/www/wordpress/.well-known/acme-challenge/;
|
||||
}
|
||||
|
||||
index index.php;
|
||||
|
||||
|
||||
location = /xmlrpc.php {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files /e1d4ea2d073f20faebaf9539ddde872c.htm @php;
|
||||
}
|
||||
|
||||
location @php {
|
||||
try_files $uri =404;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass unix:/var/lib/php8.0-fpm/wordpress.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_intercept_errors on;
|
||||
}
|
||||
|
||||
location ~ ^/(status|ping)$ {
|
||||
access_log off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|webp)$ {
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
}
|
||||
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
Redémarrez ensuite NGINX et accédez à l’URL du blog pour l’installer :
|
||||
|
||||
https://website.tap.ovh/
|
||||
|
||||
|
||||
|
||||
## Configuration du cache Redis
|
||||
|
||||
Suivez l'installateur Wordpress, la première chose à faire ensuite, c'est de configurer ces deux lignes dans votre fichier de configuration WordPress :
|
||||
|
||||
```bash
|
||||
nano /var/www/wordpress/wp-config.php
|
||||
```
|
||||
|
||||
```php
|
||||
define('WP_CACHE', true);
|
||||
define('WP_CACHE_KEY_SALT', 'website.tap.ovh');
|
||||
```
|
||||
Ensuite, installez et activez l'extension [Redis Object Cache.](https://fr.wordpress.org/plugins/redis-cache/) Une fois que c'est fait, vérifiez que Redis marche bien avec la commande suivante :
|
||||
|
||||
```bash
|
||||
redis-cli monitor
|
||||
```
|
||||
|
||||
Vous devriez voir le cache répondre en naviguant sur votre site :
|
||||
|
||||
|
||||
|
||||
|
||||
# Note de fin
|
||||
|
||||
Si vous souhaitez aller plus loin, vous pouvez regarder la mise en place des images au format WebP : [https://www.abyssproject.net/2020/05/mettre-en-place-les-images-au-format-webp-sur-son-site-avec-nginx/](https://www.abyssproject.net/2020/05/mettre-en-place-les-images-au-format-webp-sur-son-site-avec-nginx/)
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Automatisation des updates Docker avec Watchtower
|
||||
description: Pas trouvée
|
||||
published: false
|
||||
date: 2021-08-24T16:06:08.865Z
|
||||
tags: docker, watchtower
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:06:06.326Z
|
||||
---
|
||||
|
||||
# ToDo
|
||||
https://www.haade.fr/blog/home-automation-smarthome-jeedom-homeassistant/tutos-haade-lab/automatiser-la-mise-a-jour-des-images-docker-grace-a-watchtower/
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: Let's Encrypt certificates with Acme.sh and NGINX
|
||||
description: Get ECDSA certs with acme.sh for your nginx webserver
|
||||
published: true
|
||||
date: 2021-08-12T17:28:36.529Z
|
||||
tags: nginx, let's encrypt, acme.sh, debian
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-12T17:28:34.626Z
|
||||
---
|
||||
|
||||
# Before starting
|
||||
|
||||
The goal here is to use the project acme.sh to get ECDSA certificates provided by Let's Encrypt certification authority and used in your nginx web server.
|
||||
|
||||
# Installation
|
||||
|
||||
|
||||
Install acme.sh:
|
||||
|
||||
```bash
|
||||
curl https://get.acme.sh | sh -s email=test@tap.ovh
|
||||
cd /root/.acme.sh/
|
||||
chmod +x acme.sh
|
||||
sh acme.sh --set-default-ca --server letsencrypt
|
||||
```
|
||||
|
||||
# Certificate creation
|
||||
Please launch this command with your domain to get a certificate:
|
||||
|
||||
```bash
|
||||
sh acme.sh --issue -d website.tap.ovh --nginx /etc/nginx/sites-enabled/wordpress.vhost --keylength ec-384
|
||||
```
|
||||
|
||||
If the operation is successful, you will just need to install the certificate with the information provided by the script (only full chain certs and cert key needed):
|
||||
```bash
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert key is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] The intermediate CA cert is in: /root/.acme.sh/website.tap.ovh_ecc/ca.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] And the full chain certs is there: /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer
|
||||
```
|
||||
|
||||
# Automatic renewal
|
||||
|
||||
All certificates are renewed every 60 days by default. Nothing to do here.
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: Upgrade from Debian 10 to Debian 11
|
||||
description: Upgrade from Buster to Bullseye
|
||||
published: true
|
||||
date: 2021-08-23T15:54:02.654Z
|
||||
tags: debian
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-12T17:37:50.044Z
|
||||
---
|
||||
|
||||
# Before starting
|
||||
|
||||
The goal here is to upgrade an existing Debian 10 installation to Debian 11
|
||||
|
||||
|
||||
# Updating actual system
|
||||
|
||||
First, update your system :
|
||||
|
||||
```bash
|
||||
apt update && apt dist-upgrade -y
|
||||
```
|
||||
|
||||
|
||||
# Sources update
|
||||
|
||||
Launch the following command to edit your existing sources and move to Debian 11's repository:
|
||||
|
||||
```bash
|
||||
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
|
||||
```
|
||||
|
||||
|
||||
# Upgrade to Debian 11
|
||||
|
||||
Finally, launch the following command to upgrade to Debian 11:
|
||||
|
||||
```bash
|
||||
apt update && apt full-upgrade -y
|
||||
reboot
|
||||
```
|
||||
|
||||
## Error with Debian Security
|
||||
|
||||
> Error get on a CX11 server with the Debian 10 image at Hetzner
|
||||
{.is-info}
|
||||
|
||||
|
||||
If you get the following error:
|
||||
|
||||
```bash
|
||||
E: The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
|
||||
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
|
||||
```
|
||||
|
||||
Replace this:
|
||||
```bash
|
||||
deb http://security.debian.org/ bullseye/updates main contrib non-free
|
||||
# deb-src http://security.debian.org/ bullseye/updates main contrib non-free
|
||||
```
|
||||
|
||||
With this:
|
||||
|
||||
```bash
|
||||
deb http://security.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
# deb-src http://security.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
```
|
||||
@@ -0,0 +1,470 @@
|
||||
---
|
||||
title: Build your webserver with Debian 11
|
||||
description: Get your HTT2 and TLS 1.3 compatible webserver with Debian 11, NGINX, MariaDB and PHP-FPM.
|
||||
published: true
|
||||
date: 2021-08-12T17:50:20.421Z
|
||||
tags: web, debian, fpm, mariadb
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-12T17:50:18.409Z
|
||||
---
|
||||
|
||||
> Translation in progress
|
||||
{.is-warning}
|
||||
|
||||
|
||||
# Before starting
|
||||
|
||||
The idea is to start with a stable system (Debian 11) to install all the components of a fast and secure webserver (HTTP2, TLS 1.2 et 1.3 with best practices).
|
||||
|
||||
On top of that, on the understanding that a webserver alone is useless without a website on it, we are going to install a Wordpress (because it's the most used CMS in the world at the time of the write).
|
||||
|
||||
Here is what we are going to use:
|
||||
|
||||
- Webserver : NGINX
|
||||
- Database Server : MariaDB
|
||||
- PHP Engine : FastCGI Process Manager (FPM) with static governor
|
||||
|
||||
Least but not last, here is the two cache system we are going to use :
|
||||
|
||||
- Redis for MariaDB with PHP integration
|
||||
- built-in OPcache in PHP-FPM
|
||||
|
||||
|
||||
|
||||
# Wanted results
|
||||
|
||||
We use two well known website for estimating security of the NGINX side, SSL Labs and Security Headers:
|
||||
|
||||
- [SSL Labs](https://www.ssllabs.com/ssltest/) : A+
|
||||
- [Security Headers](https://securityheaders.com/) : A
|
||||
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
In this first part, we are going to install the packages needed.
|
||||
|
||||
|
||||
## Repository install for PHP 8.0
|
||||
|
||||
> It is mandatory to go throught sury.org's repository to get PHP 8.0 on Debian 11
|
||||
{.is-warning}
|
||||
|
||||
```bash
|
||||
apt-get -y install apt-transport-https lsb-release ca-certificates curl
|
||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
```
|
||||
|
||||
## Packages installation
|
||||
|
||||
Install Nginx, MariaDB, PHP 8.0 and Redis:
|
||||
|
||||
```bash
|
||||
apt install curl git unzip imagemagick haveged mariadb-client mariadb-server nginx-extras php-common php-pear php-redis redis php-zip php8.0-cli php8.0-common php8.0-curl php8.0-dev php8.0-fpm php8.0-gd php8.0-imap php8.0-intl php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-pspell php8.0-readline php8.0-snmp php8.0-tidy php8.0-xml php8.0-zip
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
We are going to configure all softwares one by one now.
|
||||
|
||||
## NGINX
|
||||
|
||||
Grab my Nginx secure config which is using the headers-more module:
|
||||
|
||||
```bash
|
||||
cd /etc/nginx/
|
||||
rm nginx.conf && wget https://raw.githubusercontent.com/stylersnico/nginx-secure-config/master/nginx.conf-debian-extras && mv nginx.conf-debian-extras nginx.conf
|
||||
```
|
||||
|
||||
You can open the config file and adapt workers depending on your cpu cores on your server.
|
||||
You can also go throught all security options that are integrated. We will go back to nginx after, please now restart the service:
|
||||
|
||||
```bash
|
||||
systemctl restart nginx
|
||||
```
|
||||
|
||||
|
||||
|
||||
## MariaDB
|
||||
|
||||
Nothing special, launch the integrated utility to secure the Sql Server:
|
||||
|
||||
```bash
|
||||
mysql_secure_installation
|
||||
```
|
||||
|
||||
Now, open the config file and add this to the [mysqld] part:
|
||||
|
||||
```bash
|
||||
nano /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
```
|
||||
|
||||
```bash
|
||||
#
|
||||
# * Fine Tuning
|
||||
#
|
||||
max_connections = 50
|
||||
connect_timeout = 5
|
||||
wait_timeout = 600
|
||||
max_allowed_packet = 16M
|
||||
thread_cache_size = 128
|
||||
sort_buffer_size = 4M
|
||||
bulk_insert_buffer_size = 16M
|
||||
tmp_table_size = 32M
|
||||
max_heap_table_size = 32M
|
||||
#
|
||||
# * Query Cache Configuration
|
||||
#
|
||||
# Cache only tiny result sets, so we can fit more in the query cache.
|
||||
query_cache_limit = 512K
|
||||
query_cache_size = 32M
|
||||
```
|
||||
|
||||
We will also connect after to create database, now please restart the service:
|
||||
|
||||
```bash
|
||||
systemctl restart mysql
|
||||
```
|
||||
|
||||
|
||||
|
||||
## PHP
|
||||
|
||||
Create the FPM socket directory with this command:
|
||||
|
||||
```bash
|
||||
mkdir -p /var/lib/php8.0-fpm/
|
||||
```
|
||||
|
||||
Open the PHP-FPM config and add this (and the Timezone):
|
||||
```bash
|
||||
nano /etc/php/8.0/fpm/php.ini
|
||||
```
|
||||
|
||||
```bash
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.interned_strings_buffer=8
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=128
|
||||
opcache.save_comments=1
|
||||
opcache.revalidate_freq=1
|
||||
date.timezone = Europe/Paris
|
||||
session.cookie_httponly = True
|
||||
max_execution_time = 300
|
||||
max_input_vars = 1740
|
||||
post_max_size=100M
|
||||
upload_max_filesize=100M
|
||||
```
|
||||
|
||||
Same thing for PHP-CLI config:
|
||||
|
||||
```bash
|
||||
nano /etc/php/8.0/cli/php.ini
|
||||
```
|
||||
|
||||
```bash
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.interned_strings_buffer=8
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=128
|
||||
opcache.save_comments=1
|
||||
opcache.revalidate_freq=1
|
||||
date.timezone = Europe/Paris
|
||||
session.cookie_httponly = True
|
||||
max_execution_time = 300
|
||||
max_input_vars = 1740
|
||||
post_max_size=100M
|
||||
upload_max_filesize=100M
|
||||
```
|
||||
|
||||
Restart PHP-FPM:
|
||||
|
||||
```bash
|
||||
systemctl restart php8.0-fpm
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Redis
|
||||
|
||||
Open the Redis config file:
|
||||
|
||||
```bash
|
||||
nano /etc/redis/redis.conf
|
||||
```
|
||||
|
||||
Edit the following to configure cache size and expiration:
|
||||
|
||||
```bash
|
||||
maxmemory 256mb
|
||||
maxmemory-policy allkeys-lru
|
||||
```
|
||||
|
||||
Restart Redis:
|
||||
|
||||
```bash
|
||||
systemctl restart redis
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Installation d'un blog WordPress
|
||||
|
||||
Dans cette partie, on va voir comment mettre à profit la base de serveur web que l'on vient d'installer afin d'y installer un des systèmes de gestion de contenu les plus utilisés. Supprimez déjà les fichiers de configuration par défaut :
|
||||
|
||||
```bash
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
rm /etc/php/8.0/fpm/pool.d/www.conf
|
||||
```
|
||||
|
||||
## Téléchargement de WordPress
|
||||
|
||||
Téléchargez et installez la dernière version de WordPress sur votre serveur :
|
||||
|
||||
```bash
|
||||
cd /var/www/
|
||||
wget https://wordpress.org/latest.zip && unzip latest.zip && rm latest.zip
|
||||
```
|
||||
|
||||
Maintenant, créez l’utilisateur pour wordpress :
|
||||
|
||||
```bash
|
||||
adduser wordpress
|
||||
```
|
||||
|
||||
Ajoutez-lui les droits sur le site :
|
||||
|
||||
```bash
|
||||
chown -R wordpress:www-data /var/www/wordpress
|
||||
```
|
||||
|
||||
Ajoutez ensuite cet utilisateur dans le groupe www-data :
|
||||
|
||||
```bash
|
||||
adduser wordpress www-data
|
||||
```
|
||||
|
||||
## Création du fichier de configuration NGINX
|
||||
|
||||
Créez le vhost avec la commande suivante :
|
||||
|
||||
```bash
|
||||
nano /etc/nginx/sites-enabled/wordpress.vhost
|
||||
```
|
||||
|
||||
Copiez-y ceci :
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name website.tap.ovh;
|
||||
|
||||
root /var/www/wordpress/;
|
||||
|
||||
index index.php;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Création du fichier de configuration PHP
|
||||
|
||||
Créez le pool fpm avec la commande suivante :
|
||||
|
||||
```bash
|
||||
nano /etc/php/8.0/fpm/pool.d/wordpress.conf
|
||||
```
|
||||
|
||||
Copiez-y ceci :
|
||||
```bash
|
||||
[wordpress]
|
||||
|
||||
listen = /var/lib/php8.0-fpm/wordpress.sock
|
||||
listen.owner = wordpress
|
||||
listen.group = www-data
|
||||
listen.mode = 0660
|
||||
|
||||
user = wordpress
|
||||
group = www-data
|
||||
|
||||
pm = static
|
||||
pm.max_children = 15
|
||||
|
||||
|
||||
|
||||
chdir = /
|
||||
|
||||
env[HOSTNAME] = $HOSTNAME
|
||||
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
```
|
||||
|
||||
Redémarrez les services avec la commande suivante :
|
||||
|
||||
```bash
|
||||
systemctl restart nginx && systemctl restart php8.0-fpm
|
||||
```
|
||||
|
||||
## Création de la base de données
|
||||
|
||||
Connectez-vous en root avec la commande suivante :
|
||||
|
||||
```bash
|
||||
mysql -u root -p
|
||||
```
|
||||
|
||||
Créez la base de données pour WordPress :
|
||||
|
||||
```sql
|
||||
CREATE DATABASE wordpress;
|
||||
```
|
||||
|
||||
Créez l’utilisateur :
|
||||
```sql
|
||||
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password';
|
||||
```
|
||||
Donnez les droits à l’utilisateur sur la base de données :
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
|
||||
```
|
||||
Appliquez les droits et sortez :
|
||||
```sql
|
||||
FLUSH PRIVILEGES;
|
||||
exit
|
||||
```
|
||||
|
||||
|
||||
## Mise en place du certificat Let’s Encrypt
|
||||
|
||||
Installez acme.sh :
|
||||
|
||||
```bash
|
||||
curl https://get.acme.sh | sh -s email=test@tap.ovh
|
||||
cd /root/.acme.sh/
|
||||
chmod +x acme.sh
|
||||
sh acme.sh --set-default-ca --server letsencrypt
|
||||
```
|
||||
|
||||
Exécutez la commande suivante en indiquant votre vhost pour demander un certificat :
|
||||
|
||||
```bash
|
||||
sh acme.sh --issue -d website.tap.ovh --nginx /etc/nginx/sites-enabled/wordpress.vhost --keylength ec-384
|
||||
```
|
||||
|
||||
Si l’opération réussie, vous devrez juste configurer le certificat ECDSA dans votre vhost nginx :
|
||||
```bash
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] Your cert key is in: /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] The intermediate CA cert is in: /root/.acme.sh/website.tap.ovh_ecc/ca.cer
|
||||
[Wed 11 Aug 2021 08:21:06 PM CEST] And the full chain certs is there: /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer
|
||||
```
|
||||
|
||||
Éditez votre vhost nginx pour rajouter les informations nécessaires (fullchain et clé privée) :
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl http2;
|
||||
|
||||
ssl_certificate /root/.acme.sh/website.tap.ovh_ecc/fullchain.cer;
|
||||
ssl_certificate_key /root/.acme.sh/website.tap.ovh_ecc/website.tap.ovh.key;
|
||||
|
||||
|
||||
if ($scheme != "https") {
|
||||
rewrite ^ https://$http_host$request_uri? permanent;
|
||||
}
|
||||
|
||||
|
||||
server_name website.tap.ovh;
|
||||
|
||||
root /var/www/wordpress/;
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
alias /var/www/wordpress/.well-known/acme-challenge/;
|
||||
}
|
||||
|
||||
index index.php;
|
||||
|
||||
|
||||
location = /xmlrpc.php {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files /e1d4ea2d073f20faebaf9539ddde872c.htm @php;
|
||||
}
|
||||
|
||||
location @php {
|
||||
try_files $uri =404;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass unix:/var/lib/php8.0-fpm/wordpress.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_intercept_errors on;
|
||||
}
|
||||
|
||||
location ~ ^/(status|ping)$ {
|
||||
access_log off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|webp)$ {
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
}
|
||||
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
Redémarrez ensuite NGINX et accédez à l’URL du blog pour l’installer :
|
||||
|
||||
https://website.tap.ovh/
|
||||
|
||||
|
||||
|
||||
## Configuration du cache Redis
|
||||
|
||||
Suivez l'installateur Wordpress, la première chose à faire ensuite, c'est de configurer ces deux lignes dans votre fichier de configuration WordPress :
|
||||
|
||||
```bash
|
||||
nano /var/www/wordpress/wp-config.php
|
||||
```
|
||||
|
||||
```php
|
||||
define('WP_CACHE', true);
|
||||
define('WP_CACHE_KEY_SALT', 'website.tap.ovh');
|
||||
```
|
||||
Ensuite, installez et activez l'extension [Redis Object Cache.](https://fr.wordpress.org/plugins/redis-cache/) Une fois que c'est fait, vérifiez que Redis marche bien avec la commande suivante :
|
||||
|
||||
```bash
|
||||
redis-cli monitor
|
||||
```
|
||||
|
||||
Vous devriez voir le cache répondre en naviguant sur votre site :
|
||||
|
||||
|
||||
|
||||
|
||||
# Note de fin
|
||||
|
||||
Si vous souhaitez aller plus loin, vous pouvez regarder la mise en place des images au format WebP : [https://www.abyssproject.net/2020/05/mettre-en-place-les-images-au-format-webp-sur-son-site-avec-nginx/](https://www.abyssproject.net/2020/05/mettre-en-place-les-images-au-format-webp-sur-son-site-avec-nginx/)
|
||||
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
title: Welcome
|
||||
description: Welcome on my wiki
|
||||
published: true
|
||||
date: 2021-08-12T17:22:58.133Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-08-11T11:58:48.369Z
|
||||
-->
|
||||
|
||||
<p>Welcome to the Wiki of The Abyss Project.</p>
|
||||
<p>This wiki is the work of a System Administrator that share is knowledge about system administration, open-source technologies and networks.</p>
|
||||
<p>If any of this help, <a href="https://www.paypal.me/NSimond">you can buy me a drink</a> 🙂</p>
|
||||
<p>If you are a French reader, you can go to the French version of the wiki with the link on the top. You can also check my blog : <a href="https://www.abyssproject.net/">https://www.abyssproject.net/</a></p>
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Accueil
|
||||
description: Bienvenue sur mon wiki
|
||||
published: true
|
||||
date: 2021-08-13T15:18:38.941Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-11T11:56:50.951Z
|
||||
---
|
||||
|
||||
Bonjour et bienvenue sur le Wiki de The Abyss Project.
|
||||
|
||||
Le wiki d’un administrateur systèmes et réseaux qui vous partagent ses procédures et ses divagations dans son métier, le monde du libre, le réseau et la virtualisation entre autres.
|
||||
|
||||
Le partage est important dans notre métier, c’est pourquoi vous pouvez partager et réutiliser tout ce que vous trouverez dans ce blog selon la licence disponible en bas de chaque page.
|
||||
|
||||
Si jamais mes articles vous ont aidés, [vous pouvez me payer un café](https://www.paypal.me/NSimond) 🙂
|
||||
|
||||
Profitez également de votre voyage ici pour découvrir d’autres ressources intéressantes : [Le blog de Seboss666](https://blog.seboss666.info/), [le blog de Noobunbox](https://www.noobunbox.net/), [le blog de Julien](https://computerz.solutions/), [le blog de Djerfy](https://xorhak.io/), [le blog de Maxence](https://www.flemzord.fr/), [le blog libre](https://www.blog-libre.org/), [le blog de Carl](https://carlchenet.com/) et [le journal du hacker.](https://www.journalduhacker.net/)
|
||||
|
||||
Le blog est également toujours disponible : [https://www.abyssproject.net/](https://www.abyssproject.net/)
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Mon infrastructure personnelle
|
||||
description: L'infrastructure chez moi et en dehors de chez moi
|
||||
published: false
|
||||
date: 2021-08-24T16:01:37.963Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:01:35.860Z
|
||||
---
|
||||
|
||||
# ToDo
|
||||
ToDo
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Configuration de l’IPv6 chez Swisscom
|
||||
description: Configuration de l’IPv6 chez Swisscom sur une connexion Smart Business Connect
|
||||
published: false
|
||||
date: 2021-08-24T16:04:24.713Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:04:22.322Z
|
||||
---
|
||||
|
||||
# ToDo
|
||||
https://www.abyssproject.net/2019/12/configuration-de-lipv6-chez-swisscom/
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -0,0 +1,114 @@
|
||||
---
|
||||
title: Configurer les enregistrements DKIM, SPF et DMARC
|
||||
description: Configurer les enregistrements DKIM, SPF et DMARC obligatoires pour l’email
|
||||
published: true
|
||||
date: 2021-08-13T19:51:19.840Z
|
||||
tags: dkim, spf, dmarc
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-13T15:37:16.763Z
|
||||
---
|
||||
|
||||
> Article en cours de relecture
|
||||
{.is-warning}
|
||||
|
||||
|
||||
# Introduction
|
||||
|
||||
Nous allons voir comment configurer la sainte trinité qui vous permettra d’être copain avec tous les antispam au monde.
|
||||
|
||||
Les enregistrements DKIM, SPF et DMARC sont obligatoires de nos jours pour arriver dans la boite de réception et non dans les spams.
|
||||
|
||||
|
||||
# L’enregistrement SPF
|
||||
|
||||
L’enregistrement **SPF**, pour **Sender Policy Framework**, est un enregistrement tout bête qui permet d’indiquer au niveau des enregistrements DNS quels serveurs mails sont autorisés à envoyer des mails en votre nom. Rien d’autre.
|
||||
|
||||
Le principe est très simple, l’enregistrement devrait l’être aussi.
|
||||
|
||||
|
||||
|
||||
Ce que je vous conseille, et que normalement vous avez déjà, c’est d’avoir des enregistrements MX pour chacun de vos serveurs d’envoi d’email.
|
||||
|
||||
Si vous avez ça, alors, l’enregistrement SPF sera le plus simple du monde.
|
||||
|
||||
|
||||
|
||||
Vous faites simplement l’enregistrement suivant de type SPF (pour n’importe quel domaine) :
|
||||
|
||||
```dns
|
||||
v=spf1 mx -all
|
||||
```
|
||||
|
||||
|
||||
La première partie, c’est la version de SPF, **mx** sert à indiquer que l’on doit se référer aux MX existants sur le domaine pour avoir le serveur d’envoi et le **-all** permets de rejeter tous les emails qui ne sont pas envoyés de vos serveurs.
|
||||
|
||||
Alors ça c’est la version tout le monde il est beau, tout le monde il est content, en production, j’éviterais quand même.
|
||||
|
||||
|
||||
|
||||
Personnellement, j’indique **MX**, au cas où on oublierait de modifier les DNS, mais je rajoute tous les enregistrements **A:** avec les enregistrements de mes serveurs. Aussi, il est possible que les enregistrements MX globaux soit mal traités par l’antispam de destination (problèmes software ou autre).
|
||||
|
||||
Dernière chose, je remplace le **-all** par **~all**, ce qui permet de ne pas rejeter tout ce qui ne correspond pas en cas d’erreur légère sur le traitement du SPF (toujours si vous avez un antispam mal foutu de l’autre côté).
|
||||
|
||||
|
||||
|
||||
En gros, l’enregistrement réel pour mon domaine c’est ça :
|
||||
```dns
|
||||
v=spf1 mx a:mx1.nicolas-simond.ch a:mx2.nicolas-simond.ch a:mx3.nicolas-simond.ch ~all
|
||||
```
|
||||
|
||||
# L’enregistrement DKIM
|
||||
|
||||
Je résume vite fait, **DKIM** ajoute une signature chiffrée dans chaque entête d’email sortant (et juste une partie de l’entête, pas la totalité).
|
||||
|
||||
Cette signature, lorsque l’on réceptionne l’email permettra de savoir après déchiffrement si l’email a été altéré en cours de route.
|
||||
|
||||
|
||||
|
||||
La mise en place de DKIM se fait dans votre serveur email avant se faire dans le DNS.
|
||||
- Pour Exchange : https://www.abyssproject.net/2020/04/mettre-en-place-dkim-avec-exchange-2019/
|
||||
- Pour Office 365 : https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/use-dkim-to-validate-outbound-email?view=o365-worldwide
|
||||
- Pour tout ce qui est basé sur Postfix (le reste en gros) : https://wiki.debian-fr.xyz/Opendkim
|
||||
|
||||
|
||||
|
||||
|
||||
# L’enregistrement DMARC
|
||||
|
||||
Le dernier concurrent pour la fin. Toujours de façon simple, **DMARC** permets d’indiquer dans vos DNS ce qui doit se passer au cas où un serveur mail de destination aurait un souci avec vos enregistrements SPF ou DKIM, histoire que vous soyez prévenu.
|
||||
|
||||
Le côté maboulien du truc, c’est que vous pouvez indiquer depuis vos DNS de traiter tous VOS emails si jamais le destinataire n’arrive pas à valider votre SPF ou votre DKIM par exemple.
|
||||
|
||||
|
||||
|
||||
Si vous ne voulez pas que vos emails arrivent en quarantaine, mais que vous voulez avoir des rapports en cas de soucis, alors créez une règle comme ceci :
|
||||
|
||||
```dns
|
||||
Enregistrement : _dmarc
|
||||
Type : TXT
|
||||
Contenu : "v=DMARC1;p=none;sp=none;pct=100;rua=mailto:dmarc@domaine.com"
|
||||
```
|
||||
|
||||
|
||||
Comme pour le SPF, on commence par la version du protocole.
|
||||
|
||||
- **P** et **SP** sont respectivement les actions à appliquer pour les emails non conformes aux enregistrements SPF/DKIM venant de votre domaine ou d’un sous-domaine (none, quarantine ou block).
|
||||
- **PCT** c’est le pourcentage d’email qui tombent sous le coup de DMARC, on indique 100 pour filtrer tous les emails.
|
||||
- **RUA** c’est l’adresse email qui recevra les rapports en cas de souci de conformité sur SPF et/ou DKIM.
|
||||
|
||||
|
||||
# Test
|
||||
|
||||
Attendez bien 30 minutes avant de vous lancer dans cette section.
|
||||
|
||||
Selon votre hébergeur, cela pourrait même prendre jusqu’à 48h avec les propagations DNS.
|
||||
|
||||
Rendez-vous sur https://www.mail-tester.com/, le site vous fournira une adresse mail, envoyez-y simplement un email de test depuis n’importe quelle adresse de votre Exchange et cliquez sur « Check your score ».
|
||||
|
||||
Étendez la troisième rubrique et regardez tout ce qui est en rouge sur ma capture, vous devriez être pareil pour le DKIM, le SPF et le DMARC :
|
||||
|
||||

|
||||
|
||||
Si tout le reste est bien fait, vous devriez avoir 10/10. Si vous souhaitez regarder comment faire un Exchange de A à Z, voici les articles à voir :
|
||||
|
||||
- https://www.abyssproject.net/2018/06/installation-de-exchange-2016-de-a-a-z-pour-un-nouveau-domaine/
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Configuration des interfaces sous OPNSense
|
||||
description: Assignation des interfaces sur le hardware OPNSense
|
||||
published: false
|
||||
date: 2021-08-24T16:00:27.193Z
|
||||
tags: opnsense, interfaces
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:00:23.700Z
|
||||
---
|
||||
|
||||
# ToDo
|
||||
ToDo
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Réparer la synchronisation DFS du dossier SYSVOL
|
||||
description: Réparer la synchronisation DFS du dossier SYSVOL après un crash de la synchronisation AD
|
||||
published: false
|
||||
date: 2021-08-24T16:03:06.716Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-08-24T16:03:04.514Z
|
||||
---
|
||||
|
||||
# ToDo
|
||||
https://www.abyssproject.net/2018/11/reparer-la-synchronisation-dfs-du-dossier-sysvol/
|
||||
Reference in New Issue
Block a user