Ceci est une ancienne révision du document !
Table des matières
Service paste.chapril.org
Introduction
Ce service est basé sur privatebin
site principal : https://privatebin.info
sources : https://github.com/PrivateBin/PrivateBin
installation : https://github.com/PrivateBin/PrivateBin/wiki/Installation
Les données peuvent être stockées en SQL ou en fichier plat, ici la solution retenue est fichiers plats
Préparation
création d'un utilisateur (non indispensable mais fait pour chapril)
useradd pastechaprilorg usermod -a -G www-data pastechaprilorg
Ajouter le module php7.0-gd
apt-get install php7.0-gd
Installation
Déploiement du code
cd /var/www/ wget https://github.com/PrivateBin/PrivateBin/archive/1.1.1.tar.gz tar xf 1.1.1.tar.gz && rm 1.1.1.tar.gz mv PrivateBin-1.1.1 paste.chapril.org chown www-data:www-data -R /var/www/paste.chapril.org
Fichiers de logs
cd /var/log/apache2/ mkdir paste.chapril.org
Configuration d'apache2
Créer le fichier /etc/apache2/sites-avalailable/paste.chapril.org.conf avec le contenu ci-dessous
<VirtualHost *:80> ServerName paste.chapril.org ServerAdmin webmaster@localhost DocumentRoot /var/www/paste.chapril.org/ php_admin_value open_basedir "/var/www/paste.chapril.org/" <Directory "/var/www/paste.chapril.org/"> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/paste.chapril.org/paste.chapril.org-error.log CustomLog ${APACHE_LOG_DIR}/paste.chapril.org/paste.chapril.org-access.log combined-proxy </VirtualHost>
Activation de la configuration
a2ensite paste.chapril.org.conf systemctl reload apache2
Configuration
cd /var/www/paste.chapril.org/cfg cp conf.sample.php conf.php Dans la section [traffic] du fichier conf.php dir = PATH "/var/www/paste.chapril.org/data" Dans la section [purge] du fichier conf.php dir = PATH "data" Dans la section [model_options] du fichier conf.php dir = PATH "data"
Création d'un répertoire pour les données et affectation des droits
cd /var/www/paste.chapril.org mkdir data chown www-data:www-data data chmod -R u+rwX /var/www/paste.chapril.org/data
Rapport d'activité
Créer le répertoire rapport_activite dans /srv/paste.chapril.org/tools
mkdir /srv/paste.chapril.org/tools mkdir /srv/paste.chapril.org/tools/rapport_activite
Copier dans ce répertoire le script rapport_activite.sh https://agir.april.org/projects/paste-chapril-org/repository/pastechaprilorg-privatebin/revisions/chapril-1.2.1/entry/tools/rapport_activite.sh et le rendre executable. (Modifier si nécessaire la révision de chapril-1.2.1)
puis créer la tache cron en ajoutant un fichier pastechaprilorg dans /etc/cron.d avec la ligne suivante
1 0 1 * * root /srv/paste.chapril.org/tools/rapport_activite/rapport_activite.sh -p >> /srv/paste.chapril.org/Exploitation/rapport_paste.log 2>&1
Création d'un dossier de projet
Créer le répertoire /srv/paste.chapril.org/Exploitation Avec dedans un fichier rapport_paste.log
mkdir /srv/paste.chapril.org/Exploitation touch rapport_paste.log
Monitoring
Mettre dans le dossier /usr/lib/nagios/plugins un fichier check_pastechaprilorg_update et une copie dans /srv/paste.chapril.org/tools/monitoring
function usage() { echo "Usage : $0" } # if [ "$#" -ne 0 ]; then usage else lastVersion=$(curl -s https://privatebin.info/|grep Current|cut -d' ' -f3|cut -d'<' -f1) currentVersion=$(cd /var/www/paste.chapril.org && git branch | grep '*'|cut -c 11-100 ) #echo $lastVersion #echo $currentVersion if [ $currentVersion = $lastVersion ]; then echo "OK" result=0 else echo "WARNING : new version available, current is $currentVersion, last is $lastVersion." result=1 fi fi exit $result