Cryptpad - instance customization and `application_config.js` location inconsistency

What type of hardware are you using: Other(?)
What YunoHost version are you running: yunohost version: 12.0.12 (stable)
What app is this about: Cryptpad

Describe your issue

[EN]
Hi Folks,

Running CryptPad 2024.12.0 on a dedicated server, 54 / 55 tests passed when performinghttps://cryptpad.mydomain.com/checkup/.

Summary
Inconsistencies in the documentation regarding the location of the application_config.js file when customizing and/or hardening a Cryptpad instance, resulting in the file being listed twice, in two different locations.

Question
Where to set the customization file application_config.js?
in /cryptpad/www/common/application_config.js
or
in /cryptpad/customize/application_config.js ?

Description
After a failed upgrade that left me with users being unable to log in, I’ve reinstalled Cryptpad completely without any major issues (once the unexpected change of the sandbox subdomain was fixed). Cryptpad is now running fine.

I have hardened the instance configuration as per the Cryptpad documentation by adding two entries to /www/cryptpad/www/common/application_config.js:

  • setting a salt value for password hashing with AppConfig.loginSalt = 'randomchainofcaracters';
  • setting the minimal password length to 28 with AppConfig.minimumPasswordLength = 28;

I now want to restrict the use of the instance to registered users only.

As per the documentation, a copy of the /cryptpad/customize.dist/application_config.js file shall be made into a new folder named /cryptpad/customize/ and then the necessary entries shall be added or modified in this new file.

To restrict access to registered users only, the entry to add is:
AppConfig.registeredOnlyTypes = AppConfig.availablePadTypes;.

But by doing so, we would then end up with two application_config.js files, one in /cryptpad/www/common/application_config.js and the other in /cryptpad/customize/application_config.js as someone already pointed out on their forum.

To add to the confusion, one the Cryptpad mod wrote in August:

Every customization, including the LoginSalt should be made to www/common/application_config.js - adding that We will need to update our documentation accordingly, it’s in the current state out-of-date regarding this instruction.

Question
Where to set customization file application_config.js:
in /cryptpad/www/common/application_config.js
or
in /cryptpad/customize/application_config.js ?

Many thanks !


[FR]
Bonjour Ă  tous,

CryptPad 2024.12.0 sur un serveur dédié, 54 / 55 tests réussis lors de l’exécution de https://cryptpad.mydomain.com/checkup/.

Résumé
Incohérences dans la documentation à propos de l’emplacement du fichier application_config.js lors de la personnalisation et/ou du durcissement d’une instance Cryptpad, le fichier étant listé deux fois, dans deux emplacements différents.

Question
OĂą placer le fichier de personnalisation application_config.js?
dans /cryptpad/www/common/application_config.js
ou
/cryptpad/customize/application_config.js ?

Description
Après une mise à jour ratée qui a empêché les utilisateurs de se connecter, j’ai réinstallé Cryptpad sans problème majeur (ahem… une fois corrigé le changement inattendu du sous-domaine sandbox). Cryptpad fonctionne maintenant correctement.

J’ai renforcé la configuration de l’instance conformément à la documentation en ajoutant deux entrées au fichier /www/cryptpad/www/common/application_config.js :

  • une valeur de salt pour le hachage des mots de passe avec AppConfig.loginSalt = 'randomchainofcaracters';
  • longueur minimale des mots de passe Ă  28 avec AppConfig.minimumPasswordLength = 8;

Je veux maintenant restreindre l’utilisation de l’instance aux utilisateurs enregistrés uniquement.

Selon la doc, une copie du fichier /cryptpad/customize.dist/application_config.js doit être faite dans un nouveau dossier nommé /cryptpad/customize/ et ensuite les entrées nécessaires doivent être ajoutées ou modifiées dans ce nouveau fichier.

Pour restreindre l’accès aux seuls utilisateurs enregistrés, l’entrée à ajouter est:
AppConfig.registeredOnlyTypes = AppConfig.availablePadTypes;.

