Hello,
I have a SPIP site where I have the following html displayed:
It is because, this is what is currently also shown when loading from certain browsers, IPs, the ecran_securite.php source file:
https://git.spip.net/spip-contrib-outils/securite/-/raw/master/ecran_securite.php
This file is normally downloaded via cronjob, using e.g.
wget « Error 403: Forbidden »
That is a horrible idea when there is a firewall: The result is that the firewall’s html is added to every SPIP website.
The documentation does not offer a specific way in which to load:
So I believe there are many ways people are loading the file, and this can create issues.
For critical projects, I have followed the forum’s advise and I use the following script:
#!/usr/bin/env bash
#ecran securite
ecran_securite_file_path="/var/www/master/config/ecran_securite.php"
ecran_securite_content_git=$(wget -qO -\
'https://git.spip.net/api/v4/projects/spip-contrib-outils%2Fsecurite/repository/files/ecran_securite.php?ref=master' \
)
ecran_securite_content_sha=$( jq -r '.content_sha256' <<< "${ecran_securite_content_git}" )
ecran_securite_content_encoded=$( jq -r '.content' <<< "${ecran_securite_content_git}" )
ecran_securite_content_decoded=$(echo "${ecran_securite_content_encoded}" | base64 --decode - )
ecran_securite_content_decoded_sha=$(echo -n "${ecran_securite_content_decoded}" | sha256sum | head -c 64)
if [[ "${ecran_securite_content_sha}" == "${ecran_securite_content_decoded_sha}" ]]; then
echo -n "${ecran_securite_content_decoded}" > "${ecran_securite_file_path}"
# exit 0
fi
But this is not very convenient and also requires jq as dependency.
The issue is perhaps not simple to fix. Turning off the firewall for that route could be good. Or hosting it statically elsewhere. Or we recommend people to not use wget.
Or that SPIP handles this by itself. But again, if it makes a http request, it could fail in the same way, and then ecran_securite will not update.
Should this be added to the core, in a way in which it cannot fail? I am thinking a SPIP tache/cron. Instead of needing to set this up separately.
Sorry I am just reporting an issue here without a (simple) solution.
Urs


