[Full-Text-RSS] Ouvrir une page spécifique en mode privé

Bonjour à tous,
Je tente de packager Full-Text-RSS pour Yunohost -> https://github.com/inrepublica/full-text-rss_ynh/tree/testing

Les scripts sont presques terminés tout fonctionne correctement à l’exception d’un petit problème quand on l’utilise en mode privé. Il s’agit d’une application pour transformer un flux rss tronqué en un flux rss complet. On va donc l’utiliser principalement à l’aide d’un lecteur RSS qui va pointer sur l’app: https://MON_DOMAINE.TLD/full-text-rss/makefulltextfeed.php?url=sec%3A%2F%2Fwww.monfluxrss.com%2Frss.xml&max=5&links=preserve&exc=&submit=Create+Feed

Si l’application est en privé le lecteur RSS va pointer sur l’adresse et se heurter au SSO.

Du coup dans le script d’installation j’ai ajouté ceci:

#=================================================

# SETUP SSOWAT

#=================================================

ynh_script_progression --message="Configuring SSOwat..." --time --weight=1

if [ $is_public -eq 1 ]

then

# unprotected_uris allows SSO credentials to be passed anyway.

ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"

else

ynh_app_setting_set --app=$app --key=unprotected_regex --value="/makefulltextfeed.php$"

fi

Malheureusement cela ne fonctionne pas…
Je suis preneur d’un petit coup de main.

I guess what doesn’t work is the regex.

First, always better to match also the domain and the path, does not affect other apps.

But the problem is probably more about the regex on its own.
The $ at the end means, for a regex, that this is the end of the line.
Clearly not what you want.

Something like /makefulltextfeed.php\?url=.*$ should be better.

Je viens de tester cette regex et effectivement cela semble fonctionner. En étant déconnecté du SSO j’ai bien accès à https://yunohostdebug.fr/full-text-rss/makefulltextfeed.php?url=sec%3A%2F%2Fwww.lesnumeriques.com%2Frss.xml&max=1&links=preserve&exc=&submit=Create+Feed par exemple.

Par contre nouveau problème si j’ajoute ce flux à un lecteur RSS comme leed par exemple, j’ai une erreur:
cURL error 60: SSL certificate problem: self signed certificate in certificate chain

C’est peut-être lié au fait que je teste sur une VM en local avec un faux nom de domaine?

Finalement cela ne marche pas j’avais juste accès au cache… pas facile de tester ça en local.

A bad interpretation before, this is:

/makefulltextfeed.php\?url=.*$

With a back slash before the question mark.

Bon je viens de tester cela ne marche toujours pas…

Have a look to the file /etc/ssowat/conf.json to be sure the regex didn’t get interpreted before ending in the file.
It’s also often easier to work directly from this file to find the correct regex.

Voici mon conf.json:

{
    "additional_headers": {
        "Auth-User": "uid", 
        "Email": "mail", 
        "Name": "cn", 
        "Remote-User": "uid"
    }, 
    "domains": [
        "yunohostdebug.fr"
    ], 
    "permissions": {
        "yunohostdebug.fr/distbin": [
            "inrepublica"
        ], 
        "yunohostdebug.fr/full-text-rss": [
            "inrepublica"
        ], 
        "yunohostdebug.fr/leed": [
            "inrepublica"
        ], 
        "yunohostdebug.fr/test": [
            "inrepublica"
        ]
    }, 
    "portal_domain": "yunohostdebug.fr", 
    "portal_path": "/yunohost/sso/", 
    "protected_regex": [], 
    "protected_urls": [
        "yunohostdebug.fr/full-text-rss"
    ], 
    "redirected_regex": {
        "yunohostdebug.fr/yunohost[\\/]?$": "https://yunohostdebug.fr/yunohost/sso/"
    }, 
    "redirected_urls": {}, 
    "skipped_regex": [
        "^[^/]*/%.well%-known/acme%-challenge/.*$", 
        "^[^/]*/%.well%-known/autoconfig/mail/config%-v1%.1%.xml.*$"
    ], 
    "skipped_urls": [
        "yunohostdebug.fr/test", 
        "yunohostdebug.fr/yunohost/admin", 
        "yunohostdebug.fr/yunohost/api"
    ], 
    "unprotected_regex": [
        "/makefulltextfeed.php\\?url=.*$"
    ], 
    "unprotected_urls": [
        "yunohostdebug.fr/distbin", 
        "yunohostdebug.fr/leed", 
        "yunohostdebug.fr/test"
    ], 
    "users": {
        "inrepublica": {
            "yunohostdebug.fr/distbin": "Distbin", 
            "yunohostdebug.fr/full-text-rss": "Full-Text-RSS", 
            "yunohostdebug.fr/leed": "Leed", 
            "yunohostdebug.fr/test": "Custom Webapp"
        }
    }
}

The double back slash is a problem, you should have only one.

It could be a problem though…
You did add only one when you add the regex in your script ?

Oui c’est bizarre… https://github.com/inrepublica/full-text-rss_ynh/blob/testing/scripts/install#L159-L170

How do your /etc/yunohost/apps/full-text-rss/settings.yml looks like for this line ?

settings.yml:

admin: motdepasse
apt_dependencies: php-tidy, php-apcu, php-zip
checksum__etc_nginx_conf.d_yunohostdebug.fr.d_full-text-rss.conf: d774ff511514585c7b2a6bf254c4849a
checksum__etc_php_7.0_fpm_pool.d_full-text-rss.conf: bb6d8ea011e1bc8d1874e797a6c60f3e
checksum__var_www_full-text-rss_custom_config.php: c5d889130c84073ecdfc3f3d4714e57e
domain: yunohostdebug.fr
final_path: /var/www/full-text-rss
fpm_config_dir: /etc/php/7.0/fpm
fpm_service: php7.0-fpm
id: full-text-rss
install_time: 1586181813
is_public: '0'
label: Full-Text-RSS
path: /full-text-rss
unprotected_regex: /makefulltextfeed.php\?url=.*$

So…
I’m being suspicious of the way the forum renders things…

Into your settings.yml, the regex is correct, we’re ok ?

Now, if you do sudo yunohost app ssowatconf, is your /etc/ssowat/conf.json still with a double back slash ?

EDIT: Indeed, it will…
The lazy way is to replace that \? by a .

Je viens de tester la commande yunohost app sswowatconf et le conf.json contient toujours le double back slash… Dans mon script j’ai bien qu’une seul back slash pourtant.

J’ai testé avec:

"unprotected_regex": [
        "/makefulltextfeed.php\.url=.*$"
    ],

Et j’ai plus accès à mon serveur de test, erreur 500… :thinking:

Replace \? by ., no back slash anymore as it doesn’t seem to goes without interpretation.

Avec ça:

"unprotected_regex": [
        "/makefulltextfeed.php.url=.*$"
    ],

Ça ne passe pas non plus… Je désespère de ces fichus regex!

Merci à Maniack Crudelis pour la solution:
Dans le fichier /etc/ssowat/conf.json:

"unprotected_regex": [
        "DOMAINE.TLD/YOUR_PATH/.+$"
    ],