Mongrey Version 0.4.2
Transcription
Mongrey Version 0.4.2
Mongrey Version 0.4.2 16/05/2015 07:07:40 Table des matières 1 Fonctionnalités 2 Table des matières 2.1 Téléchargements . . . . . . . . 2.2 Mongrey - Installation . . . . . 2.3 Intégration . . . . . . . . . . . 2.4 Mongrey Configuration . . . . 2.5 Sécurité . . . . . . . . . . . . . 2.6 Migrations . . . . . . . . . . . 2.7 Copies d’Ecran . . . . . . . . . 2.8 Astuces . . . . . . . . . . . . . 2.9 Codes et Messages d’erreurs . . 2.10 Les autres projets de Liste Grise 2.11 Références . . . . . . . . . . . 2.12 Change Log . . . . . . . . . . 2.13 Glossaire . . . . . . . . . . . . 3 Index - Recherche 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 6 9 10 12 12 12 13 13 13 16 16 16 17 i ii Mongrey, Version 0.4.2 Version 0.4.2 Licence BSD Code github.com project Tickets github.com issues Author Mise à jour 16/05/2015 07 :07 :40 Doc EN English Documentation Doc FR French Documentation Builder https://github.com/radical-software/mongrey-build Table des matières 1 Mongrey, Version 0.4.2 2 Table des matières CHAPITRE 1 Fonctionnalités — — — — — — — — Serveur de Greylisting performant, ultra paramétrable et sécurisé Backends : MongoDB, PostgreSQL, MySQL, Sqlite Filtrage par adresse ip & cidr, expéditeur, destinataire, expression régulières Listes Blanches & Noires Contrôles anti-relais, anti-spoofing Cache Memoire ou Redis Application Web (facultative) En cours de développement : — Api REST — Filtres RBL, SPF — Interrogation d’annuaire DB, SMTP, LDAP 3 Mongrey, Version 0.4.2 4 Chapitre 1. Fonctionnalités CHAPITRE 2 Table des matières 2.1 Téléchargements Exemple d’installation avec la version Serveur - Backend MongoDB : $ curl -L http://download.mongrey.io/latest/mongrey-server-mongo-`uname -s`-`uname -m` > /usr/local/b $ chmod +x /usr/local/bin/mongrey-server $ /usr/local/bin/mongrey-server --version 2.1.1 Version intégrale Full Mongrey All (Contient le serveur et l’application Web ainsi que les drivers pour tous les backends) Serveur Mongrey Server All (Contient le serveur et les drivers pour tous les backends) Web Mongrey Web All (Contient l’application Web et les drivers pour tous les backends) 2.1.2 MongoDB Requis : — Linux Ubuntu 14.04+ ou CentOS 7 (64bits) — MongoDB Server 2.6.5+ Serveur Mongrey Server MongoDB Web UI Mongrey Web MongoDB 2.1.3 PostgreSQL Requis : — Linux Ubuntu 14.04+ ou CentOS 7 (64bits) — PostgreSQL Server 9.1+ Serveur Mongrey Server MongoDB Web UI Mongrey Web MongoDB 5 Mongrey, Version 0.4.2 2.1.4 MySQL Requis : — Linux Ubuntu 14.04+ ou CentOS 7 (64bits) — MySQL Server Serveur Mongrey Server MySQL Web UI Mongrey Web MySQL 2.1.5 Sqlite Serveur Mongrey Server Sqlite Web UI Mongrey Web Sqlite 2.2 Mongrey - Installation 2.2.1 Introduction Vous avez le choix entre plusieurs méthodes d’installation. La plus simple étant la version binaire adaptée au backend que vous utiliserez (MongoDB, PostgreSQL, ...). Les binaires sont des versions compilés à l’aide de l’outil PyInstaller et n’ont aucunes dépendances externes. Tous ces binaires ont été testés avec : — Ubuntu 14.04 (Trusty) - 64 bits — CentOS 7 - 64 bits — Python 2.7.6 Le processus de génération des binaires est visible sur Mongrey Build: 2.2.2 Exemples Version en cours : 0.4.2 Remplacez [RELEASE] et [BACKEND] par la version et le backend souhaité. — http://download.mongrey.io/[RELEASE]/mongrey-server-[BACKEND]-Linux-x86_64 Pour la version la plus récente avec un backend MongoDB, utilisez latest : — http://download.mongrey.io/latest/mongrey-server-mongo-Linux-x86_64 2.2.3 Mongrey Serveur MongoDB $ curl -L http://download.mongrey.io/latest/mongrey-server-mongo-`uname -s`-`uname -m` > /usr/local/b $ chmod +x /usr/local/bin/mongrey-server $ /usr/local/bin/mongrey-server --version 6 Chapitre 2. Table des matières Mongrey, Version 0.4.2 PostgreSQL $ curl -L http://download.mongrey.io/latest/mongrey-server-postgresql-`uname -s`-`uname -m` > /usr/lo $ chmod +x /usr/local/bin/mongrey-server $ /usr/local/bin/mongrey-server --version MySQL $ curl -L http://download.mongrey.io/latest/mongrey-server-mysql-`uname -s`-`uname -m` > /usr/local/b $ chmod +x /usr/local/bin/mongrey-server $ /usr/local/bin/mongrey-server --version 2.2.4 Docker Docker - Build Exemple avec la version binaire de Mongrey Server PostgreSQL : # Dockerfile FROM ubuntu:14.04 RUN apt-get update -y RUN DEBIAN_FRONTEND=noninteractive \ apt-get install -y --no-install-recommends \ ca-certificates git curl language-pack-en RUN curl -L http://download.mongrey.io/latest/mongrey-server-postgresql-`uname -s`-`uname -m` > /usr/ RUN chmod +x /usr/local/bin/mongrey-server CMD /usr/local/bin/mongrey-server start # Build du contenair $ docker build -t mongrey-server-postgresql . Docker - PostgreSQL Installez la version binaire de mongrey pour PostgreSQL $ docker pull postgres # Lancement du server $ docker run --name pgsql1 -e POSTGRES_PASSWORD=secret -d postgres # Création de la DB $ docker exec -it pgsql1 sh -c 'exec psql -c "create database mongrey_test2;" -U postgres' 2.2. Mongrey - Installation 7 Mongrey, Version 0.4.2 # Lancement de mongrey $ docker run -it --rm --link pgsql1:pgsql \ -e MONGREY_STORAGE=sql \ -e MONGREY_DB=postgresql://postgres:secret@pgsql/mongrey_test \ -e MONGREY_HOST=0.0.0.0 \ -e MONGREY_PORT=9999 \ -p 127.0.0.1:9997:9999 \ -v /usr/local/bin/mongrey-server:/usr/local/bin/mongrey-server \ ubuntu:14.04 /usr/local/bin/mongrey-server start Docker - MySQL Installez la version binaire de mongrey pour MySQL $ docker pull mysql # Lancement du server $ docker run --name mysql1 -e MYSQL_ROOT_PASSWORD=secret -d mysql # Création de la DB $ docker exec -it mysql1 sh -c 'exec mysql -e "create database mongrey_test;" -uroot -p"secret"' # Lancement de mongrey $ docker run -it --rm --link mysql1:mysql \ -e MONGREY_STORAGE=sql \ -e MONGREY_DB=mysql://root:secret@mysql/mongrey_test \ -e MONGREY_HOST=0.0.0.0 \ -e MONGREY_PORT=9999 \ -p 127.0.0.1:9997:9999 \ -v /usr/local/bin/mongrey-server:/usr/local/bin/mongrey-server \ ubuntu:14.04 /usr/local/bin/mongrey-server start 2.2.5 Mongrey Web MongoDB $ curl -L http://download.mongrey.io/latest/mongrey-web-mongo-`uname -s`-`uname -m` > /usr/local/bin/ $ chmod +x /usr/local/bin/mongrey-web $ /usr/local/bin/mongrey-web --help $ /usr/local/bin/mongrey-web server -p 8081 -h 127.0.0.1 # Ouvrez le navigateur à l'adresse http://127.0.0.1:8081 PostgreSQL $ curl -L http://download.mongrey.io/latest/mongrey-web-postgresql-`uname -s`-`uname -m` > /usr/local $ chmod +x /usr/local/bin/mongrey-web $ /usr/local/bin/mongrey-web --help 8 Chapitre 2. Table des matières Mongrey, Version 0.4.2 2.2.6 Installation par PIP Requis : — Linux récent (Ubuntu 14+, CentOS+) — Librairie de compilation — Python 2.7+ (python 3 non supporté pour l’instant) — Python Setuptools/Pip — Librairies optionnelles selon le backend (mysql, postgresql, ...) # Serveur et Web - Tous les backend $ pip install mongrey[full] # Serveur - Backend MongoDB $ pip install mongrey[server_mongodb] # Serveur - Tous les backend $ pip install mongrey[server] $ mongrey-server --help $ mongrey-web --help 2.2.7 APT À faire 2.2.8 RPM À faire 2.3 Intégration Note : Mongrey WEB est livré avec un serveur WSGI Gevent intégré très performant mais si vous avez besoin d’intégrer l’application dans Nginx ou Apache, vous pouvez suivre les procédures suivantes. 2.3.1 Mongrey Serveur 2.3.2 Mongrey WEB - WSGI À faire A tester Avertissement : Le téléchargement de Mongrey Web au format binaire n’est pas compatible avec cette installation. Il faut installer Mongrey Web normalement en utilisant la procédure par Installation par PIP 2.3. Intégration 9 Mongrey, Version 0.4.2 Gunicorn $ pip install gunicorn $ gunicorn -k gevent_wsgi --workers 1 'mongrey.web.wsgi:create_app()' Gunicorn - Supervisord [program:mongrey-web] command=gunicorn -k gevent_wsgi --workers 1 'mongrey.web.wsgi:create_app()' autostart=true autorestart=true redirect_stderr=True stdout_logfile=/var/log/supervisor/%(program_name)s.log stderr_logfile=/var/log/supervisor/%(program_name)s.log Chaussette À faire 2.3.3 Upstart http://upstart.ubuntu.com/ À faire 2.3.4 Systemd http://freedesktop.org/wiki/Software/systemd/ À faire 2.4 Mongrey Configuration 2.4.1 Mongrey Serveur Configuration par défaut Par défaut, Mongrey Serveur utilise les variables d’environnements mais vous pouvez aussi charger la configuration à partir d’un fichier YAML. La commande mongrey-server install crééer un fichier YAML avec la configuration par défaut. A chaque chargement, Mongrey Serveur, cherche un fichier de configuration facultatif : Note : — Ordre de recherche : 10 Chapitre 2. Table des matières Mongrey, Version 0.4.2 — — — — — — Valeur de l’option mongrey-server –settings myfile.yml Valeur de la variable d’environnement MONGREY_SERVER_SETTINGS ~/mongrey/server.yml ~/mongrey-server.yml /etc/mongrey-server.yml /etc/mongrey/server.yml Note : Le fichier YAML n’a pas besoin d’être rempli complètement Après son chargement, les valeurs sont concaténés avec la configuration par défaut (variables d’environnements) 2.4.2 Postfix intégration — Voir Postfix_Policy pour plus de détail #/etc/postfix/main.cf: smtpd_recipient_restrictions = ... reject_unauth_destination check_policy_service inet:127.0.0.1:9999 2.4.3 Politique de liste grise À faire 2.4.4 Liste Blanches À faire Liste Blanches 2.4.5 Géo-localisation À faire 2.4.6 Greylisting À faire 2.4. Mongrey Configuration 11 Mongrey, Version 0.4.2 2.5 Sécurité 2.5.1 Mongrey Serveur - IP Autorisés Défaut : 127.0.0.1, : :1 Par défaut, Mongrey Serveur n’accepte des connections qu’en provenance de l’ip loopback (127.0.0.1, : :1) Toutes autres connection est rejetés et une entrée de log permet à un outil comme Fail2ban d’agir dynamiquement sur le firewall. Si Fail2ban est activé et correctement paramètré, les prochaines tentatives seront arrêtés par le firewall. 2.5.2 Mongrey Web - IP Autorisés Défaut : Toutes Si vous utilisez le serveur WSGI intégré à Mongrey Web, vous pouvez activer la même protection par IP que Mongrey Serveur. 2.5.3 Fail2ban et iptables Fail2ban est un outil Python qui à partir de règles et des logs, permet de créer dynamiquement des règles de bloquage dans le firewall. C’est l’outil idéal pour combattre les attaques par force brute. 2.6 Migrations 2.6.1 Radical-Spam Le but de cette migration n’est pas de remplacer RadicalSpam mais seulement la partie Greylisting ainsi que certaines fonctionnalités assurés actuellement par Postfix à travers des fichiers plats. Données gérés par l’outil de migration : — Domaines internet (local-relays) — Autorisations Mynetwork (local-mynetwork-*) — Listes Noires (local-blacklist-*) — Mailbox (local-directory) 2.6.2 Postgrey À faire 2.7 Copies d’Ecran À faire 12 Chapitre 2. Table des matières Mongrey, Version 0.4.2 2.8 Astuces 2.8.1 Adresses IP variables 2.9 Codes et Messages d’erreurs 2.9.1 554 554 5.7.1 blacklisted 554 5.7.1 relay denied 554 5.7.1 spoofing 2.9.2 greylisted Exemple : 450 4.2.0 Greylisted for 30 seconds 2.10 Les autres projets de Liste Grise 2.10.1 Postgrey Url Postgrey Mise à jour Juin 2014 Techno Perl DB Supportées ? Web UI ? Licence ? 2.10.2 Bley Url Bley Mise à jour Mai 2015 Techno Python (Twisted Framework) DB Supportées ? Web UI ? Licence ? 2.10.3 Valvula Url http://www.aspl.es/valvula/ Mise à jour ? Techno C DB Supportées ? Web UI http://www.core-admin.com/portal/ (payante) Licence GPL 2.0 2.8. Astuces 13 Mongrey, Version 0.4.2 2.10.4 policyd-weight Url http://www.policyd-weight.org/ Mise à jour Septembre 2011 (maintenance mode) Techno Perl DB Supportées ? Web UI Non Licence ? 2.10.5 Gross Url https://code.google.com/p/gross/ Mise à jour Juin 2011 Techno C DB Supportées ? Web UI ? Licence ? 2.10.6 pfxpold Url https://github.com/mschmitt/pfxpold Mise à jour Juin 2010 Techno Perl DB Supportées ? Web UI ? Licence ? 2.10.7 policyd Url http://wiki.policyd.org/download Mise à jour Octobre 2013 Techno Perl DB Supportées ? Web UI ? Licence ? 2.10.8 ACL Policy Url http://www.apolicy.org/ Mise à jour Septembre 2008 Techno Python (Twisted Framework) DB Supportées ? Web UI ? Licence ? 14 Chapitre 2. Table des matières Mongrey, Version 0.4.2 2.10.9 Ppolicy Url http://kmlinux.fjfi.cvut.cz/~vokacpet/activities/ppolicy/ Mise à jour Décembre 2008 Techno Python (Twisted Framework) DB Supportées ? Web UI ? Licence ? 2.10.10 Tumgreyspf Url https://github.com/linsomniac/tumgreyspf Mise à jour Avril 2015 Techno Python DB Supportées ? Web UI ? Licence ? 2.10.11 Greyfix Url http://www.kim-minh.com/pub/greyfix/ Mise à jour Mars 2013 Techno C DB Supportées ? Web UI ? Licence ? 2.10.12 Sqlgrey (fork de Postgrey) Url http://sqlgrey.sourceforge.net/ Mise à jour Février 2012 Techno Perl DB Supportées ? Web UI ? Licence ? 2.10.13 Greylist Daemon Url http://mimo.gn.apc.org/greylist Mise à jour Octobre 2009 Techno C++ DB Supportées ? Web UI ? Licence ? 2.10. Les autres projets de Liste Grise 15 Mongrey, Version 0.4.2 2.10.14 Gld Url https://www.gasmi.net/progs.php Mise à jour Mai 2006 Techno C DB Supportées ? Web UI ? Licence ? 2.11 Références 2.12 Change Log À faire — — — — — — — — — — release : 0.4.2 by Stéphane RAULT at 2015-05-16 07 :06 :15 feature : update migration by Stéphane RAULT at 2015-05-16 07 :04 :53 tests : add tests by Stéphane RAULT at 2015-05-16 05 :58 :22 fix : requirements and slugify tests by Stéphane RAULT at 2015-05-16 05 :57 :44 fix : import mongo models in get_store for sql storage by Stéphane RAULT at 2015-05-16 05 :57 :17 update .gitignore and fabfile by Stéphane RAULT at 2015-05-16 04 :57 :25 docs : update docs by Stéphane RAULT at 2015-05-16 04 :56 :52 update requirements by Stéphane RAULT at 2015-05-16 04 :55 :35 tests : add tests by Stéphane RAULT at 2015-05-16 04 :54 :45 change : replace constants name by Stéphane RAULT at 2015-05-16 04 :54 :04 2.13 Glossaire Liste Grise — Définition par Wikipédia Greylisting binaire, Version binaire Pour faciliter l’utilisation de Mongrey, des binaires autonomes sont livrés pour chaque déclinaisons de Mongrey Chaque binaire est préparer à l’aide de PyInstaller et n’a besoin d’aucune installation supplémentaire, en dehors du backend (MongoDB, PostgreSQL ou MySQL). 16 Chapitre 2. Table des matières CHAPITRE 3 Index - Recherche — genindex — search 17 Mongrey, Version 0.4.2 18 Chapitre 3. Index - Recherche Index B binaire, 16 L Liste Grise, 16 V Version binaire, 16 19