Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting the archiver via HTTPS fails with self signed certificate #9849

Open
flying-squirrel opened this issue Feb 25, 2016 · 8 comments
Open
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.

Comments

@flying-squirrel
Copy link

Dear Developers,

I already posted this on the Piwik Forum but was asked to post it on GitHub as well.

Due to a shared server I have to run Auto-Archiving via Webcron. I followed the instructions provided by Piwik to implement the Auto-Archiving via Webcron. But when I paste the URL (https://subdomain.domain.com/misc/cron/archive.php?token_auth=correct-token) into my browser, I get the following message:

Error: Die Methode 'runCronArchiving' existiert nicht oder ist im Modul '\Piwik\Plugins\CoreAdminHome\API' nicht verfügbar.

Which translates to:
Error: The method 'runCronArchiving' does not exist or is not available in the module '\Piwik\Plugins\CoreAdminHome\API'.

Does anybody have a clue what I may be doing wrong?

I do have an old install of Piwik with Auto-Archiving enabled (also with Webcron) and this installation runs without any problem.

Thanks in advance for your help! It is very appreciated.

@tsteur
Copy link
Member

tsteur commented Feb 25, 2016

Most likely the auth token you are using is not the token of a super user.

If the token is from a valid super user, please consider to do a manual update and don't forget to backup config/config.ini.php.

Hope this helps. Feel free to comment if not and we can reopen the issue

@tsteur tsteur closed this as completed Feb 25, 2016
@tsteur tsteur added the worksforme The issue cannot be reproduced and things work as intended. label Feb 25, 2016
@tsteur tsteur added this to the 2.16.1 milestone Feb 25, 2016
@tsteur tsteur self-assigned this Feb 25, 2016
@flying-squirrel
Copy link
Author

Thanks Thomas, but unfortunately this didn't help. The error is still:

Error: The method 'runCronArchiving' does not exist or is not available in the module '\Piwik\Plugins\CoreAdminHome\API'.

@tsteur
Copy link
Member

tsteur commented Mar 6, 2016

I tried to reproduce but works fine for me. Have you tried the token of a super user? Are you sure you are using a token of a user that has super user access? I get the same error message when using an invalid token or a token of a user that is not super user

@flying-squirrel
Copy link
Author

I used the token of a super user. But for testing, I created another super user and used it's token: now it worked. BUT: I get a new error message:

START
INFO CoreAdminHome[2016-03-07 11:30:58] Starting Piwik reports archiving...
INFO CoreAdminHome[2016-03-07 11:30:58] - tracking data found for website id 1 (between 2016-03-06 23:00:00 and 2016-03-07 12:30:58)
INFO CoreAdminHome[2016-03-07 11:30:58] Will pre-process for website id = 1, period = day, date = last3
INFO CoreAdminHome[2016-03-07 11:30:58] - pre-processing all visits
ERROR CoreAdminHome[2016-03-07 11:30:58] Empty or invalid response 'Got invalid response from API request: https://subdomain.domain.org/?module=API&method=API.get&idSite=1&period=day&date=last3&format=php&trigger=archivephp&token_auth=removed. Response was 'curl_exec: SSL certificate problem: self signed certificate. Hostname requested was: subdomain.domain.org'' for website id 1, Time elapsed: 0.191s, skipping
INFO CoreAdminHome[2016-03-07 11:30:58] Done archiving!

I don't know what I can do here ...

@tsteur
Copy link
Member

tsteur commented Mar 7, 2016

Can you try it via http? I know it's not really a solution but maybe give it a try. It might be an option in case you are triggering the cron archiver from the same server and https is not as much needed.

It's almost like we need some kind of option to ignore SSL certificate errors for archiving only. I will reopen the issue and change the title.

@tsteur tsteur reopened this Mar 7, 2016
@tsteur tsteur added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. and removed worksforme The issue cannot be reproduced and things work as intended. labels Mar 7, 2016
@tsteur tsteur removed their assignment Mar 7, 2016
@tsteur tsteur removed this from the 2.16.1 milestone Mar 7, 2016
@tsteur tsteur changed the title Auto-Archiving: ‘runCronArchiving’ not existing or not available Starting the archiver via HTTPS fails with self signed certificate Mar 7, 2016
@tsteur
Copy link
Member

tsteur commented Mar 9, 2016

I just noticed there is already a setting accept-invalid-ssl-certificate for the core:archive command. So all we need to do is to expose a GET parameter to this script that sets $archiver->acceptInvalidSSLCertificate=true here https://github.com/piwik/piwik/blob/2.16.0/plugins/CoreAdminHome/API.php#L124

I'm adding an easy-pick label.

@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Mar 9, 2016
@mattab mattab added this to the Mid term milestone Mar 31, 2016
@flying-squirrel
Copy link
Author

Thanks Thomas,
I returned for the next try to fix the problem. I just pasted the URL (see my opening post) with a super user token in my browser and hit return. And it just worked. I didn't update Piwik or anything. It simply worked ... I don't know why and it is strange, but I'm ok with it ;)

To set up the cronjob with my hosting company I have to use http because there is an error message regarding the certificate. But for now it's ok.

Thank you all for your patience and your work! I really appreciate it.

@tsteur
Copy link
Member

tsteur commented Apr 7, 2016

No worries, I'm glad it works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

No branches or pull requests

3 participants