1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/teampass_ynh.git synced 2024-09-03 20:26:37 +02:00

Upgrade to 2.1.27.15 and refactoring

This commit is contained in:
Maniack Crudelis 2018-05-22 20:01:55 +02:00
parent a11a88dfbf
commit a911e50897
27 changed files with 2128 additions and 630 deletions

View file

@ -1,33 +1,72 @@
Teampass for YunoHost # Teampass for YunoHost
==================
**Ce package n'est pas pleinement fonctionnel. Lisez bien ce qui suit avant de l'installer...** [![Integration level](https://dash.yunohost.org/integration/teampass.svg)](https://dash.yunohost.org/appci/app/teampass)
[![Install Teampass with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=teampass)
[Yunohost project](https://yunohost.org/#/) *[Lire ce readme en français.](./README_fr.md)*
Gestionnaire de mot de passe collaboratif. > *This package allow you to install teampass quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
http://www.teampass.net ## Overview
Teampass peut être configuré uniquement via le compte administrateur. Pour cela il faut s'identifier avec admin et le mot de passe choisi à l'installation. TeamPass is a Passwords Manager dedicated for managing passwords in a collaborative way by sharing them among team members.
Teampass offers a large set of features permitting to manage your passwords and related data in an organized way in respect to the access rights defined for each users.
Pour utiliser la fonction de sauvegarde automatique, il est nécessaire de mettre en place un cron contenant ceci dans /etc/cron.d/teampass: **Shipped version:** 2.1.27.15
```0 0 * * * www-data cd /var/www/teampass/backups && php script.backup.php```
**Mise à jour du package:** ## Screenshots
sudo yunohost app upgrade teampass -u https://github.com/YunoHost-Apps/teampass_ynh
**Multi-utilisateur:** Oui, avec support ldap. ![](https://teampass.net/images/portfolio/pf_tp_1.png)
**Voir l'état du package:** ## Demo
~*[Dernier rapport hebdomadaire](https://forum.yunohost.org/t/rapport-hebdomadaire-dintegration-continue/2297)*~
~*[Dernier test d'intégration continue](https://ci-apps.yunohost.org/jenkins/job/teampass%20%28Community%29/lastBuild/consoleFull)*~ No demo available.
## Configuration
Use the admin panel of your teampass to configure this app.
To find the admin panel, use the login 'admin' and the password choose during the installation.
## Documentation
* Official documentation: https://teampass.readthedocs.io/en/latest/
* YunoHost documentation: There no other documentations, feel free to contribute.
## YunoHost specific features
#### Multi-users support
Supported, with LDAP.
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/teampass%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/teampass%20(Community)/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/teampass%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/teampass%20(Community)%20(%7EARM%7E)/)
## Limitations
* **The upgrade script doesn't work from the version 2.1.26-3. A manual migration have to be done. For now we can't be sure that the upgrade script is going to work for the following upgrades.
Be aware that the upgrade could be not smoothly.**
## Additionnal informations
## Links
* Report a bug: https://github.com/YunoHost-Apps/teampass_ynh/issues
* Teampass website: https://teampass.net/
* YunoHost website: https://yunohost.org/
--- ---
> *Depuis la mise à jour 2.1.26-3, le support ldap est cassé. Mais des corrections de bug justifient un changement de version.* Developers infos
*Les utilisateurs sont dans la base de données de teampass, mais le mot est généré aléatoirement et devra être réinitialisé pour chaque utilisateur souhaitant utiliser l'application* ----------------
*Pour la première connexion, utiliser l'accès admin, avec le login 'admin' et le mot de passe renseigné à l'installation.*
> *les mails ne fonctionne pas non plus, donc impossible d'utiliser la fonction 'Mot de passe oublié'.* Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/teampass_ynh/tree/testing).
*Je pense que Teampass n'est toujours pas prêt... Le sera-t-il un jour ...?*
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/teampass_ynh/tree/testing --verbose
or
sudo yunohost app upgrade teampass -u https://github.com/YunoHost-Apps/teampass_ynh/tree/testing --verbose
```

72
README_fr.md Normal file
View file

@ -0,0 +1,72 @@
# Teampass pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/teampass.svg)](https://dash.yunohost.org/appci/app/teampass)
[![Installer Teampass avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=teampass)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer teampass rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/install_fr) pour savoir comment l'installer et en profiter.*
## Résumé
TeamPass est un gestionnaire de mots de passe dédié à la gestion collaborative des mots de passe en les partageant entre les membres de l'équipe.
Teampass offre un large éventail de fonctionnalités permettant de gérer vos mots de passe et données associées de manière organisée dans le respect des droits d'accès définis pour chaque utilisateur.
**Version embarquée:** 2.1.27.15
## Captures d'écran
![](https://teampass.net/images/portfolio/pf_tp_1.png)
## Demo
Pas de démo disponible.
## Configuration
Utilisez le panel admin de votre teampass pour configurer cette app.
Pour trouver le panel admin, utiliser le login 'admin' et le mot de passe choisi durant l'installation.
## Documentation
* Documentation officielle: https://teampass.readthedocs.io/en/latest/
* Documentation YunoHost: Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
## Fonctionnalités spécifiques à YunoHost
#### Support multi-utilisateurs
Supportée, avec LDAP.
#### Architectures supportées.
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/teampass%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/teampass%20(Community)/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/teampass%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/teampass%20(Community)%20(%7EARM%7E)/)
## Limitations
* **Le script de mise à jour ne fonctionne pas depuis la version 2.1.26-3. Une migration manuelle doit être effectuée. Pour l'instant, nous ne pouvons pas être sûrs que le script d'upgrade va fonctionner pour les mises à jour suivantes.
Sachez que la mise à niveau pourrait ne pas se faire sans difficultés.**
## Informations additionnelles
## Liens
* Reporter un bug: https://github.com/YunoHost-Apps/teampass_ynh/issues
* Site de teampass: https://teampass.net/
* Site de YunoHost: https://yunohost.org/
---
Informations à l'intention des développeurs
----------------
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/teampass_ynh/tree/testing).
Pour tester la branche testing, merci de procéder ainsi.
```
sudo yunohost app install https://github.com/YunoHost-Apps/teampass_ynh/tree/testing --verbose
ou
sudo yunohost app upgrade teampass -u https://github.com/YunoHost-Apps/teampass_ynh/tree/testing --verbose
```

117
YEP.md Normal file
View file

@ -0,0 +1,117 @@
#### [Level 0](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-0)
[YEP 1.1 - Nommer son app et son dépot](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated`
[YEP 1.2 - Inscrire l'app sur un "répertoire" connu](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-12)
`Validated`
#### [Level 1](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-1)
[YEP 2.2 - Utiliser bash pour les scripts principaux](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-22)
`Validated`
[YEP 2.5 - Copier correctement des fichiers](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-25)
`Don't know`
[YEP 2.7 - Donner des permissions suffisantes aux instructions bash](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-27)
`Validated`
[YEP 2.15 - Suivre les instructions d'installation de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-215)
`Validated`
#### [Level 2](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-2)
[YEP 1.5 - Mettre à jour régulièrement le statut de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated`
[YEP 2.18.2 - Gérer l'installation à la racine dun nom de domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2182)
`Validated` - *Automatically verified.*
[YEP 2.18.3 - Gérer l'installation sur un sous-domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2183)
`Validated` - *Automatically verified.*
[YEP 2.18.4 - Gérer l'installation sur un chemin /path](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2184)
`Validated` - *Automatically verified.*
[YEP 4.6 - Gère le multi-instance](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated` - *Automatically verified.*
#### [Level 3](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-3)
[YEP 2.3 - Sauvegarder les réponses lors de l'installation](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-23)
`Validated`
#### [Level 4](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-4)
[YEP 4.1 - Lier au ldap](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-41)
`Validated`
[YEP 4.2 - Lier l'authentification au sso](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-42)
`Not applicable`
#### [Level 5](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-5)
[YEP 1.3 - Indiquer la licence associée au paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-13)
`Validated`
[YEP 2.1 - Respecter le format du manifeste](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-21)
`Validated` - *Automatically verified.*
[YEP 2.12 - Utiliser les commandes pratiques (helpers)](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-212)
`Validated`
[YEP 2.18.1 - Lancer le script d'installation d'une webapp correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2181)
`Not applicable`
#### [Level 6](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-6)
[YEP 1.4 - Informer sur l'intention de maintenir un paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-14)
`Validated`
[YEP 1.6 - Se tenir informé sur l'évolution du packaging d'apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-16)
`Validated`
[YEP 1.7 - Ajouter l'app à l'organisation YunoHost-Apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-17)
`Validated` - *Automatically verified.*
[YEP 1.8 - Publier des demandes de test](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-18)
`Validated`
[YEP 1.9 - Documenter l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-19)
`Validated`
[YEP 1.10 - Garder un historique de version propre](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-110)
`Don't know`
[YEP 2.9 - Enlever toutes traces de l'app lors de la suppression](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-29)
`Validated`
[YEP 3.3 - Faciliter le contrôle de l'intégrité des sources](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-33)
`Validated`
[YEP 3.5 - Suivre les recommendations de la documentation de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-35)
`Partially validated`
[YEP 3.6 - Mettre à jour les versions contenant des CVE](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-36)
`Validated`
[YEP 4.3 - Fournir un script de sauvegarde YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-43)
`Validated` - *Automatically verified.*
[YEP 4.4 - Fournir un script de restauration YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-44)
`Validated` - *Automatically verified.*
#### [Level 7](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-7)
[YEP 2.6 - Annuler l'action si les valeurs d'entrées sont incorrectes](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-26)
`Validated`
[YEP 3.2 - Ouvrir un port correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-32)
`Not applicable`
#### [Level 8](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-8)
[YEP 2.4 - Détecter et gérer les erreurs](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-24)
`Validated`
[YEP 2.8 - Modifier correctement une configuration système](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-28)
`Validated`
[YEP 2.16 - Vérifier la disponibilité des dépendances sur ARM, x86 et x64](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-216)
`Not yet validated` - *Automatically verified.*
[YEP 2.18.5 - Gérer la tuile YunoHost pour faciliter la navigation entre les applications](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2185)
`Validated`
[YEP 3.4 - Isoler l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-34)
`Partially validated`
[YEP 4.5 - Utiliser les hooks](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-45)
`Not applicable`
#### [Level 9](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-9)
[YEP 2.10 - Configurer les logs de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-210)
`Not applicable`
[YEP 2.11 - Utiliser une variable plutôt que l'app id directement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-211)
`Validated`
[YEP 2.13 - Traduire le paquet en anglais](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-213)
`Not yet validated`
[YEP 2.14 - Remplir correctement un fichier de conf](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-214)
`Not yet validated`
[YEP 2.17 - Prendre en compte la version d'origine lors des mises à jour](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-217)
`Not yet validated`
[YEP 4.2.1 - Déconnexion](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-421)
`Validated`
#### Other YEP
[YEP 3.1 - Ne pas demander ou stocker de mot de passe LDAP](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-31)
`Validated`
[YEP 4.7 - Ajouter un module à la CLI](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-47)
`Not applicable`
[YEP 4.8 - Ajouter un module à l'admin web](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-48)
`Not applicable`
State of each YEP can be one of these: `Validated`, `Partially validated`, `Not yet validated`, `Not applicable`, `Don't know`.

View file

@ -11,18 +11,19 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
# upgrade=1 from_commit=
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=1
incorrect_path=1 incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=1
;;; Levels ;;; Levels
Level 1=auto Level 1=auto
Level 2=auto Level 2=auto
Level 3=auto # Upgrade to the next version could not work.
# Level 4: Level 3=0
Level 4=0 # Level 3=auto
# Level 5: Level 4=1
Level 5=auto Level 5=auto
Level 6=auto Level 6=auto
Level 7=auto Level 7=auto
@ -30,5 +31,9 @@
Level 9=0 Level 9=0
Level 10=0 Level 10=0
;;; Options ;;; Options
Email=maniackc_dev@crudelis.fr Email=
Notification=down Notification=down
;;; Upgrade options
; commit=
name=
manifest_arg=domain=DOMAIN&path=PATH&password=pass&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/2.1.26-final-3.tar.gz SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/2.1.27.15.tar.gz
SOURCE_SUM=ab57589c20e86c4e684b96241c6e73f4 SOURCE_SUM=92bf4a14b6b6d56c31e83052bfce44b5
SOURCE_SUM_PRG=md5sum SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,19 +0,0 @@
<?php
//function bCrypt tirée directement de sources/main.functions.php, ligne 223.
function bCrypt($password, $cost)
{
$salt = sprintf('$2y$%02d$', $cost);
if (function_exists('openssl_random_pseudo_bytes')) {
$salt .= bin2hex(openssl_random_pseudo_bytes(11));
} else {
$chars='./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for ($i=0; $i<22; $i++) {
$salt.=$chars[mt_rand(0, 63)];
}
}
return crypt($password, $salt);
}
// Le script prend en argument le mot de passe à chiffrer
echo bCrypt("$argv[1]",'13')."\n";
?>

View file

@ -1,4 +1,5 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
alias __FINALPATH__/; alias __FINALPATH__/;
if ($scheme = http) { if ($scheme = http) {

View file

@ -1,8 +1,9 @@
-- Infos à charger en base de donnée tirée du fichier install/install.queries.php. A partir de la ligne 248 -- Infos à charger en base de donnée tirée du fichier install/install.queries.php. A partir de la ligne 295 (step_5)
-- Use the script teampass_pre_upgrade_ynh/conf/diff_populate_sql.sh and search step_5 to find what's new.
ALTER DATABASE `teampass` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER DATABASE `__APP__` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `teampass`; USE `__APP__`;
CREATE TABLE IF NOT EXISTS `teampass_items` ( CREATE TABLE IF NOT EXISTS `teampass_items` (
`id` int(12) NOT null AUTO_INCREMENT, `id` int(12) NOT null AUTO_INCREMENT,
@ -23,134 +24,191 @@ CREATE TABLE IF NOT EXISTS `teampass_items` (
`viewed_no` int(12) NOT null DEFAULT '0', `viewed_no` int(12) NOT null DEFAULT '0',
`complexity_level` varchar(3) NOT null DEFAULT '-1', `complexity_level` varchar(3) NOT null DEFAULT '-1',
`auto_update_pwd_frequency` tinyint(2) NOT null DEFAULT '0', `auto_update_pwd_frequency` tinyint(2) NOT null DEFAULT '0',
`auto_update_pwd_next_date` int(15) NOT null DEFAULT '0', `auto_update_pwd_next_date` varchar(100) NOT null DEFAULT '0',
`encryption_type` VARCHAR(20) NOT NULL DEFAULT 'not_set',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `restricted_inactif_idx` (`restricted_to`,`inactif`) KEY `restricted_inactif_idx` (`restricted_to`,`inactif`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_log_items` ( CREATE TABLE IF NOT EXISTS `teampass_log_items` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT,
`id_item` int(8) NOT NULL, `id_item` int(8) NOT NULL,
`date` varchar(50) NOT NULL, `date` varchar(50) NOT NULL,
`id_user` int(8) NOT NULL, `id_user` int(8) NOT NULL,
`action` varchar(250) NULL, `action` varchar(250) NULL,
`raison` text NULL, `raison` text NULL,
`raison_iv` text NULL `raison_iv` text NULL,
`encryption_type` VARCHAR(20) NOT NULL DEFAULT 'not_set',
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE INDEX `teampass_log_items_id_item_IDX` ON `teampass_log_items` (`id_item`,`date`); CREATE INDEX `teampass_log_items_id_item_IDX` ON `teampass_log_items` (`id_item`,`date`);
CREATE TABLE IF NOT EXISTS `teampass_misc` ( CREATE TABLE IF NOT EXISTS `teampass_misc` (
`increment_id` int(12) NOT null AUTO_INCREMENT,
`type` varchar(50) NOT NULL, `type` varchar(50) NOT NULL,
`intitule` varchar(100) NOT NULL, `intitule` varchar(100) NOT NULL,
`valeur` varchar(100) NOT NULL `valeur` varchar(500) NOT NULL,
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
INSERT INTO `teampass_misc` (`type`, `intitule`, `valeur`) VALUES INSERT INTO `teampass_misc` (`type`, `intitule`, `valeur`) VALUES
('admin','max_latest_items', '10'), ('admin', 'max_latest_items', '10'),
('admin','enable_favourites', '1'), ('admin', 'enable_favourites', '1'),
('admin','show_last_items', '1'), ('admin', 'show_last_items', '1'),
('admin','enable_pf_feature', '1'), ('admin', 'enable_pf_feature', '1'),
('admin','log_connections', '0'), ('admin', 'log_connections', '0'),
('admin','log_accessed', '0'), ('admin', 'log_accessed', '0'),
('admin','time_format', 'H:i:s'), ('admin', 'time_format', 'H:i:s'),
('admin','date_format', 'd/m/Y'), ('admin', 'date_format', 'd/m/Y'),
('admin','duplicate_folder', '0'), ('admin', 'duplicate_folder', '0'),
('admin','item_duplicate_in_same_folder', '0'), ('admin', 'item_duplicate_in_same_folder', '0'),
('admin','duplicate_item', '0'), ('admin', 'duplicate_item', '1'),
('admin','number_of_used_pw', '3'), ('admin', 'number_of_used_pw', '3'),
('admin','manager_edit', '1'), ('admin', 'manager_edit', '1'),
('admin','cpassman_dir', '__FINALPATH__'), ('admin', 'cpassman_dir', '__FINALPATH__'),
('admin','cpassman_url', 'https://__DOMAIN____PATH__'), ('admin', 'cpassman_url', 'https://__DOMAIN____PATH__'),
('admin','favicon', 'https://__DOMAIN____PATH__/favico.ico'), ('admin', 'favicon', 'https://__DOMAIN____PATH__/favico.ico'),
('admin','path_to_upload_folder', '__FINALPATH__/upload'), ('admin', 'path_to_upload_folder', '__FINALPATH__/upload'),
('admin','url_to_upload_folder', 'https://__DOMAIN____PATH__/upload'), ('admin', 'url_to_upload_folder', 'https://__DOMAIN____PATH__/upload'),
('admin','path_to_files_folder', '__FINALPATH__/files'), ('admin', 'path_to_files_folder', '__FINALPATH__/files'),
('admin','url_to_files_folder', 'https://__DOMAIN____PATH__/files'), ('admin', 'url_to_files_folder', 'https://__DOMAIN____PATH__/files'),
('admin','activate_expiration', '0'), ('admin', 'activate_expiration', '0'),
('admin','pw_life_duration','0'), ('admin', 'pw_life_duration', '0'),
('admin','maintenance_mode','0'), ('admin', 'maintenance_mode', '0'),
('admin','enable_sts','0'), ('admin', 'enable_sts', '0'),
('admin','encryptClientServer','1'), ('admin', 'encryptClientServer', '1'),
('admin','cpassman_version','__VERSION__'), ('admin', 'cpassman_version','__VERSION__'),
-- ('admin','ldap_mode','1'), ('admin', 'ldap_mode', '1'),
-- ldap ne fonctionne plus sur cette version de teampass... ('admin', 'ldap_type','posix-search'),
('admin','ldap_mode','0'), ('admin', 'ldap_suffix', '0'),
('admin','ldap_type','posix-search'), ('admin', 'ldap_domain_dn', '0'),
('admin','ldap_suffix','0'), ('admin', 'ldap_domain_controler', 'localhost'),
('admin','ldap_domain_dn','0'), ('admin', 'ldap_user_attribute', 'uid'),
('admin','ldap_domain_controler','localhost'), ('admin', 'ldap_ssl', '0'),
('admin','ldap_user_attribute','uid'), ('admin', 'ldap_tls', '0'),
('admin','ldap_search_base','ou=users,dc=yunohost,dc=org'), ('admin', 'ldap_elusers', '0'),
('admin','ldap_ssl','0'), ('admin', 'ldap_search_base', 'ou=users,dc=yunohost,dc=org'),
('admin','ldap_tls','0'), ('admin', 'ldap_port', '389'),
('admin','ldap_elusers','0'), ('admin', 'richtext', '0'),
('admin','richtext','0'), ('admin', 'allow_print', '1'),
('admin','allow_print','1'), ('admin', 'roles_allowed_to_print', '1'),
('admin','roles_allowed_to_print','1'), ('admin', 'show_description', '1'),
('admin','show_description','1'), ('admin', 'anyone_can_modify', '0'),
('admin','anyone_can_modify','0'), ('admin', 'anyone_can_modify_bydefault', '0'),
('admin','anyone_can_modify_bydefault','0'), ('admin', 'nb_bad_authentication', '3'),
('admin','nb_bad_authentication','0'), ('admin', 'utf8_enabled', '1'),
('admin','utf8_enabled','1'), ('admin', 'restricted_to', '0'),
('admin','restricted_to','0'), ('admin', 'restricted_to_roles', '0'),
('admin','restricted_to_roles','0'), ('admin', 'enable_send_email_on_user_login', '0'),
('admin','enable_send_email_on_user_login','0'), ('admin', 'enable_user_can_create_folders', '1'),
('admin','enable_user_can_create_folders','1'), ('admin', 'insert_manual_entry_item_history', '0'),
('admin','insert_manual_entry_item_history','0'), ('admin', 'enable_kb', '0'),
('admin','enable_kb','0'), ('admin', 'enable_email_notification_on_item_shown', '0'),
('admin','enable_email_notification_on_item_shown','0'), ('admin', 'enable_email_notification_on_user_pw_change', '1'),
('admin','enable_email_notification_on_user_pw_change','1'), ('admin', 'custom_logo', ''),
('admin','custom_logo',''), ('admin', 'custom_login_text', ''),
('admin','custom_login_text',''), ('admin', 'default_language', '__LANG__'),
('admin','default_language','__LANG__'), ('admin', 'send_stats', '0'),
('admin','send_stats', '0'), ('admin', 'send_statistics_items', 'stat_country;stat_users;stat_items;stat_items_shared;stat_folders;stat_folders_shared;stat_admins;stat_managers;stat_ro;stat_mysqlversion;stat_phpversion;stat_teampassversion;stat_languages;stat_kb;stat_suggestion;stat_customfields;stat_api;stat_2fa;stat_agses;stat_duo;stat_ldap;stat_syslog;stat_stricthttps;stat_fav;stat_pf;'),
('admin','get_tp_info', '1'), ('admin', 'send_stats_time', '3600'),
('admin','send_mail_on_user_login', '0'), ('admin', 'get_tp_info', '1'),
('admin', 'send_mail_on_user_login', '0'),
('cron', 'sending_emails', '0'), ('cron', 'sending_emails', '0'),
('admin','nb_items_by_query', 'auto'), ('admin', 'nb_items_by_query', 'auto'),
('admin','enable_delete_after_consultation', '0'), ('admin', 'enable_delete_after_consultation', '0'),
('admin','enable_personal_saltkey_cookie', '0'), ('admin', 'enable_personal_saltkey_cookie', '0'),
('admin','personal_saltkey_cookie_duration', '31'), ('admin', 'personal_saltkey_cookie_duration', '31'),
('admin','email_smtp_server', 'localhost'), ('admin', 'email_smtp_server', 'localhost'),
('admin','email_smtp_auth', 'false'), ('admin', 'email_smtp_auth', 'false'),
('admin','email_auth_username', ''), ('admin', 'email_auth_username', ''),
('admin','email_auth_pwd', ''), ('admin', 'email_auth_pwd', ''),
('admin','email_port', '465'), ('admin', 'email_port', '465'),
('admin','email_security', 'tls'), ('admin', 'email_security', 'tls'),
('admin','email_server_url', 'https://__DOMAIN____PATH__'), ('admin', 'email_server_url', 'https://__DOMAIN____PATH__'),
('admin','email_from', 'root@__DOMAIN__'), ('admin', 'email_from', 'root@__DOMAIN__'),
('admin','email_from_name', 'Teampass'), ('admin', 'email_from_name', 'Teampass'),
('admin','pwd_maximum_length', '100'), ('admin', 'pwd_maximum_length', '100'),
('admin','google_authentication', '0'), ('admin', 'google_authentication', '0'),
('admin','delay_item_edition', '0'), ('admin', 'delay_item_edition', '0'),
('admin','allow_import','1'), ('admin', 'allow_import', '1'),
('admin','proxy_ip',''), ('admin', 'proxy_ip', ''),
('admin','proxy_port',''), ('admin', 'proxy_port', ''),
('admin','upload_maxfilesize','10mb'), ('admin', 'upload_maxfilesize', '10mb'),
('admin','upload_docext','doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx'), ('admin', 'upload_docext', 'doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx'),
('admin','upload_imagesext','jpg,jpeg,gif,png'), ('admin', 'upload_imagesext', 'jpg,jpeg,gif,png'),
('admin','upload_pkgext','7z,rar,tar,zip'), ('admin', 'upload_pkgext', '7z,rar,tar,zip'),
('admin','upload_otherext','sql,xml'), ('admin', 'upload_otherext', 'sql,xml'),
('admin','upload_imageresize_options','1'), ('admin', 'upload_imageresize_options', '1'),
('admin','upload_imageresize_width','800'), ('admin', 'upload_imageresize_width', '800'),
('admin','upload_imageresize_height','600'), ('admin', 'upload_imageresize_height', '600'),
('admin','upload_imageresize_quality','90'), ('admin', 'upload_imageresize_quality', '90'),
('admin','use_md5_password_as_salt','1'), ('admin', 'use_md5_password_as_salt', '1'),
('admin','ga_website_name','TeamPass for ChangeMe'), ('admin', 'ga_website_name', 'TeamPass for ChangeMe'),
('admin','api','0'), ('admin', 'api', '0'),
('admin','subfolder_rights_as_parent','1'), ('admin', 'subfolder_rights_as_parent', '1'),
('admin','show_only_accessible_folders','1'), ('admin', 'show_only_accessible_folders', '1'),
('admin','enable_suggestion','0'), ('admin', 'enable_suggestion', '0'),
('admin','otv_expiration_period','7'), ('admin', 'otv_expiration_period', '7'),
('admin','default_session_expiration_time','60'), ('admin', 'default_session_expiration_time', '60'),
('admin', 'duo', '0'), ('admin', 'duo', '0'),
('admin','enable_server_password_change','0'), ('admin', 'enable_server_password_change', '0'),
('admin','ldap_object_class','0'), ('admin', 'ldap_object_class', 'person'),
('admin','bck_script_path','__FINALPATH__/backups/'), ('admin', 'bck_script_path', '__FINALPATH__/backups/'),
('admin','bck_script_filename', 'bck_cpassman'), ('admin', 'bck_script_filename', 'bck_teampass'),
('admin','syslog_enable','0'), ('admin', 'syslog_enable', '0'),
('admin','syslog_host','localhost'), ('admin', 'syslog_host', 'localhost'),
('admin','syslog_port','514'); ('admin', 'syslog_port', '514'),
('admin', 'manager_move_item', '0'),
('admin', 'create_item_without_password', '1'),
('admin', 'otv_is_enabled', '1'),
('admin', 'agses_authentication_enabled', '0'),
('admin', 'item_extra_fields', '0'),
('admin', 'saltkey_ante_2127', 'none'),
('admin', 'migration_to_2127', 'done'),
('admin', 'files_with_defuse', 'done'),
('admin', 'timezone', 'UTC'),
('admin', 'enable_attachment_encryption', '1'),
('admin', 'personal_saltkey_security_level', '50'),
('admin', 'ldap_new_user_is_administrated_by', '0'),
('admin', 'disable_show_forgot_pwd_link', '1'),
('admin', 'offline_key_level', '0'),
('admin', 'enable_http_request_login', '0'),
('admin', 'ldap_and_local_authentication', '0');
-- Default value
--('admin', 'enable_pf_feature', '0'),
--('admin', 'log_connections', '1'),
--('admin', 'log_accessed', '1'),
--('admin', 'duplicate_item', '0'),
--('admin', 'maintenance_mode', '1'),
--('admin', 'ldap_mode', '0'),
--('admin', 'ldap_type', '0'),
--('admin', 'ldap_domain_controler', '0'),
--('admin', 'ldap_user_attribute', '0'),
--('admin', 'ldap_search_base', '0'),
--('admin', 'allow_print', '0'),
--('admin', 'roles_allowed_to_print', '0'),
--('admin', 'nb_bad_authentication', '0'),
--('admin', 'enable_user_can_create_folders', '0'),
--('admin', 'enable_email_notification_on_user_pw_change', '0'),
--('admin', 'default_language', 'english'),
--('admin', 'email_smtp_server', ''),
--('admin', 'email_smtp_auth', ''),
--('admin', 'email_port', ''),
--('admin', 'email_security', ''),
--('admin', 'email_server_url', ''),
--('admin', 'email_from', ''),
--('admin', 'email_from_name', ''),
--('admin', 'pwd_maximum_length', '40'),
--('admin', 'allow_import', '0'),
--('admin', 'use_md5_password_as_salt', '0'),
--('admin', 'subfolder_rights_as_parent', '0'),
--('admin', 'show_only_accessible_folders', '0'),
--('admin', 'ldap_object_class', '0'),
--('admin', 'create_item_without_password', '0'),
--('admin', 'otv_is_enabled', '1'),
--('admin', 'disable_show_forgot_pwd_link', '0'),
CREATE TABLE IF NOT EXISTS `teampass_nested_tree` ( CREATE TABLE IF NOT EXISTS `teampass_nested_tree` (
`id` bigint(20) unsigned NOT null AUTO_INCREMENT, `id` bigint(20) unsigned NOT null AUTO_INCREMENT,
@ -164,7 +222,6 @@ CREATE TABLE IF NOT EXISTS `teampass_nested_tree` (
`personal_folder` tinyint(1) NOT null DEFAULT '0', `personal_folder` tinyint(1) NOT null DEFAULT '0',
`renewal_period` TINYINT(4) NOT null DEFAULT '0', `renewal_period` TINYINT(4) NOT null DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `nested_tree_parent_id` (`parent_id`), KEY `nested_tree_parent_id` (`parent_id`),
KEY `nested_tree_nleft` (`nleft`), KEY `nested_tree_nleft` (`nleft`),
KEY `nested_tree_nright` (`nright`), KEY `nested_tree_nright` (`nright`),
@ -172,7 +229,7 @@ CREATE TABLE IF NOT EXISTS `teampass_nested_tree` (
KEY `personal_folder_idx` (`personal_folder`) KEY `personal_folder_idx` (`personal_folder`)
) CHARSET=utf8; ) CHARSET=utf8;
-- INSERT INTO teampass_nested_tree VALUES("1","0","__FOLDERS__","1","2","1","0","0","0","0"); INSERT INTO teampass_nested_tree VALUES("1","0","__FOLDERS__","1","2","1","0","0","0","0");
CREATE TABLE IF NOT EXISTS `teampass_rights` ( CREATE TABLE IF NOT EXISTS `teampass_rights` (
`id` int(12) NOT null AUTO_INCREMENT, `id` int(12) NOT null AUTO_INCREMENT,
@ -196,41 +253,45 @@ CREATE TABLE IF NOT EXISTS `teampass_users` (
`groupes_interdits` varchar(255) NULL, `groupes_interdits` varchar(255) NULL,
`last_connexion` varchar(30) NULL, `last_connexion` varchar(30) NULL,
`gestionnaire` int(11) NOT null DEFAULT '0', `gestionnaire` int(11) NOT null DEFAULT '0',
`email` varchar(300) NOT NULL, `email` varchar(300) NOT NULL DEFAULT 'none',
`favourites` varchar(300) NULL, `favourites` varchar(300) NULL,
`latest_items` varchar(300) NULL, `latest_items` varchar(300) NULL,
`personal_folder` int(1) NOT null DEFAULT '0', `personal_folder` int(1) NOT null DEFAULT '0',
`disabled` tinyint(1) NOT null DEFAULT '0', `disabled` tinyint(1) NOT null DEFAULT '0',
`no_bad_attempts` tinyint(1) NOT null DEFAULT '0', `no_bad_attempts` tinyint(1) NOT null DEFAULT '0',
`can_create_root_folder` tinyint(1) NOT null DEFAULT '0', `can_create_root_folder` tinyint(1) NOT null DEFAULT '1',
`read_only` tinyint(1) NOT null DEFAULT '0', `read_only` tinyint(1) NOT null DEFAULT '0',
`timestamp` varchar(30) NOT null DEFAULT '0', `timestamp` varchar(30) NOT null DEFAULT '0',
`user_language` varchar(30) NOT null DEFAULT 'french', `user_language` varchar(50) NOT null DEFAULT '0',
`name` varchar(100) NULL, `name` varchar(100) NULL,
`lastname` varchar(100) NULL, `lastname` varchar(100) NULL,
`session_end` varchar(30) NULL, `session_end` varchar(30) NULL,
`isAdministratedByRole` tinyint(5) NOT null DEFAULT '0', `isAdministratedByRole` tinyint(5) NOT null DEFAULT '0',
`psk` varchar(400) NULL, `psk` varchar(400) NULL,
`ga` varchar(50) NULL, `ga` varchar(50) NULL,
`ga_temporary_code` VARCHAR(20) NOT NULL DEFAULT 'none',
`avatar` varchar(255) NULL, `avatar` varchar(255) NULL,
`avatar_thumb` varchar(255) NULL, `avatar_thumb` varchar(255) NULL,
`upgrade_needed` BOOLEAN NOT NULL DEFAULT FALSE, `upgrade_needed` BOOLEAN NOT NULL DEFAULT FALSE,
`treeloadstrategy` varchar(30) NOT null DEFAULT 'full', `treeloadstrategy` varchar(30) NOT null DEFAULT 'full',
`can_manage_all_users` tinyint(1) NOT NULL DEFAULT '0', `can_manage_all_users` tinyint(1) NOT NULL DEFAULT '0',
`usertimezone` VARCHAR(50) NOT NULL DEFAULT 'not_defined', `usertimezone` VARCHAR(50) NOT NULL DEFAULT 'not_defined',
`agses-usercardid` VARCHAR(50) NOT NULL DEFAULT '0',
`encrypted_psk` text NULL,
`user_ip` varchar(400) NOT null DEFAULT 'none',
`user_api_key` varchar(500) NOT null DEFAULT 'none',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`) UNIQUE KEY `login` (`login`)
) CHARSET=utf8; ) CHARSET=utf8;
INSERT INTO `teampass_users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`, `fonction_id`, `groupes_interdits`, `last_connexion`, `gestionnaire`, `email`, `favourites`, `latest_items`, `personal_folder`) VALUES INSERT INTO `teampass_users` (`id`, `login`, `pw`, `admin`, `gestionnaire`, `personal_folder`, `groupes_visibles`, `email`, `encrypted_psk`, `last_pw_change`) VALUES
(NULL, 'admin', '__BCRYPT_MDP__', '', '', '', '', '', '1', '', '', '', '0', 'admin@__DOMAIN__', '', '', '0'); ('1', 'admin', '__BCRYPT_MDP__', '1', '0', '0', '', '', '', '__TIME__');
CREATE TABLE IF NOT EXISTS `teampass_tags` ( CREATE TABLE IF NOT EXISTS `teampass_tags` (
`id` int(12) NOT null AUTO_INCREMENT, `id` int(12) NOT null AUTO_INCREMENT,
`tag` varchar(30) NOT NULL, `tag` varchar(30) NOT NULL,
`item_id` int(12) NOT NULL, `item_id` int(12) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`)
UNIQUE KEY `id` (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_log_system` ( CREATE TABLE IF NOT EXISTS `teampass_log_system` (
@ -251,10 +312,12 @@ CREATE TABLE IF NOT EXISTS `teampass_files` (
`extension` varchar(10) NOT NULL, `extension` varchar(10) NOT NULL,
`type` varchar(255) NOT NULL, `type` varchar(255) NOT NULL,
`file` varchar(50) NOT NULL, `file` varchar(50) NOT NULL,
`status` varchar(50) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_cache` ( CREATE TABLE IF NOT EXISTS `teampass_cache` (
`increment_id`INT(12) NOT NULL AUTO_INCREMENT,
`id` int(12) NOT NULL, `id` int(12) NOT NULL,
`label` varchar(500) NOT NULL, `label` varchar(500) NOT NULL,
`description` text NOT NULL, `description` text NOT NULL,
@ -267,7 +330,9 @@ CREATE TABLE IF NOT EXISTS `teampass_cache` (
`author` varchar(50) NOT NULL, `author` varchar(50) NOT NULL,
`renewal_period` tinyint(4) NOT NULL DEFAULT '0', `renewal_period` tinyint(4) NOT NULL DEFAULT '0',
`timestamp` varchar(50) DEFAULT NULL, `timestamp` varchar(50) DEFAULT NULL,
`url` varchar(500) NOT NULL DEFAULT '0' `url` varchar(500) NOT NULL DEFAULT '0',
`encryption_type` VARCHAR(50) DEFAULT NULL DEFAULT '0',
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_roles_title` ( CREATE TABLE IF NOT EXISTS `teampass_roles_title` (
@ -282,13 +347,14 @@ CREATE TABLE IF NOT EXISTS `teampass_roles_title` (
INSERT INTO teampass_roles_title VALUES("1","__ROLES__","0","0","1"); INSERT INTO teampass_roles_title VALUES("1","__ROLES__","0","0","1");
CREATE TABLE IF NOT EXISTS `teampass_roles_values` ( CREATE TABLE IF NOT EXISTS `teampass_roles_values` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`role_id` int(12) NOT NULL, `role_id` int(12) NOT NULL,
`folder_id` int(12) NOT NULL, `folder_id` int(12) NOT NULL,
`type` varchar(5) NOT NULL DEFAULT 'R', `type` varchar(5) NOT NULL DEFAULT 'R',
KEY `role_id_idx` (`role_id`) KEY `role_id_idx` (`role_id`)
) CHARSET=utf8; ) CHARSET=utf8;
INSERT INTO teampass_roles_values VALUES("1","1","W"); INSERT INTO teampass_roles_values VALUES("1","1","1","W");
CREATE TABLE IF NOT EXISTS `teampass_kb` ( CREATE TABLE IF NOT EXISTS `teampass_kb` (
`id` int(12) NOT null AUTO_INCREMENT, `id` int(12) NOT null AUTO_INCREMENT,
@ -307,22 +373,26 @@ CREATE TABLE IF NOT EXISTS `teampass_kb_categories` (
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_kb_items` ( CREATE TABLE IF NOT EXISTS `teampass_kb_items` (
`kb_id` tinyint(12) NOT NULL, `increment_id` int(12) NOT NULL AUTO_INCREMENT,
`item_id` tinyint(12) NOT NULL `kb_id` int(12) NOT NULL,
`item_id` int(12) NOT NULL,
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_restriction_to_roles` ( CREATE TABLE IF NOT EXISTS `teampass_restriction_to_roles` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT,
`role_id` int(12) NOT NULL, `role_id` int(12) NOT NULL,
`item_id` int(12) NOT NULL, `item_id` int(12) NOT NULL,
KEY `role_id_idx` (`role_id`) PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_languages` ( CREATE TABLE IF NOT EXISTS `teampass_languages` (
`id` INT(10) NOT null AUTO_INCREMENT PRIMARY KEY , `id` INT(10) NOT null AUTO_INCREMENT,
`name` VARCHAR(50) NOT null , `name` VARCHAR(50) NOT null ,
`label` VARCHAR(50) NOT null , `label` VARCHAR(50) NOT null ,
`code` VARCHAR(10) NOT null , `code` VARCHAR(10) NOT null ,
`flag` VARCHAR(30) NOT NULL `flag` VARCHAR(30) NOT NULL,
PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
INSERT INTO `teampass_languages` (`name`, `label`, `code`, `flag`) VALUES INSERT INTO `teampass_languages` (`name`, `label`, `code`, `flag`) VALUES
@ -336,33 +406,45 @@ INSERT INTO `teampass_languages` (`name`, `label`, `code`, `flag`) VALUES
('turkish', 'Turkish' , 'tr', 'tr.png'), ('turkish', 'Turkish' , 'tr', 'tr.png'),
('norwegian', 'Norwegian' , 'no', 'no.png'), ('norwegian', 'Norwegian' , 'no', 'no.png'),
('japanese', 'Japanese' , 'ja', 'ja.png'), ('japanese', 'Japanese' , 'ja', 'ja.png'),
('portuguese', 'Portuguese' , 'pr', 'pr.png'), ('portuguese_br', 'Portuguese (Brazil)' , 'pr-bt', 'pr-bt.png'),
('chinese', 'Chinese' , 'cn', 'cn.png'), ('chinese', 'Chinese' , 'cn', 'cn.png'),
('swedish', 'Swedish' , 'se', 'se.png'), ('swedish', 'Swedish' , 'se', 'se.png'),
('dutch', 'Dutch' , 'nl', 'nl.png'), ('dutch', 'Dutch' , 'nl', 'nl.png'),
('catalan', 'Catalan' , 'ct', 'ct.png'), ('catalan', 'Catalan' , 'ct', 'ct.png'),
('vietnamese', 'Vietnamese', 'vi', 'vi.png'), ('bulgarian', 'Bulgarian' , 'bg', 'bg.png'),
('greek', 'Greek' , 'gr', 'gr.png'),
('hungarian', 'Hungarian' , 'hu', 'hu.png'),
('polish', 'Polish' , 'pl', 'pl.png'),
('romanian', 'Romanian' , 'ro', 'ro.png'),
('ukrainian', 'Ukrainian' , 'ua', 'ua.png'),
('vietnamese', 'Vietnamese' , 'vi', 'vi.png'),
('estonian', 'Estonian' , 'ee', 'ee.png'); ('estonian', 'Estonian' , 'ee', 'ee.png');
CREATE TABLE IF NOT EXISTS `teampass_emails` ( CREATE TABLE IF NOT EXISTS `teampass_emails` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT,
`timestamp` INT(30) NOT null , `timestamp` INT(30) NOT null ,
`subject` VARCHAR(255) NOT null , `subject` VARCHAR(255) NOT null ,
`body` TEXT NOT null , `body` TEXT NOT null ,
`receivers` VARCHAR(255) NOT null , `receivers` VARCHAR(255) NOT null ,
`status` VARCHAR(30) NOT NULL `status` VARCHAR(30) NOT NULL,
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_automatic_del` ( CREATE TABLE IF NOT EXISTS `teampass_automatic_del` (
`item_id` int(11) NOT NULL, `item_id` int(11) NOT NULL,
`del_enabled` tinyint(1) NOT NULL, `del_enabled` tinyint(1) NOT NULL,
`del_type` tinyint(1) NOT NULL, `del_type` tinyint(1) NOT NULL,
`del_value` varchar(35) NOT NULL `del_value` varchar(35) NOT NULL,
PRIMARY KEY (`item_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_items_edition` ( CREATE TABLE IF NOT EXISTS `teampass_items_edition` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT,
`item_id` int(11) NOT NULL, `item_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL, `user_id` int(12) NOT NULL,
`timestamp` varchar(50) NOT NULL `timestamp` varchar(50) NOT NULL,
KEY `item_id_idx` (`item_id`),
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_categories` ( CREATE TABLE IF NOT EXISTS `teampass_categories` (
@ -373,6 +455,7 @@ CREATE TABLE IF NOT EXISTS `teampass_categories` (
`description` text NULL, `description` text NULL,
`type` varchar(50) NULL default '', `type` varchar(50) NULL default '',
`order` int(12) NOT NULL default '0', `order` int(12) NOT NULL default '0',
`encrypted_data` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
@ -382,12 +465,14 @@ CREATE TABLE IF NOT EXISTS `teampass_categories_items` (
`item_id` int(11) NOT NULL, `item_id` int(11) NOT NULL,
`data` text NOT NULL, `data` text NOT NULL,
`data_iv` text NOT NULL, `data_iv` text NOT NULL,
`encryption_type` VARCHAR(20) NOT NULL DEFAULT 'not_set',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_categories_folders` ( CREATE TABLE IF NOT EXISTS `teampass_categories_folders` (
`id_category` int(12) NOT NULL, `id_category` int(12) NOT NULL,
`id_folder` int(12) NOT NULL `id_folder` int(12) NOT NULL,
PRIMARY KEY (`id_category`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_api` ( CREATE TABLE IF NOT EXISTS `teampass_api` (
@ -404,7 +489,7 @@ CREATE TABLE IF NOT EXISTS `teampass_otv` (
`timestamp` text NOT NULL, `timestamp` text NOT NULL,
`code` varchar(100) NOT NULL, `code` varchar(100) NOT NULL,
`item_id` int(12) NOT NULL, `item_id` int(12) NOT NULL,
`originator` tinyint(12) NOT NULL, `originator` int(12) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
@ -418,24 +503,47 @@ CREATE TABLE IF NOT EXISTS `teampass_suggestion` (
`author_id` int(12) NOT NULL, `author_id` int(12) NOT NULL,
`folder_id` int(12) NOT NULL, `folder_id` int(12) NOT NULL,
`comment` text NOT NULL, `comment` text NOT NULL,
`suggestion_type` varchar(10) NOT NULL default 'new',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_export` ( CREATE TABLE IF NOT EXISTS `teampass_export` (
`increment_id` int(12) NOT NULL AUTO_INCREMENT,
`id` int(12) NOT NULL, `id` int(12) NOT NULL,
`label` varchar(255) NOT NULL, `label` varchar(500) NOT NULL,
`login` varchar(100) NOT NULL, `login` varchar(100) NOT NULL,
`description` text NOT NULL, `description` text NOT NULL,
`pw` text NOT NULL, `pw` text NOT NULL,
`path` varchar(255) NOT NULL `path` varchar(500) NOT NULL,
`email` varchar(500) NOT NULL default 'none',
`url` varchar(500) NOT NULL default 'none',
`kbs` varchar(500) NOT NULL default 'none',
`tags` varchar(500) NOT NULL default 'none',
PRIMARY KEY (`increment_id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_tokens` ( CREATE TABLE IF NOT EXISTS `teampass_tokens` (
`id` int(12) NOT NULL AUTO_INCREMENT, `id` int(12) NOT NULL,
`user_id` int(10) NOT NULL, `user_id` int(12) NOT NULL,
`token` varchar(255) NOT NULL, `token` varchar(255) NOT NULL,
`reason` varchar(255) NOT NULL, `reason` varchar(255) NOT NULL,
`creation_timestamp` varchar(50) NOT NULL, `creation_timestamp` varchar(50) NOT NULL,
`end_timestamp` varchar(50) NOT NULL, `end_timestamp` varchar(50) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) CHARSET=utf8; ) CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `teampass_items_change` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`item_id` int(12) NOT NULL,
`label` varchar(255) NOT NULL DEFAULT 'none',
`pw` text NOT NULL,
`login` varchar(255) NOT NULL DEFAULT 'none',
`email` varchar(255) NOT NULL DEFAULT 'none',
`url` varchar(255) NOT NULL DEFAULT 'none',
`description` text NOT NULL,
`comment` text NOT NULL,
`folder_id` tinyint(12) NOT NULL,
`user_id` int(12) NOT NULL,
`timestamp` varchar(50) NOT NULL DEFAULT 'none',
PRIMARY KEY (`id`)
) CHARSET=utf8;

View file

@ -1,5 +1,5 @@
<?php <?php
global $lang, $txt, $k, $pathTeampas, $urlTeampass, $pwComplexity, $mngPages; global $lang, $txt, $pathTeampas, $urlTeampass, $pwComplexity, $mngPages;
global $server, $user, $pass, $database, $pre, $db, $port, $encoding; global $server, $user, $pass, $database, $pre, $db, $port, $encoding;
### DATABASE connexion parameters ### ### DATABASE connexion parameters ###

View file

@ -0,0 +1 @@
This small package is only a partial install script for teampass, in order to quickly try a new version and be able to compare the new files and directories.

View file

@ -0,0 +1,6 @@
SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/2.1.27.11.tar.gz
SOURCE_SUM=b1dd6cad9d470cb298b9b3e9a5f0df43
SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -0,0 +1,38 @@
#!/bin/bash
# This small script is design to perform a diff between the previous and the new install.queries.php file, which contains all the database requests needed for populate.sql
# Get the script's directory
script_dir="$(dirname $(realpath $0))"
# Grep versions of teampass to compare
new_version="$(grep SOURCE_URL= "./app.src" | cut -d'=' -f2)"
old_version="$(grep SOURCE_URL= "../../app.src" | cut -d'=' -f2)"
get_and_extract () {
local version="$1"
# Download the release
wget -nv "$version"
local archive="$(basename "$version")"
local dir="$(basename -s .tar.gz "$version")"
mkdir "$dir"
# Extract
tar -xf "$archive" -C "$dir" --strip-components 1
# Then cherry pick the file to compare
cp "$dir/install/install.queries.php" ./install.queries.php
# Remove previous useless archive and directory
rm -r "$dir" "$archive"
}
echo "new_version=$new_version"
get_and_extract $new_version
mv install.queries.php install.queries.php.new
echo "old_version=$old_version"
get_and_extract $old_version
mv install.queries.php install.queries.php.old
# Make a colored diff of the 2 files.
git diff --no-index install.queries.php.old install.queries.php.new
# Then remove these files
rm install.queries.php.{old,new}

View file

@ -0,0 +1,22 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
alias __FINALPATH__/;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.html index.php ;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -0,0 +1,392 @@
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[__NAMETOCHANGE__]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = __USER__
group = __USER__
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 128
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = www-data
listen.group = www-data
;listen.mode = 0660
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; priority = -19
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 10
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: ${prefix}/share/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong
; The access log file
; Default: not set
;access.log = log/$pool.access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: ouput header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request
; %q: the query string
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = 5s
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_terminate_timeout = 1d
; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
chdir = __FINALPATH__
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
catch_workers_output = yes
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

View file

@ -0,0 +1 @@
max_execution_time=60

View file

@ -0,0 +1,58 @@
{
"name": "Teampass",
"id": "teampass",
"packaging_format": 1,
"description": {
"en": "Passwords Manager",
"fr": "Gestionnaire de mots de passes."
},
"version": "2.1.26-final-3~ynh1",
"url": "http://www.teampass.net",
"license": "AGPL-3.0",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
},
"requirements": {
"yunohost": ">= 2.7.2"
},
"multi_instance": false,
"services": [
"nginx",
"php5-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Teampass",
"fr": "Choisissez un domaine pour Teampass"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Teampass",
"fr": "Choisissez un chemin pour Teampass"
},
"example": "/teampass",
"default": "/teampass"
},
{
"name": "password",
"type": "password",
"ask": {
"en": "Choose a password for the admin",
"fr": "Choisissez un mot de passe pour l'administrateur"
},
"example": "Choose a password",
"default": "admin"
}
]
}
}

View file

@ -0,0 +1,111 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
password_admin=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# CREATE A SQL BDD
#=================================================
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_app_setting_set $app final_path $final_path
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
#=================================================
# NGINX CONFIGURATION
#=================================================
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
#=================================================
# GENERIC FINALISATION
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
# Les fichiers appartiennent à $app
chown -R $app: $final_path
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx
#=================================================
# DISCLAIMER
#=================================================
echo "Database informations:
db_name= $db_name
db_pwd= $db_pwd
Connect to https://$domain$path_url to continue" >&2

View file

@ -0,0 +1,60 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE THE SQL BDD
#=================================================
ynh_mysql_remove_db $db_name $db_name # Suppression de la base de donnée et de l'utilisateur associé.
#=================================================
# REMOVE THE MAIN DIR OF THE APP
#=================================================
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================
ynh_remove_nginx_config # Suppression de la configuration nginx
#=================================================
# REMOVE THE PHP-FPM CONFIGURATION
#=================================================
ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE SK.PHP FILE
#=================================================
ynh_secure_remove "/etc/teampass"
#=================================================
# GENERIC FINALISATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_system_user_delete $app

View file

@ -2,21 +2,21 @@
"name": "Teampass", "name": "Teampass",
"id": "teampass", "id": "teampass",
"packaging_format": 1, "packaging_format": 1,
"requirements": {
"yunohost": ">= 2.6.4"
},
"description": { "description": {
"en": "Passwords Manager", "en": "Passwords Manager",
"fr": "Gestionnaire de mots de passes." "fr": "Gestionnaire de mots de passes."
}, },
"version": "2.1.26-final-3", "version": "2.1.27.15~ynh1",
"url": "http://www.teampass.net", "url": "http://www.teampass.net",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
"name": "Ackak, Maniack Crudelis et matlink", "name": "Maniack Crudelis",
"email": "ackak_ynh@ackak.net maniackc_dev@crudelis.fr matlink@matlink.fr" "email": "maniackc_dev@crudelis.fr"
}, },
"multi_instance": false, "requirements": {
"yunohost": ">= 2.7.12"
},
"multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php5-fpm", "php5-fpm",

View file

@ -1,194 +1,9 @@
#!/bin/bash #!/bin/bash
# =============================================================================
# YUNOHOST 2.7 FORTHCOMING HELPERS
# =============================================================================
# Create a dedicated nginx config
#
# usage: ynh_add_nginx_config
ynh_add_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalnginxconf"
sudo cp ../conf/nginx.conf "$finalnginxconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${path_url:-}"; then
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
fi
if test -n "${domain:-}"; then
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
fi
if test -n "${port:-}"; then
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
fi
if test -n "${app:-}"; then
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
fi
if test -n "${final_path:-}"; then
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
fi
ynh_store_file_checksum "$finalnginxconf"
sudo systemctl reload nginx
}
# Remove the dedicated nginx config
#
# usage: ynh_remove_nginx_config
ynh_remove_nginx_config () {
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo systemctl reload nginx
}
# Create a dedicated php-fpm config
#
# usage: ynh_add_fpm_config
ynh_add_fpm_config () {
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalphpconf"
sudo cp ../conf/php-fpm.conf "$finalphpconf"
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
ynh_replace_string "__USER__" "$app" "$finalphpconf"
sudo chown root: "$finalphpconf"
ynh_store_file_checksum "$finalphpconf"
if [ -e "../conf/php-fpm.ini" ]
then
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
ynh_backup_if_checksum_is_different "$finalphpini"
sudo cp ../conf/php-fpm.ini "$finalphpini"
sudo chown root: "$finalphpini"
ynh_store_file_checksum "$finalphpini"
fi
sudo systemctl reload php5-fpm
}
# Remove the dedicated php-fpm config
#
# usage: ynh_remove_fpm_config
ynh_remove_fpm_config () {
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
sudo systemctl reload php5-fpm
}
# Create a dedicated systemd config
#
# usage: ynh_add_systemd_config
ynh_add_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service"
ynh_backup_if_checksum_is_different "$finalsystemdconf"
sudo cp ../conf/systemd.service "$finalsystemdconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${final_path:-}"; then
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
fi
if test -n "${app:-}"; then
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
fi
ynh_store_file_checksum "$finalsystemdconf"
sudo chown root: "$finalsystemdconf"
sudo systemctl enable $app
sudo systemctl daemon-reload
}
# Remove the dedicated systemd config
#
# usage: ynh_remove_systemd_config
ynh_remove_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service"
if [ -e "$finalsystemdconf" ]; then
sudo systemctl stop $app
sudo systemctl disable $app
ynh_secure_remove "$finalsystemdconf"
fi
}
#=================================================
#=================================================
#=================================================
# CHECKING
#=================================================
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
# Check availability of a web path
ynh_webpath_available $domain $path_url
# Register/book a web path for an app
ynh_webpath_register $app $domain $path_url
}
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
}
#=================================================
# DISPLAYING
#=================================================
NO_PRINT () { # Supprime l'affichage dans stdout pour la commande en argument.
set +x
$@
set -x
}
WARNING () { # Écrit sur le canal d'erreur pour passer en warning.
$@ >&2
}
SUPPRESS_WARNING () { # Force l'écriture sur la sortie standard
$@ 2>&1
}
QUIET () { # Redirige la sortie standard dans /dev/null
$@ > /dev/null
}
ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null
$@ > /dev/null 2>&1
}
#================================================= #=================================================
# BACKUP # BACKUP
#================================================= #=================================================
BACKUP_FAIL_UPGRADE () {
WARNING echo "Upgrade failed."
app_bck=${app//_/-} # Replace all '_' by '-'
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number; then # Vérifie l'existence de l'archive avant de supprimer l'application et de restaurer
sudo yunohost app remove $app # Supprime l'application avant de la restaurer.
sudo yunohost backup restore --ignore-system $app_bck-pre-upgrade$backup_number --apps $app --force # Restore the backup if upgrade failed
ynh_die "The app was restored to the way it was before the failed upgrade."
fi
}
BACKUP_BEFORE_UPGRADE () { # Backup the current version of the app, restore it if the upgrade fails
backup_number=1
old_backup_number=2
app_bck=${app//_/-} # Replace all '_' by '-'
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1; then # Vérifie l'existence d'une archive déjà numéroté à 1.
backup_number=2 # Et passe le numéro de l'archive à 2
old_backup_number=1
fi
sudo yunohost backup create --ignore-system --apps $app --name $app_bck-pre-upgrade$backup_number # Créer un backup différent de celui existant.
if [ "$?" -eq 0 ]; then # Si le backup est un succès, supprime l'archive précédente.
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$old_backup_number; then # Vérifie l'existence de l'ancienne archive avant de la supprimer, pour éviter une erreur.
QUIET sudo yunohost backup delete $app_bck-pre-upgrade$old_backup_number
fi
else # Si le backup a échoué
ynh_die "Backup failed, the upgrade process was aborted."
fi
}
HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain
human=$(numfmt --to=iec --from-unit=1K $1) human=$(numfmt --to=iec --from-unit=1K $1)
echo $human echo $human
@ -196,25 +11,17 @@ HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un huma
CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
file_to_analyse=$1 file_to_analyse=$1
backup_size=$(sudo du --summarize "$file_to_analyse" | cut -f1) backup_size=$(du --summarize "$file_to_analyse" | cut -f1)
free_space=$(sudo df --output=avail "/home/yunohost.backup" | sed 1d) free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d)
if [ $free_space -le $backup_size ] if [ $free_space -le $backup_size ]
then then
WARNING echo "Espace insuffisant pour sauvegarder $file_to_analyse." ynh_print_err "Espace insuffisant pour sauvegarder $file_to_analyse."
WARNING echo "Espace disponible: $(HUMAN_SIZE $free_space)" ynh_print_err "Espace disponible: $(HUMAN_SIZE $free_space)"
ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)" ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)"
fi fi
} }
# Ce helper est temporaire et sert de remplacement à la véritable fonction ynh_restore_file. Le temps qu'elle arrive...
ynh_restore_file () {
if [ -f "$1" ]; then
ynh_die "There is already a file at this path: $1"
fi
sudo cp -a "${YNH_APP_BACKUP_DIR}$1" "$1"
}
#================================================= #=================================================
# PACKAGE CHECK BYPASSING... # PACKAGE CHECK BYPASSING...
#================================================= #=================================================
@ -224,156 +31,545 @@ IS_PACKAGE_CHECK () { # Détermine une exécution en conteneur (Non testé)
} }
#================================================= #=================================================
# NODEJS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# INFOS # Start or restart a service and follow its booting
# n (Node version management) utilise la variable PATH pour stocker le path de la version de node à utiliser. #
# C'est ainsi qu'il change de version # usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
# ynh_install_nodejs installe la version de nodejs demandée en argument, avec n #
# ynh_use_nodejs active une version de nodejs dans le script courant # | arg: Line to match - The line to find in the log to attest the service have finished to boot.
# 3 variables sont mises à disposition, et 2 sont stockées dans la config de l'app # | arg: Log file - The log file to watch; specify "systemd" to read systemd journal for specified service
# - nodejs_path: Le chemin absolu de cette version de node # /var/log/$app/$app.log will be used if no other log is defined.
# Utilisé pour des appels directs à node. # | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
# - nodejs_version: Simplement le numéro de version de nodejs pour cette application # | arg: Service name
# - nodejs_use_version: Un alias pour charger une version de node dans le shell courant.
# Utilisé pour démarrer un service ou un script qui utilise node ou npm
# Dans ce cas, c'est $PATH qui contient le chemin de la version de node. Il doit être propagé sur les autres shell si nécessaire.
n_install_dir="/opt/node_n" ynh_check_starting () {
node_version_path="/usr/local/n/versions/node" local line_to_match="$1"
ynh_use_nodejs () { local app_log="${2:-/var/log/$service_name/$service_name.log}"
nodejs_version=$(ynh_app_setting_get $app nodejs_version) local timeout=${3:-300}
local service_name="${4:-$app}"
load_n_path="[[ :$PATH: == *\":$n_install_dir/bin:\"* ]] || PATH=\"$n_install_dir/bin:$PATH\"" echo "Starting of $service_name" >&2
systemctl stop $service_name
local templog="$(mktemp)"
# Following the starting of the app in its log
if [ "$app_log" == "systemd" ] ; then
# Read the systemd journal
journalctl -u $service_name -f --since=-45 > "$templog" &
else
# Read the specified log file
tail -F -n0 "$app_log" > "$templog" &
fi
# Get the PID of the last command
local pid_tail=$!
systemctl start $service_name
nodejs_use_version="$n_install_dir/bin/n -q $nodejs_version" local i=0
for i in `seq 1 $timeout`
# "Load" a version of node do
eval $load_n_path; $nodejs_use_version # Read the log until the sentence is found, which means the app finished starting. Or run until the timeout.
if grep --quiet "$line_to_match" "$templog"
# Get the absolute path of this version of node then
nodejs_path="$(n bin $nodejs_version)" echo "The service $service_name has correctly started." >&2
break
# Make an alias for node use fi
ynh_node_exec="eval $load_n_path; n use $nodejs_version" echo -n "." >&2
} sleep 1
done
ynh_install_nodejs () { if [ $i -eq $timeout ]
# Use n, https://github.com/tj/n to manage the nodejs versions
nodejs_version="$1"
local n_install_script="https://git.io/n-install"
# Create $n_install_dir
mkdir -p "$n_install_dir"
# Load n path in PATH
CLEAR_PATH="$n_install_dir/bin:$PATH"
# Remove /usr/local/bin in PATH in case of node has already setup.
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
# Move an existing node binary, to avoid to block n.
test -x /usr/bin/node && mv /usr/bin/node /usr/bin/node_n
test -x /usr/bin/npm && mv /usr/bin/npm /usr/bin/npm_n
# If n is not previously setup, install it
n --version > /dev/null 2>&1 || \
( echo "Installation of N - Node.js version management" >&2; \
curl -sL $n_install_script | N_PREFIX="$n_install_dir" bash -s -- -y - )
# Restore /usr/local/bin in PATH
PATH=$CLEAR_PATH
# And replace the old node binary.
test -x /usr/bin/node_n && mv /usr/bin/node_n /usr/bin/node
test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm
# Install the requested version of nodejs
n $nodejs_version
# Find the last "real" version for this major version of node.
real_nodejs_version=$(find $node_version_path/$nodejs_version* -maxdepth 0 | sort --version-sort | tail --lines=1)
real_nodejs_version=$(basename $real_nodejs_version)
# Create a symbolic link for this major version
ln --symbolic --force --no-target-directory $node_version_path/$real_nodejs_version $node_version_path/$nodejs_version
# Store the ID of this app and the version of node requested for it
echo "$YNH_APP_ID:$nodejs_version" | tee --append "$n_install_dir/ynh_app_version"
# Store nodejs_version into the config of this app
ynh_app_setting_set $app nodejs_version $nodejs_version
# Build the update script and set the cronjob
ynh_cron_upgrade_node
ynh_use_nodejs
}
ynh_remove_nodejs () {
ynh_use_nodejs
# Remove the line for this app
sed --in-place "/$YNH_APP_ID:$nodejs_version/d" "$n_install_dir/ynh_app_version"
# If none another app uses this version of nodejs, remove it.
if ! grep --quiet "$nodejs_version" "$n_install_dir/ynh_app_version"
then then
n rm $nodejs_version echo "The service $service_name didn't fully start before the timeout." >&2
fi fi
# If none another app uses n, remove n echo ""
if [ ! -s "$n_install_dir/ynh_app_version" ] ynh_clean_check_starting
}
# Clean temporary process and file used by ynh_check_starting
# (usually used in ynh_clean_setup scripts)
#
# usage: ynh_clean_check_starting
ynh_clean_check_starting () {
# Stop the execution of tail.
kill -s 15 $pid_tail 2>&1
ynh_secure_remove "$templog" 2>&1
}
#=================================================
ynh_print_log () {
echo "${1}"
}
# Print an info on stdout
#
# usage: ynh_print_info "Text to print"
# | arg: text - The text to print
ynh_print_info () {
ynh_print_log "[INFO] ${1}"
}
# Print a warning on stderr
#
# usage: ynh_print_warn "Text to print"
# | arg: text - The text to print
ynh_print_warn () {
ynh_print_log "[WARN] ${1}" >&2
}
# Print a error on stderr
#
# usage: ynh_print_err "Text to print"
# | arg: text - The text to print
ynh_print_err () {
ynh_print_log "[ERR] ${1}" >&2
}
# Execute a command and print the result as an error
#
# usage: ynh_exec_err command to execute
# usage: ynh_exec_err "command to execute | following command"
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
#
# | arg: command - command to execute
ynh_exec_err () {
ynh_print_err "$(eval $@)"
}
# Execute a command and print the result as a warning
#
# usage: ynh_exec_warn command to execute
# usage: ynh_exec_warn "command to execute | following command"
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
#
# | arg: command - command to execute
ynh_exec_warn () {
ynh_print_warn "$(eval $@)"
}
# Execute a command and force the result to be printed on stdout
#
# usage: ynh_exec_warn_less command to execute
# usage: ynh_exec_warn_less "command to execute | following command"
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
#
# | arg: command - command to execute
ynh_exec_warn_less () {
eval $@ 2>&1
}
# Execute a command and redirect stdout in /dev/null
#
# usage: ynh_exec_quiet command to execute
# usage: ynh_exec_quiet "command to execute | following command"
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
#
# | arg: command - command to execute
ynh_exec_quiet () {
eval $@ > /dev/null
}
# Execute a command and redirect stdout and stderr in /dev/null
#
# usage: ynh_exec_fully_quiet command to execute
# usage: ynh_exec_fully_quiet "command to execute | following command"
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
#
# | arg: command - command to execute
ynh_exec_fully_quiet () {
eval $@ > /dev/null 2>&1
}
# Remove any logs for all the following commands.
#
# usage: ynh_print_OFF
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
ynh_print_OFF () {
set +x
}
# Restore the logging after ynh_print_OFF
#
# usage: ynh_print_ON
ynh_print_ON () {
set -x
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
echo ynh_print_ON > /dev/null
}
#=================================================
# Install or update the main directory yunohost.multimedia
#
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.0"
local checksum="4852c8607db820ad51f348da0dcf0c88"
# Download yunohost.multimedia scripts
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}
# Add a directory in yunohost.multimedia
# This "directory" will be a symbolic link to a existing directory.
#
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
#
# | arg: Source directory - The real directory which contains your medias.
# | arg: Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
ynh_multimedia_addfolder () {
local source_dir="$1"
local dest_dir="$2"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
}
# Move a directory in yunohost.multimedia, and replace by a symbolic link
#
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
#
# | arg: Source directory - The real directory which contains your medias.
# It will be moved to "Destination directory"
# A symbolic link will replace it.
# | arg: Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
ynh_multimedia_movefolder () {
local source_dir="$1"
local dest_dir="$2"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
}
# Allow an user to have an write authorisation in multimedia directories
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: user_name - The name of the user which gain this access.
ynh_multimedia_addaccess () {
local user_name=$1
groupadd -f multimedia
usermod -a -G multimedia $user_name
}
#=================================================
# Create a dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
# | arg: log_file - Log file to be checked by fail2ban
# | arg: failregex - Failregex to be looked for by fail2ban
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
# | arg: ports - Ports blocked for a banned IP address - default: http,https
ynh_add_fail2ban_config () {
# Process parameters
logpath=$1
failregex=$2
max_retry=${3:-3}
ports=${4:-http,https}
test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
sudo tee $finalfail2banjailconf <<EOF
[$app]
enabled = true
port = $ports
filter = $app
logpath = $logpath
maxretry = $max_retry
EOF
sudo tee $finalfail2banfilterconf <<EOF
[INCLUDES]
before = common.conf
[Definition]
failregex = $failregex
ignoreregex =
EOF
ynh_store_file_checksum "$finalfail2banjailconf"
ynh_store_file_checksum "$finalfail2banfilterconf"
systemctl reload fail2ban
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
if [ -n "$fail2ban_error" ]
then
echo "[ERR] Fail2ban failed to load the jail for $app" >&2
echo "WARNING${fail2ban_error#*WARNING}" >&2
fi
}
# Remove the dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_remove_fail2ban_config
ynh_remove_fail2ban_config () {
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
systemctl reload fail2ban
}
#=================================================
# Read the value of a key in a ynh manifest file
#
# usage: ynh_read_manifest manifest key
# | arg: manifest - Path of the manifest to read
# | arg: key - Name of the key to find
ynh_read_manifest () {
manifest="$1"
key="$2"
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
}
# Read the upstream version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number before ~ynh
# In the last example it return 4.3-2
#
# usage: ynh_app_upstream_version
ynh_app_upstream_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest "$manifest_path" "version")
echo "${version_key/~ynh*/}"
}
# Read package version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number after ~ynh
# In the last example it return 3
#
# usage: ynh_app_package_version
ynh_app_package_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest "$manifest_path" "version")
echo "${version_key/*~ynh/}"
}
# Exit without error if the package is up to date
#
# This helper should be used to avoid an upgrade of a package
# when it's not needed.
#
# To force an upgrade, even if the package is up to date,
# you have to set the variable YNH_FORCE_UPGRADE before.
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
#
# usage: ynh_abort_if_up_to_date
ynh_abort_if_up_to_date () {
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
local package_check=${PACKAGE_CHECK_EXEC:-0}
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
local last_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
if [ "$version" = "$last_version" ]
then then
ynh_secure_remove "$n_install_dir" if [ "$force_upgrade" != "0" ]
ynh_secure_remove "/usr/local/n" then
sed --in-place "/N_PREFIX/d" /root/.bashrc echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
unset YNH_FORCE_UPGRADE
elif [ "$package_check" != "0" ]
then
echo "Upgrade forced for package check." >&2
else
ynh_die "Up-to-date, nothing to do" 0
fi
fi fi
} }
ynh_cron_upgrade_node () { #=================================================
# Build the update script
cat > "$n_install_dir/node_update.sh" << EOF
#!/bin/bash
version_path="$node_version_path" # Send an email to inform the administrator
n_install_dir="$n_install_dir" #
# usage: ynh_send_readme_to_admin app_message [recipients]
# | arg: app_message - The message to send to the administrator.
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
ynh_send_readme_to_admin() {
local app_message="${1:-...No specific information...}"
local recipients="${2:-root}"
# Log the date # Retrieve the email of users
date find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
# List all real installed version of node local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
all_real_version="\$(find \$version_path/* -maxdepth 0 -type d | sed "s@\$version_path/@@g")"
# Keep only the major version number of each line local mail_message="This is an automated message from your beloved YunoHost server.
all_real_version=\$(echo "\$all_real_version" | sed 's/\..*\$//')
# Remove double entries Specific information for the application $app.
all_real_version=\$(echo "\$all_real_version" | sort --unique)
# Read each major version $app_message
while read version
do
echo "Update of the version \$version"
sudo \$n_install_dir/bin/n \$version
# Find the last "real" version for this major version of node. ---
real_nodejs_version=\$(find \$version_path/\$version* -maxdepth 0 | sort --version-sort | tail --lines=1) Automatic diagnosis data from YunoHost
real_nodejs_version=\$(basename \$real_nodejs_version)
# Update the symbolic link for this version $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
sudo ln --symbolic --force --no-target-directory \$version_path/\$real_nodejs_version \$version_path/\$version
done <<< "\$(echo "\$all_real_version")"
EOF
chmod +x "$n_install_dir/node_update.sh" # Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
# Build the cronjob # Send the email to the recipients
cat > "/etc/cron.daily/node_update" << EOF echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
#!/bin/bash }
$n_install_dir/node_update.sh >> $n_install_dir/node_update.log #=================================================
EOF
# Reload (or other actions) a service and print a log in case of failure.
chmod +x "/etc/cron.daily/node_update" #
# usage: ynh_system_reload service_name [action]
# | arg: service_name - Name of the service to reload
# | arg: action - Action to perform with systemctl. Default: reload
ynh_system_reload () {
local service_name=$1
local action=${2:-reload}
# Reload, restart or start and print the log if the service fail to start or reload
systemctl $action $service_name || ( journalctl --lines=20 -u $service_name >&2 && false)
}
#=================================================
ynh_debian_release () {
lsb_release --codename --short
}
is_stretch () {
if [ "$(ynh_debian_release)" == "stretch" ]
then
return 0
else
return 1
fi
}
is_jessie () {
if [ "$(ynh_debian_release)" == "jessie" ]
then
return 0
else
return 1
fi
}
#=================================================
# Delete a file checksum from the app settings
#
# $app should be defined when calling this helper
#
# usage: ynh_remove_file_checksum file
# | arg: file - The file for which the checksum will be deleted
ynh_delete_file_checksum () {
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_delete $app $checksum_setting_name
}
#=================================================
ynh_maintenance_mode_ON () {
# Create an html to serve as maintenance notice
echo "<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="3">
<title>Your app $app is currently under maintenance!</title>
<style>
body {
width: 70em;
margin: 0 auto;
}
</style>
</head>
<body>
<h1>Your app $app is currently under maintenance!</h1>
<p>This app has been put under maintenance by your administrator at $(date)</p>
<p>Please wait until the maintenance operation is done. This page will be reloaded as soon as your app will be back.</p>
</body>
</html>" > "/var/www/html/maintenance.$app.html"
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
# Use another location, to not be in conflict with the original config file
location ${path_url}_maintenance/ {
alias /var/www/html/ ;
try_files maintenance.$app.html =503;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
# The current config file will redirect all requests to the root of the app.
# To keep the full path, we can use the following rewrite rule:
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
# The difference will be in the $1 at the end, which keep the following queries.
# But, if it works perfectly for a html request, there's an issue with any php files.
# This files are treated as simple files, and will be downloaded by the browser.
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
systemctl reload nginx
}
ynh_maintenance_mode_OFF () {
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
systemctl reload nginx
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
sleep 4
# Then remove the temporary files used for the maintenance.
rm "/var/www/html/maintenance.$app.html"
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
systemctl reload nginx
} }

View file

@ -1,26 +1,26 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant # Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
@ -38,20 +38,20 @@ db_name=$(ynh_app_setting_get $app db_name)
#================================================= #=================================================
CHECK_SIZE "$final_path" CHECK_SIZE "$final_path"
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path" ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP OF THE NGINX CONFIGURATION # BACKUP OF THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP OF THE PHP-FPM CONFIGURATION # BACKUP OF THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/pool.d/$app.conf" ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/conf.d/20-$app.ini" ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
#================================================= #=================================================
# BACKUP OF THE SQL BDD # BACKUP OF THE SQL BDD
@ -66,10 +66,10 @@ CHECK_SIZE "db.sql"
# BACKUP SK.PHP # BACKUP SK.PHP
#================================================= #=================================================
ynh_backup "/etc/teampass/sk.php" "${YNH_APP_BACKUP_DIR}/etc/teampass/sk.php" ynh_backup "/etc/$app/sk.php"
#================================================= #=================================================
# BACKUP CRON FILE # BACKUP CRON FILE
#================================================= #=================================================
ynh_backup "/etc/cron.d/teampass" "${YNH_APP_BACKUP_DIR}/etc/cron.d/teampass" ynh_backup "/etc/cron.d/$app"

147
scripts/change_url Normal file
View file

@ -0,0 +1,147 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
path_url=$old_path
domain=$old_domain
ynh_maintenance_mode_ON
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Move from sub path to root
if [ "$new_path" == "/" ]
then
ynh_replace_string "^.*rewrite.*\^$old_path" "#sub_path_only&" "$nginx_conf_path"
ynh_replace_string "\(rewrite *\^\)$old_path\$ $old_path/*" "\1$new_path$ $new_path" "$nginx_conf_path"
# Move to a sub path
else
ynh_replace_string "^#sub_path_only" "" "$nginx_conf_path"
ynh_replace_string "\(rewrite *\^\)$old_path\$ $old_path/*" "\1$new_path$ $new_path/" "$nginx_conf_path"
fi
ynh_replace_string "location ${old_path%/}/" "location ${new_path%/}/" "$nginx_conf_path"
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE THE DATABASE
#=================================================
ynh_mysql_execute_as_root "UPDATE ${app}_misc SET valeur='https://$new_domain$new_path' WHERE intitule='cpassman_url'" $app
ynh_mysql_execute_as_root "UPDATE ${app}_misc SET valeur='https://$new_domain$new_path/favico.ico' WHERE intitule='favicon'" $app
ynh_mysql_execute_as_root "UPDATE ${app}_misc SET valeur='https://$new_domain$new_path/upload' WHERE intitule='url_to_upload_folder'" $app
ynh_mysql_execute_as_root "UPDATE ${app}_misc SET valeur='https://$new_domain$new_path/files' WHERE intitule='url_to_files_folder'" $app
ynh_mysql_execute_as_root "UPDATE ${app}_misc SET valeur='https://$new_domain$new_path' WHERE intitule='email_server_url'" $app
#=================================================
# UPDATE TP.CONFIG.PHP FILE
#=================================================
ynh_replace_string "https://$old_domain$old_path" "https://$new_domain$new_path" "$final_path/includes/config/tp.config.php"
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_system_reload nginx
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
path_url=$old_path
domain=$old_domain
ynh_maintenance_mode_OFF

View file

@ -13,11 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE FAILURE OF THE SCRIPT # MANAGE FAILURE OF THE SCRIPT
#================================================= #=================================================
ynh_clean_setup () {
# Nettoyage des résidus d'installation non pris en charge par le script remove.
# Pas de nettoyage supplémentaire nécessaire ici...
echo ""
}
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée. ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
#================================================= #=================================================
@ -26,7 +21,7 @@ ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est dét
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
password_admin=$YNH_APP_ARG_PASSWORD ynh_print_OFF; password_admin=$YNH_APP_ARG_PASSWORD; ynh_print_ON
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -34,9 +29,16 @@ app=$YNH_APP_INSTANCE_NAME
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#================================================= #=================================================
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path. final_path=/var/www/$app
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. test ! -e "$final_path" || ynh_die "This path already contains a folder"
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
@ -45,6 +47,12 @@ CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilis
ynh_app_setting_set $app domain $domain ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set $app path $path_url
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -63,12 +71,16 @@ ynh_app_setting_set $app final_path $final_path
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
# Delete the install directory. # Delete the install directory.
# SECURE_REMOVE '$final_path/install' ynh_secure_remove "$final_path/install"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -89,94 +101,115 @@ ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le co
# FILL THE DATABASE # FILL THE DATABASE
#================================================= #=================================================
# Copie du script contenant la fonction bCrypt
sudo cp ../conf/mdphash.php $final_path
# Remplacement des variables dans le fichier sql # Remplacement des variables dans le fichier sql
if [ $(echo $LANG | cut -c1-2) == "fr" ] if [ $(echo $LANG | cut -c1-2) == "fr" ]
then then
langue=french langue=french
folders=partagés # Le dossier partagé est actuellement désactivé par défaut. Encore un bug... folders="partagés"
roles=utilisateurs roles=utilisateurs
else else
langue=english langue=english
folders=shared folders=shared
roles=users roles=users
fi fi
sed -i "s@__FINALPATH__@$final_path@g" ../conf/populate.sql ynh_replace_string "__APP__" "$app" ../conf/populate.sql
sed -i "s@__DOMAIN__@$domain@g" ../conf/populate.sql ynh_replace_string "__FINALPATH__" "$final_path" ../conf/populate.sql
sed -i "s@__PATH__@$path_url@g" ../conf/populate.sql ynh_replace_string "__DOMAIN__" "$domain" ../conf/populate.sql
sed -i "s@__FOLDERS__@$folders@g" ../conf/populate.sql ynh_replace_string "__PATH__" "$path_url" ../conf/populate.sql
sed -i "s@__ROLES__@$roles@g" ../conf/populate.sql ynh_replace_string "__FOLDERS__" "$folders" ../conf/populate.sql
sed -i "s@__VERSION__@$(sed -n 3p $final_path/changelog.md)@g" ../conf/populate.sql ynh_replace_string "__ROLES__" "$roles" ../conf/populate.sql
sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" ../conf/populate.sql ynh_replace_string "__VERSION__" "$(sed -n 3p $final_path/changelog.txt)" ../conf/populate.sql
sed -i "s@__BCRYPT_MDP__@$(php ../conf/mdphash.php $password_admin)@g" ../conf/populate.sql ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" ../conf/populate.sql
sed -i "s@__LANG__@$langue@g" ../conf/populate.sql ynh_replace_string "__BCRYPT_MDP__" "$(php $final_path/mdphash.php $password_admin)" ../conf/populate.sql
ynh_replace_string "__LANG__" "$langue" ../conf/populate.sql
ynh_replace_string "__TIME__" "$(date +%s)" ../conf/populate.sql
# Enregistre les infos dans la config YunoHost # Enregistre les infos dans la config YunoHost
ynh_app_setting_set $app langue $langue ynh_app_setting_set $app langue $langue
# Import du fichier SQL # Import du fichier SQL
mysql -u $db_name -p$db_pwd $db_name < ../conf/populate.sql ynh_mysql_connect_as $db_name $db_pwd $db_name < ../conf/populate.sql
#=================================================
# CREATE TP.CONFIG.PHP FILE
#=================================================
# The file tp.config.php is a dump of the admin part of the database.
tp_config_file="$final_path/includes/config/tp.config.php"
echo "<?php
global \$SETTINGS;
\$SETTINGS = array (" > $tp_config_file
while read settings
do
echo -n " '$(echo $settings | awk '{ print $1 }')'" >> $tp_config_file
echo " => '$(echo $settings | cut -d' ' -f2-)'," >> $tp_config_file
done <<< "$(ynh_mysql_execute_as_root "SELECT intitule, valeur FROM teampass_misc" $app)"
echo ");" >> $tp_config_file
#================================================= #=================================================
# CONFIGURE TEAMPASS # CONFIGURE TEAMPASS
#================================================= #=================================================
# Remplacement des variables dans les fichier settings.php et sk.php # Remplacement des variables dans les fichier settings.php et sk.php
sed -i "s@__DBUSER__@$db_name@g" ../conf/settings.php ynh_replace_string "__DBUSER__" "$db_name" ../conf/settings.php
sed -i "s@__DBPWD__@$db_pwd@g" ../conf/settings.php ynh_replace_string "__DBPWD__" "$db_pwd" ../conf/settings.php
sed -i "s@__FINALPATH__@$final_path@g" ../conf/settings.php ynh_replace_string "__FINALPATH__" "$final_path" ../conf/settings.php
path_sk_file=/etc/teampass/ path_sk_file=/etc/$app/
sudo mkdir $path_sk_file mkdir $path_sk_file
sed -i "s@__SKPATH__@$path_sk_file@g" ../conf/settings.php ynh_replace_string "__SKPATH__" "$path_sk_file" ../conf/settings.php
#================================================= #=================================================
# CREATE A SALTKEY # CREATE A SALTKEY
#================================================= #=================================================
saltkey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{32\}\).*/\1/p') saltkey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{32\}\).*/\1/p')
sed -i "s@__SALTKEY__@$saltkey@g" ../conf/sk.php ynh_replace_string "__SALTKEY__" "$saltkey" ../conf/sk.php
#================================================= #=================================================
# COPY THE FILES # COPY THE FILES
#================================================= #=================================================
sudo cp ../conf/sk.php $path_sk_file/sk.php cp ../conf/sk.php $path_sk_file/sk.php
sudo chown -R root:$app $path_sk_file chown -R root:$app $path_sk_file
sudo chmod 750 $path_sk_file chmod 750 $path_sk_file
sudo cp ../conf/settings.php $final_path/includes/config/settings.php cp ../conf/settings.php $final_path/includes/config/settings.php
ynh_store_file_checksum "$final_path/includes/config/settings.php" # Enregistre la somme de contrôle du fichier de config ynh_store_file_checksum "$final_path/includes/config/settings.php" # Enregistre la somme de contrôle du fichier de config
sudo cp $final_path/includes/libraries/csrfp/libs/csrfp.config.sample.php $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Créer le fichier de config de csrfp cp $final_path/includes/libraries/csrfp/libs/csrfp.config.sample.php $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Créer le fichier de config de csrfp
sed -i "s@CSRFP_TOKEN\" => \"@&$(head -n40 /dev/urandom | tr -c -d 'a-f0-9' | head -c50)@g" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne un token, valide en hexadécimal ynh_replace_string "CSRFP_TOKEN\" => \"" "&$(head -n40 /dev/urandom | tr -c -d 'a-f0-9' | head -c50)" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne un token, valide en hexadécimal
sed -i "s@jsUrl\" => \"@&$domain$path_url/includes/libraries/csrfp/js/csrfprotector.js@g" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne l'adresse de csrfprotector.js ynh_replace_string "jsUrl\" => \"" "&includes/libraries/csrfp/js/csrfprotector.js" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne l'adresse de csrfprotector.js
#================================================= #=================================================
# CREATE THE USERS # CREATE THE USERS
#================================================= #=================================================
# Not used anymore, because the current version support ldap.
# But still I keep that here, just in case...
# Ajout des utilisateurs actuels dans la base yunohost # Ajout des utilisateurs actuels dans la base yunohost
teampass_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs) # teampass_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs)
id=1 # id=1
for teampassuser in $teampass_users # for teampassuser in $teampass_users
do # do
real_password=$(ynh_string_random) # Génère un mot de passe aléatoire # real_password=$(ynh_string_random) # Génère un mot de passe aléatoire
password=$(php ../conf/mdphash.php $real_password) # password=$(php $final_path/mdphash.php $real_password)
mail=$(sudo ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x uid=$teampassuser mail | grep mail: | sed 's/mail: //' | head -n1) # mail=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x uid=$teampassuser mail | grep mail: | sed 's/mail: //' | head -n1)
# Creation de l'utilisateur # Creation de l'utilisateur
mysql -u $db_name -p$db_pwd $db_name -e "INSERT INTO teampass_users (id, login, pw, groupes_visibles, derniers, key_tempo, last_pw_change, last_pw, admin, fonction_id, groupes_interdits, last_connexion, gestionnaire, email, favourites, latest_items, personal_folder, can_create_root_folder) VALUES (NULL, '$teampassuser', '$password', '1', '', '', '', '', '0', '1', '', '', '0', '$mail', '', '', '1', '1');" # ynh_mysql_execute_as_root "INSERT INTO teampass_users (id, login, pw, groupes_visibles, derniers, key_tempo, last_pw_change, last_pw, admin, fonction_id, groupes_interdits, last_connexion, gestionnaire, email, favourites, latest_items, personal_folder, can_create_root_folder) VALUES (NULL, '$teampassuser', '$password', '1', '', '', '', '', '0', '1', '', '', '0', '$mail', '', '', '1', '1');" $app
# Creation du repertoire personnel # Creation du repertoire personnel
id_user=$(mysql -u $db_name -p$db_pwd $db_name -se "SELECT id from teampass_users where login='$teampassuser';") # id_user=$(ynh_mysql_execute_as_root "SELECT id from teampass_users where login='$teampassuser';" $app)
mysql -u $db_name -p$db_pwd $db_name -e "INSERT INTO teampass_nested_tree (id, parent_id, title, nleft, nright, nlevel, bloquer_creation, bloquer_modification, personal_folder, renewal_period) VALUES (NULL, 0, '$id_user', 0, 0, 1, 0, 0, 1, 0);" # ynh_mysql_execute_as_root "INSERT INTO teampass_nested_tree (id, parent_id, title, nleft, nright, nlevel, bloquer_creation, bloquer_modification, personal_folder, renewal_period) VALUES (NULL, 0, '$id_user', 0, 0, 1, 0, 0, 1, 0);" $app
#
((id++)) # ((id++))
done # done
#================================================= #=================================================
# CREATE A CRON FILE FOR AUTOMATIC BACKUP # CREATE A CRON FILE FOR AN AUTOMATIC BACKUP
#================================================= #=================================================
echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/teampass echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/$app
# Add also a clean of old backup.
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -185,14 +218,30 @@ echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cro
#================================================= #=================================================
# Les fichiers appartiennent à root # Les fichiers appartiennent à root
sudo chown -R root: $final_path chown -R root: $final_path
# Sauf les dossiers files et upload # Sauf certains dossiers includes, files et upload
sudo chown -R $app: $final_path/files $final_path/upload chown -R $app $final_path/{includes,files,upload}
# Restreint l'accès au dossier de backup # Restreint l'accès au dossier de backup
sudo chmod 750 $final_path/backups chmod 750 $final_path/backups
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
sudo systemctl reload nginx ynh_system_reload nginx
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/teampass_ynh
!!! Be carreful when using this app, we have encountered many issues with the last upgrade. The next upgrade could be also difficult, and may need to reinstall the app and migrate manually."
ynh_send_readme_to_admin "$message" "root"

View file

@ -50,7 +50,7 @@ ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
# REMOVE THE SK.PHP FILE # REMOVE THE SK.PHP FILE
#================================================= #=================================================
ynh_secure_remove "/etc/teampass" ynh_secure_remove "/etc/$app"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -1,26 +1,26 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant # Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
@ -36,11 +36,17 @@ db_name=$(ynh_app_setting_get $app db_name)
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path " || ynh_die "There is already a directory: $final_path "
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD RESTORE STEPS # STANDARD RESTORE STEPS
#================================================= #=================================================
@ -74,9 +80,9 @@ ynh_system_user_create $app # Recreate the dedicated user, if not exist
#================================================= #=================================================
# Les fichiers appartiennent à root # Les fichiers appartiennent à root
sudo chown -R root: $final_path chown -R root: $final_path
# Sauf les dossiers files et upload # Sauf les dossiers files et upload
sudo chown -R $app: $final_path/files $final_path/upload chown -R $app: $final_path/files $final_path/upload
#================================================= #=================================================
# RESTORE OF THE PHP-FPM CONFIGURATION # RESTORE OF THE PHP-FPM CONFIGURATION
@ -91,14 +97,14 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
# RESTORE THE SK.PHP FILE # RESTORE THE SK.PHP FILE
#================================================= #=================================================
ynh_restore_file "/etc/teampass/sk.php" ynh_restore_file "/etc/$app/sk.php"
sudo chown -R root:$app "/etc/teampass/sk.php" chown -R root:$app "/etc/$app/sk.php"
#================================================= #=================================================
# RESTORE CRON FILE # RESTORE CRON FILE
#================================================= #=================================================
ynh_restore_file "/etc/cron.d/teampass" ynh_restore_file "/etc/cron.d/$app"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -106,5 +112,19 @@ ynh_restore_file "/etc/cron.d/teampass"
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
sudo systemctl reload php5-fpm ynh_system_reload php5-fpm
sudo systemctl reload nginx ynh_system_reload nginx
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/teampass_ynh"
ynh_send_readme_to_admin "$message" "root"

View file

@ -19,15 +19,38 @@ domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# CHECK VERSION
#=================================================
ynh_abort_if_up_to_date
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
if [ -z $final_path ]; then # Si final_path n'est pas renseigné dans app setting
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
fi
if [ -z $db_name ]; then # Si db_name n'est pas renseigné dans app setting
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
BACKUP_BEFORE_UPGRADE # Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
BACKUP_FAIL_UPGRADE # restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup
} }
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée. # Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# CHECK THE PATH # CHECK THE PATH
@ -35,6 +58,12 @@ ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est dét
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path. path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -43,10 +72,17 @@ path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path
# Delete the install directory.
ynh_secure_remove "$final_path/install"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
fi
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -64,14 +100,46 @@ ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le co
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# ... # UPDATE TP.CONFIG.PHP FILE
#================================================= #=================================================
# The file tp.config.php is a dump of the admin part of the database.
tp_config_file="$final_path/includes/config/tp.config.php"
echo "<?php
global \$SETTINGS;
\$SETTINGS = array (" > $tp_config_file
while read settings
do
echo -n " '$(echo $settings | awk '{ print $1 }')'" >> $tp_config_file
echo " => '$(echo $settings | cut -d' ' -f2-)'," >> $tp_config_file
done <<< "$(ynh_mysql_execute_as_root "SELECT intitule, valeur FROM teampass_misc" $app)"
echo ");" >> $tp_config_file
#================================================= #=================================================
# CREATE A CRON FILE FOR AUTOMATIC BACKUP # CREATE A CRON FILE FOR AUTOMATIC BACKUP
#================================================= #=================================================
echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/teampass echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/$app
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# Move settings.php from old teampass version
if [ ! -e "$final_path/includes/config/settings.php" ]
then
mv "$final_path/includes/settings.php" "$final_path/includes/config/settings.php"
fi
# Create csrfp.config.php
if [ ! -e "$final_path/includes/libraries/csrfp/libs/csrfp.config.php" ]
then
cp $final_path/includes/libraries/csrfp/libs/csrfp.config.sample.php $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Créer le fichier de config de csrfp
ynh_replace_string "CSRFP_TOKEN\" => \"" "&$(head -n40 /dev/urandom | tr -c -d 'a-f0-9' | head -c50)" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne un token, valide en hexadécimal
ynh_replace_string "jsUrl\" => \"" "&includes/libraries/csrfp/js/csrfprotector.js" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne l'adresse de csrfprotector.js
fi
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -80,14 +148,20 @@ echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cro
#================================================= #=================================================
# Les fichiers appartiennent à root # Les fichiers appartiennent à root
sudo chown -R root: $final_path chown -R root: $final_path
# Sauf les dossiers files et upload # Sauf certains dossiers includes, files et upload
sudo chown -R $app: $final_path/files $final_path/upload chown -R $app $final_path/{includes,files,upload}
# Restreint l'accès au dossier de backup # Restreint l'accès au dossier de backup
sudo chmod 750 $final_path/backups chmod 750 $final_path/backups
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
sudo systemctl reload nginx ynh_system_reload nginx
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_OFF