amipo_weekend_reboot
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
amipo_weekend_reboot [2019/12/15 11:38] – bigMax | amipo_weekend_reboot [2020/10/09 07:08] (Version actuelle) – Tag0 Added: amipo serge | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
Pad: https:// | Pad: https:// | ||
===== Décisions ===== | ===== Décisions ===== | ||
- | ==== Audiance | + | ==== L' |
- | Tous public / ex: framasoft | + | Tous public / ex: framasoft, pas besoin d' |
==== Premier service à héberger ==== | ==== Premier service à héberger ==== | ||
- | Un service à heberger | + | Un service à héberger |
- | ===== TODO Tech ===== | + | ==== Actions du weekend |
- | - [_] Créer compte Benjamin | + | Nous nous motivons pour néttoyer la VM de production AMIPO pour y installer : |
- | - [_] Renforcer la configuration de nginx (bonnes pratiques de sécurité, php, ...) | + | * Debian 10 (buster) |
- | - [_] Renforcer la sécurité de nextcloud | + | * nginx |
- | - [_] Configurer nextcloud pour ne permettre dans un premier temps que très peu de stockage par utilisateur et privilégier les services de partage de calendrier et de contact (tout désactiver, | + | * postgresql |
- | - [_] Configuration du serveur SMTP | + | * nextcloud |
- | - [_] Mettre en place un backup automatisé des data sur le serveur (nextcloud, l' | + | |
- | - [_] Ecrire un script pour automatiser le téléchargement des backups à l' | + | Nous commençons en même temps à travailler sur : |
- | - [_] Renforcer la configuration de postgresql (sécurité, | + | * une refonte de la page d' |
- | - [_] Documenter les choix et delta d' | + | * les divers documents légaux à présenter aux utilisateurs. |
+ | |||
+ | ===== TODOs ===== | ||
+ | ==== Technique ==== | ||
+ | |||
+ | La TODO liste des choses à faire et en cours est sur le dépôt [[https:// | ||
+ | |||
+ | - [x] Configuration de DMARC et SPF sur le DNS amipo.fr | ||
+ | - [x] Créer compte Benjamin | ||
+ | - [x] Renforcer la configuration de nginx (bonnes pratiques de sécurité, php, ...) | ||
+ | - [x] Configuration du cron Nextcloud | ||
+ | - [x] Configuration du serveur SMTP | ||
+ | - [x] Mettre en place un backup automatisé des data sur le serveur (nextcloud, l' | ||
- [x] Finaliser la configuration nginx (redirection, | - [x] Finaliser la configuration nginx (redirection, | ||
- | - [_] Automatiser le renouvellement de certificats letsencrypt | ||
- | - [_] Historiser la config du serveur avec git pour tracer les changements (exemple un repo dans / | ||
- | - [_] Mettre en place un monitoring / alerting des services (homepage, calendriers, | ||
- | - [_] Dépôt Git pour /etc | ||
- [x] Fix warnings install Nextcloud | - [x] Fix warnings install Nextcloud | ||
- | + | ==== Organisationnel | |
- | ===== TODO orga ===== | + | |
* [_] Quand se revoit-on ? | * [_] Quand se revoit-on ? | ||
* [_] Comment travail t-on ? Tout le monde à un accès admin pour se connecter depuis chez lui ? | * [_] Comment travail t-on ? Tout le monde à un accès admin pour se connecter depuis chez lui ? | ||
- | ===== Work done ===== | + | ===== Revue / Tests ===== |
+ | ==== Ce qui fonctionne ==== | ||
+ | * Création de compte sur Nextcloud | ||
+ | * Création d'un agenda | ||
+ | * Import d'un agenda exterieur dans nextcloud | ||
+ | * Récupération d'un agenda nextcloud sur mon smartphone avec [[ https:// | ||
+ | * La réception des emails envoyés par le serveur | ||
+ | |||
+ | ==== Ce qui ne fonctionne pas ==== | ||
+ | |||
+ | Déplacé vers [[https:// | ||
+ | ==== Actions ==== | ||
+ | * [2019-12-19] Modification de la cronjob pour envoyer un email sans password dans le subject. (en cours de test) | ||
+ | * [2019-12-19] Ajout des privileges manquant sur la table public.oc_cms_pico_websites pour l' | ||
+ | * [2019-12-19] Configuration des politiques SPF et DMARC | ||
+ | * | ||
+ | |||
+ | ===== Work log ===== | ||
==== Mise à jour de l'OS du serveur ==== | ==== Mise à jour de l'OS du serveur ==== | ||
Passage de Debian Stretch à Buster : [[ https:// | Passage de Debian Stretch à Buster : [[ https:// | ||
Ligne 53: | Ligne 77: | ||
max_input_time = 20M | max_input_time = 20M | ||
</ | </ | ||
- | ==== Installation de Nginx ==== | + | ==== Nginx ==== |
+ | === Installation | ||
sudo apt install nginx | sudo apt install nginx | ||
| | ||
+ | === Configuration === | ||
+ | - Par défaut on utilise le domaine amipo.fr | ||
+ | - Toutes les requêtes sur un vhost différent de https:// | ||
+ | - Si la requête match un fichier dans / | ||
+ | - php n'est interprété nulle part si pas explicité. | ||
+ | |||
+ | === Renforcement === | ||
+ | [[ https:// | ||
+ | |||
+ | [[ https:// | ||
+ | <file conf / | ||
+ | # Remove version | ||
+ | server_tokens off; | ||
+ | |||
+ | # Control Buffer Overflow Attacks | ||
+ | client_body_buffer_size 1k; | ||
+ | client_header_buffer_size 1k; | ||
+ | client_max_body_size 1k; | ||
+ | large_client_header_buffers 4 1k; | ||
+ | |||
+ | # Prevent Clickjacking Attack (disable frame and iframe from other domain) | ||
+ | add_header X-Frame-Options " | ||
+ | |||
+ | # Add X-XSS Protection | ||
+ | add_header X-XSS-Protection "1; mode=block"; | ||
+ | </ | ||
+ | |||
==== Installation de certbot (letsencrypt) ==== | ==== Installation de certbot (letsencrypt) ==== | ||
sudo apt-get install certbot python-certbot-nginx | sudo apt-get install certbot python-certbot-nginx | ||
certbot certonly -d amipo.fr -d www.amipo.fr --webroot --webroot-path "/ | certbot certonly -d amipo.fr -d www.amipo.fr --webroot --webroot-path "/ | ||
certbot certonly -d amipo.fr -d www.amipo.fr --webroot --webroot-path "/ | certbot certonly -d amipo.fr -d www.amipo.fr --webroot --webroot-path "/ | ||
- | ==== Installation de postgresql | + | ==== Postgresql |
+ | |||
+ | === Installation | ||
sudo apt-get install postgresql-11 | sudo apt-get install postgresql-11 | ||
sudo apt install php7.3-pgsql | sudo apt install php7.3-pgsql | ||
+ | |||
+ | |||
+ | === Ajout d'un utilisateur pour les backups === | ||
+ | create role nextcloud_backup; | ||
+ | alter role nextcloud_backup encrypted password ' | ||
+ | alter role nextcloud_backup login; | ||
+ | grant connect on nextcloud to nextcloud_backup; | ||
+ | grant usage on schema public to nextcloud_backup; | ||
+ | grant select on all tables in schema public to nextcloud_backup; | ||
+ | grant select on all sequences in schema public to nextcloud_backup; | ||
| | ||
- | Activation de l' | + | ==== Cron jobs ==== |
- | extension=pdo_pgsql | + | |
+ | Exécution du cron de Nextcloud toutes les 5 minutes, penser à cocher l' | ||
+ | |||
+ | $ sudo crontab -u www-data -e | ||
+ | |||
+ | | ||
| | ||
+ | ==== Backup ==== | ||
+ | |||
+ | Un backup des fichiers et de la base est créé tous les jours à 2h du matin via le cron de www-data: | ||
+ | |||
+ | sudo crontab -l -u www-data | ||
+ | | ||
+ | Le script utilisé est / | ||
+ | |||
+ | Script : | ||
+ | |||
+ | # | ||
+ | | ||
+ | # exec 3>&1 4>&2 | ||
+ | # trap 'exec 2>&4 1>& | ||
+ | # exec 1> | ||
+ | # Everything below will go to the file ' | ||
+ | | ||
+ | echo " | ||
+ | DATE_START=`date` | ||
+ | echo " | ||
+ | | ||
+ | echo " | ||
+ | mkdir -p / | ||
+ | | ||
+ | echo " | ||
+ | php / | ||
+ | | ||
+ | echo " | ||
+ | pg_dump --username=nextcloud_backup -d nextcloud -h localhost | gzip > / | ||
+ | | ||
+ | echo " | ||
+ | | ||
+ | rsync -Aavx / | ||
+ | rsync -Aavx / | ||
+ | rsync -Aavx / | ||
+ | | ||
+ | echo " | ||
+ | php / | ||
+ | echo " | ||
+ | DATE_END=`date` | ||
+ | echo " | ||
+ | ==== Configurer l' | ||
+ | |||
+ | $ sudo dpkg-reconfigure exim4-config | ||
+ | |||
+ | Choisir le type de configuration : **internet site; mail is sent and received directly using SMTP** | ||
+ | |||
+ | Répondre aux questions suivantes avec le choix par défaut. S' | ||
+ | |||
+ | Configuration de Nextcloud via le fichier / | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | ==== Renforcer notre serveur email avec une politique DMARC et SPF ==== | ||
+ | |||
+ | * [[ https:// | ||
+ | * [[ https:// | ||
+ | |||
+ | Utilisations des generateurs : | ||
+ | * [[ https:// | ||
+ | * [[ https:// | ||
+ | |||
+ | Dans notre DNS ajouter 2 entry : | ||
+ | |||
+ | Type: TXT | ||
+ | Host/Name: _DMARC.amipo.fr | ||
+ | Value: v=DMARC1; p=none; rua=mailto: | ||
+ | |||
+ | et | ||
+ | |||
+ | Type: TXT | ||
+ | Host/Name: amipo.fr | ||
+ | Value: v=spf1 a ~all | ||
+ | | ||
+ | |||
==== Ressources installation Nextcloud ==== | ==== Ressources installation Nextcloud ==== | ||
Ligne 95: | Ligne 241: | ||
+ | {{tag> |
amipo_weekend_reboot.1576409907.txt.gz · Dernière modification : 2019/12/15 11:38 de bigMax