paspo / roundcube_export_provisioning

Roundcube plugin that generates an email provisioning file
GNU General Public License v2.0
1 stars 5 forks source link

Clicking [Download] to download iOS Profile crashes with error 500 #8

Closed MacLemon closed 5 years ago

MacLemon commented 5 years ago

Summary:

When clicking the download button, the plugin crashes returning an error 500 to the user.

Steps to Reproduce:

Expected Results:

Should download a .mobileconfig.

Actual Results:

Error 500, nothing else.

Regression:

Tag 1.1.3 already crashes when clicking the sidebar menu item, dev crashes when actually clicking a download link. Possibly a PHP 7.2 incompatibility or unknown missing PHP module?

Notes:

Plugin installed manually as composer doesn't seem to work for me with the commands shown in the documentation. Absolutely nothing is logged in php-fpm.log, nginx' error_log or the system log even with E_ALL and error reporting turned on in PHP development mode.

Version Information:

PHP: 7.2.14 export_provisioning: Dev from master branch, commit 6b48cd452b066a5fadd20227a1c16f43d36aa008 (Fri Aug 18 10:53:57 2017 +0200) Running via php-fpm behind nginx. roundcube/plugin-installer: As bundled with roundcube 1.3.8

Installed PHP modules as reported by php -m:

[PHP Modules]
Core
ctype
curl
date
dom
exif
fileinfo
filter
hash
iconv
intl
json
libxml
mbstring
memcached
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
Reflection
session
SPL
standard
xml
zip
paspo commented 5 years ago

Hi @MacLemon, and thanks for the feedback.

I would like to discuss this problem from two different viewpoints, based on the commits.

tag 1.1.3:

You're perfectly right: if you use tag 1.1.3, you get a 500 error when you enter the "provisioning" configuration page. This issue had been already fixed with #6: it was a compatibility problem due to a breaking change with roundcube 1.3. On second tought, I should version-bump to 1.1.4 to include all the new modifications. I'll do that.

problem in master branch

I can't reproduce this one. Here are the steps I made:

  1. I start a new roundcube docker instance:
docker run -e "ROUNDCUBEMAIL_DEFAULT_HOST=<my_mail_server>" --name rc -p 80:80 roundcube/roundcubemail:1.3.8-apache

This image is the official roundcube docker image. It's based on Debian 9 Stretch, with apache 2.4.25 and php 7.1.26. See below for testing with php 7.2.

  1. I get a shell into it:
    docker exec -ti rc bash
  2. I checkout export_provisioning:
    mkdir /var/www/html/plugins/export_provisioning
    apt install -y git
    git clone -b master https://github.com/paspo/roundcube_export_provisioning.git /var/www/html/plugins/export_provisioning/
  3. I enable the plugin:
    sed -i "s/\$config\['plugins'\].*/\$config['plugins'] = ['archive','zipdownload','export_provisioning'];/" /var/www/html/config/config.inc.php
  4. Login, settings, provisioning, download for Apple, download for Microsoft, and everything is ok.
  5. Tested again with php 7.2.15, with same results.

test with php-fmp + nginx instead of apache

Just to be sure, I tested even with php-fpm:

  1. I started a container with fpm:
    docker run --rm --name rc -e "ROUNDCUBEMAIL_DEFAULT_HOST=<my_mail_server>" -v $PWD/httproot:/var/www/html roundcube/roundcubemail:1.3.8-fpm
  2. I started another container with nginx:
    cat >default.conf <<EOF
    server {
    listen 80;
    server_name localhost;
    location / {
        root /var/www/html;
        index index.php index.html index.htm;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
    location ~ \.php$ {
        root html;
        fastcgi_pass rc:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
        include fastcgi_params;
    }
    }
    EOF
    docker run --rm --name nginx --link rc -v "$PWD/default.conf:/etc/conf.d/default.conf" -v "$PWD/httproot:/var/www/html" -p 80:80 -ti nginx:latest
  3. go to step 3 of apache testing

how to test php 7.2

All the tests were made with the official roundcube docker image, which is available here: https://github.com/roundcube/roundcubemail-docker If you want php 7.2, you just change the first line of the Dockerfile and issue a new build:

docker build -t roundcube/roundcubemail:1.3.8-apache-7.2 .

You can do the same with fpm.

some random toughts

Thanks

MacLemon commented 5 years ago

I've updated to 1.1.4 now and PHP 7.2.15, with all modules as listed above in place and up-to-date. (I cannot test other PHP versions there at the moment.)

$config['default_port'] was not explicitly set, it uses the default setting which is 993 (for IMAP/S). Setting it explicitly to 993 doesn't change anything. User is set to: $config['smtp_user'] = '%u';. Pass is set to: $config['smtp_pass'] = '%p';

All other parameters are set explicitly and working fine with Roundcube.

Downloading the Microsoft config file does work fine with the same setup. Only trying to download the iOS config results in a 500.

Could it be a PHP module that is implicitly installed on your setup which is not there in my deployment? I usually get a helpful stack trace in such a case, but who knows.

paspo commented 5 years ago

Maybe I found it: could it be SimpleXML that's missing?

MacLemon commented 5 years ago

I did not have the SimpleXML PHP module installed. (See the module list I posted in my original posting.) I have installed SimpleXML, restarted php-fpm and I can confirm that it works now on macOS. \o/

I recommend adding SimpleXML as an additional Requirement in the Roundcube Plugin Directory since that PHP module is on-top of Roundcube's requirements and obviously doesn't come standard with some PHP distributions.

--

On iOS the download link is outside of the viewport and cannot be tapped or otherwise used. That's a separate issue though. The download link must be positioned a lot more to the left. Shall I file a separate issue for that?

paspo commented 5 years ago

Can you please test in your setup that the branch test-simplexml-req is alerting you about the missing module?

paspo commented 5 years ago

On iOS the download link is outside of the viewport and cannot be tapped or otherwise used. That's a separate issue though. The download link must be positioned a lot more to the left. Shall I file a separate issue for that?

Sure!

MacLemon commented 5 years ago

Can you please test in your setup that the branch test-simplexml-req is alerting you about the missing module?

Tested and it just returns a 500 as well. Nothing in nginx' error_log or php-fpm.log nor a message in the browser.

paspo commented 5 years ago

Of course it does. The only change was in composer.json.

It should alert you when you issue this command:

composer require "paspo/export_provisioning:dev-test-simplexml-req"

The error message is something like:

  Problem 1
    - Installation request for paspo/export_provisioning dev-test-simplexml-req -> satisfiable by paspo/export_provisioning[dev-test-simplexml-req].
    - paspo/export_provisioning dev-test-simplexml-req requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.

Note that for these kind of tests your composer.json should contain:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/paspo/roundcube_export_provisioning"
        }
    ]
}

Sorry that I wasn't clear about my request.

MacLemon commented 5 years ago

I'm not using composer, hence not using the stated command that would perhaps throw an error. It was a manual install as stated in the original issue and doesn't log anything at runtime.

Disregarding composer issues, the original problem was fixed by installing the SimpleXML module.