Si on suit la doc, on se retrouve avec deux fichiers application_config.js, l’un dans /cryptpad/www/common/application_config.js et l’autre dans /cryptpad/customize/application_config.js comme quelqu’un l’a déjà fait remarquer sur leur forum.

Pour ajouter à la confusion, un mod de Cryptpad écrit en août:

Toute personnalisation, y compris le LoginSalt doit être faite dans www/common/application_config.js - ajoutant que Nous devrons mettre à jour notre documentation en conséquence, elle est dans l’état actuel dépassée en ce qui concerne cette instruction.

Question
OĂą placer le fichier de personnalisation application_config.js?
dans /cryptpad/www/common/application_config.js
ou
/cryptpad/customize/application_config.js ?

Merci beaucoup !

Share relevant logs or error messages

n/a

Received a swift answer from Yann at Cryptpad on their Matrix room:

There is indeed an error in the documentation about the loginSalt.

The correct answer is to always update /customize/application_config.js to customize your instance. Files in /var/www/cryptpad/customize.dist/ and /var/www/cryptpad/www/ should not be modified as they could create conflicts when upgrading your instance in the future.

Many thanks to Yann for his quick reply!

Take away

  • Create a /var/www/cryptpad/customize/ directory if not already present
  • Make a copy of /var/www/cryptpad//customize.dist/application_config.js into the /var/www/cryptpad/customize/ directory
  • Copy the entries found in /var/cryptpad/www/common/application_config_internal.jsthat you want to set into this new /var/www/cryptpad/customize/application_config.js.

Many thanks to Cryptpad and their team for their quick answer ! Keep it up folks!


[FR]

J’ai reçu une réponse de Yann de Cryptpad sur leur room Matrix:

Il y a effectivement une erreur dans la documentation au sujet du loginSalt.

C’est le fichier /customize/application_config.js qu’il faut modifier lorsqu’on customise l’instance. Il ne faut jamais modifier les fichiers /var/www/cryptpad/customize.dist/ et /var/www/cryptpad/www/ car cela créera des conflits lors des mises à jour futures de l’instance.

Un grand merci Yann pour sa réactivité !

Ă€ retenir

  • CrĂ©er un rĂ©pertoire /var/www/cryptpad/customize/ s’il n’existe pas dĂ©jĂ 
  • Copier /var/www/cryptpad//customize.dist/application_config.jsdans le rĂ©pertoire/var/www/cryptpad/customize/
  • Copier les entrĂ©e prĂ©sentes dans le fichier /var/cryptpad/www/common/application_config_internal.jset que vous voulez ajouter ou modifier dans le fichier /var/www/cryptpad/customize/application_config.js.

Un grand merci à Cryptpad et son équipe pour leur réponse rapide! Keep it up folks!

1 Like

:united_kingdom:
After each change, do not forget to restart the CryptPad service.

yunohost service restart cryptpad

:france:
À chaque modification apportée, ne pas oublier de redémarrer le service CryptPad.

yunohost service restart cryptpad

Is there a way to have a different location for custom folder? I would think of something like $data_dir/customize. And I don’t know if the upgrade keeps $install_dir/customize.
This is to ensure that it won’t get deleted on upgrade

Normally, the upgrade should not impact personalization.

Hi @jarod5001,

Well, let’s just say that I experimented with putting the files in another location - fooled by an error in their documentation - and it broke everything. So I’ll take Yann’s advice and use /var/www/cryptpad/customize/application_config.js for the configuration files.

(Not to mention that re-adding the LoginSalt value back to its proper location after correcting the error - broke the users’ login.)

I’ll see how the next update goes and report.

According to the upgrade script , all files will be replaced by the source. To keep customize folder, it should be ynh_setup_source --dest_dir="$install_dir" --keep="customize"

1 Like

Hello, the upgrades did not broke my customisation, all stay in place. You can also have a /var/www/cryptpad/customize/main.js (a copy of customize.dist/application_config.js

Fix in testing… Testing by ericgaspar · Pull Request #239 · YunoHost-Apps/cryptpad_ynh · GitHub

1 Like

Kudos, merci beaucoup @ericg !

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.