Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#1699 closed Bug (fixed)

checkUserIsSuperUser aborting archive.sh

Reported by: tgrondin Owned by:
Priority: major Milestone: Piwik 1.1
Component: Core Keywords:
Cc: Sensitive: no

Description

Initial Ticket was closed without chance to correct initial report.

The last two errors from the referenced bug report were just other examples of issues that were showing up. I know we can change the script and the user which is needed to work. However even after bash is installed and the script is run as root using bash there is still the initial error from the previous bug report when running the script.

Error:
Using /usr/local/bin/bash misc/cron/archive.sh
""
Starting Piwik reports archiving...
Reports archiving finished. Starting Scheduled tasks...
Error: You can't access this resource as it requires a 'superuser' access.Finished Scheduled tasks.""

It is not running any reports at all. There are about 12 websites in there. Its just throwing errors about access. Is there a cause for this that I am missing?

Attachments (1)

piwik output.txt (1.2 KB) - added by tgrondin 4 years ago.
Piwik output on archive.sh run

Download all attachments as: .zip

Change History (11)

comment:1 Changed 4 years ago by vipsoft (robocoder)

  • Milestone set to 1.1 - Piwik 1.1
  • Summary changed from In Reference to Ticket #1698 to checkUserIsSuperUser aborting archive.sh

Sorry, looks like I jumped the gun.

I can't reproduce the initial error. In core/Access.php's checkUserIsSuperUser(), can you replace the method with this ... maybe it'll tell us where the privilege check is occurring.

        public function checkUserIsSuperUser()
        {
                if(!$this->isSuperUser())
                {
                        debug_print_backtrace();
                        throw new Piwik_Access_NoAccessException(Piwik_TranslateException('General_ExceptionPrivilege', array("'superuser'")));
                }
        }

comment:2 Changed 4 years ago by tgrondin

I changed the code to match and here is the output.
####
Using sh it is throwing this message:

sh misc/cron/archive.sh
Starting Piwik reports archiving...

Reports archiving finished.
Starting Scheduled tasks...

#0 Piwik_Access->checkUserIsSuperUser() called at usr/local/www/piwik/core/Piwik.php:1233
#1 Piwik::checkUserIsSuperUser() called at usr/local/www/piwik/plugins/CoreAdminHome/API.php:36
#2 Piwik_CoreAdminHome_API->runScheduledTasks()
#3 call_user_func_array(Array ([0] => Piwik_CoreAdminHome_API Object (),[1] => runScheduledTasks), Array ()) called at usr/local/www/piwik/core/API/Proxy.php:151
#4 Piwik_API_Proxy->call(Piwik_CoreAdminHome_API, runScheduledTasks, Array ([token_auth] => 7a9205a66ed1cb755f1b52356ebdc352,[--] => ,[module] => API,[method] => CoreAdminHome.runScheduledTasks,[format] => csv,[convertToUnicode] => 0,[filter_limit] => 50)) called at usr/local/www/piwik/core/API/Request.php:117
#5 Piwik_API_Request->process() called at usr/local/www/piwik/plugins/API/Controller.php:27
#6 Piwik_API_Controller->index()
#7 call_user_func_array(Array ([0] => Piwik_API_Controller Object ([] => API,[] => ,[] => ,[] => 0,[] => ),[1] => index), Array ()) called at usr/local/www/piwik/core/FrontController.php:126
#8 Piwik_FrontController->dispatch() called at usr/local/www/piwik/index.php:60
Error: You can't access this resource as it requires a 'superuser' access.Finished Scheduled tasks.

####
If I use bash -e then it shows this:

bash -e misc/cron/archive.sh
Starting Piwik reports archiving...

Nothing is updated in either case. Very odd. I apologize for the hassle, but this is driving me crazy. :)

Would it be better to attach the output in a separate file?

Changed 4 years ago by tgrondin

Piwik output on archive.sh run

comment:3 Changed 4 years ago by tgrondin

I'm not sure why this is, but the token auth as showing in the above output (7a9205a66ed1cb755f1b52356ebdc352) does not match the token assigned to any user in the system. That exact string does not exist in the database at all.

comment:4 Changed 4 years ago by tgrondin

Well, at the risk of sounding like a idiot I think I figured out the problem. This install is from .04 or 5 that has been continuously upgraded. I noticed on a clean install that it does not allow for spaces in the administrator user name.

I edited the config.ini.php to remove the space from my admin login name on my old install and the script now works as expected.

I can't imagine nobody else has run into this. I must have missed the memo.

Thank you for your help

comment:5 Changed 4 years ago by matt (mattab)

Someone ran into this issue before which is we now forbid spaces in passord. However we didn't deal with existing SU passords containing spaces (as you were probably only 2 users affected by this..)

comment:6 Changed 4 years ago by tgrondin

In my case it was a space in the user name not the password. In any case, I'm confirming it fixed by removing the space from my user name.

comment:7 Changed 4 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [3154]) fixes #1699 - add an update warning if superuser login is no longer a valid format

comment:8 Changed 4 years ago by matt (mattab)

vipsoft, I thought the issue was also with the SU password containing spaces? The patch deals with username only. thanks:)

comment:9 Changed 4 years ago by vipsoft (robocoder)

matt: even if so, there's no way to determine that since we only save a hash

comment:10 Changed 3 years ago by matt (mattab)

indeed, thanks for following up

Note: See TracTickets for help on using tickets.