Ticket #1654 (closed Bug: invalid)

Opened 18 months ago

Last modified 14 months ago

File permissions in PHP Apache mode

Reported by: philmck Owned by:
Priority: normal Milestone: Piwik 1.0
Component: Core Keywords:
Cc: Sensitive: no

Description

When installed on a server that runs PHP in "Apache" mode (rather than "CGI" mode), temporary files created by Piwik (e.g. in /tmp/sessions) are created with default permissions of 600, which means they can't be subsequently written or modified by Piwik. They need permisions of at least 606 on this sort of server - i.e., publicly writeable.

This is such an obvious problem I can't believe it hasn't been reported, yet I haven't been able to find it (humble apologies therefore if it's a duplicate). Piwik is so close to being an excellent utility, and so close to v1.0 now it seems a pity to let this go.

The workaround implemented by my hosting company is to set up a cron job to periodically CHMOD all files in /tmp to be writeable, but this is a but of a kludge.

Change History

Changed 18 months ago by vipsoft

  • keywords PHP, permissions, Apache mode removed
  • status changed from new to closed
  • resolution set to invalid
  • milestone set to 4 - Piwik 1.0

I already have plans to add a system check at installation.

In the meantime... your change might be considered a security vulnerability, ie locally exploitable session file hijacking.

Try chmod -R apache /your/piwik/folder

Changed 18 months ago by vipsoft

Sorry... I meant chown (not chmod).

Changed 18 months ago by philmck

Sadly, I can't chown files, I'm on shared hosting. My provider claims the alternatives are even less secure and wouldn't allow it anyway - there are arguments both ways, I know.

Glad to hear there are plans to address this, anyway. I defected to Google analytics for a while because of this, but it's just not the same.

Changed 18 months ago by vipsoft

If you were on a dedicated host, you could set apache's umask instead of using the hackish cron job. But on shared hosting, making your files world-writeable is a bad idea.

Your provider evidently hasn't heard of using phpsuexec for php-cgi (php runs under your user ID), or using php-fpm (which allows workers to be started with a different uid/gid or php.ini).

Changed 14 months ago by gerritvanaaken

I’d like to confirm this issue. I need to make FTP backups of my whole project folder, and my FTP client stops working when it encounters those files that are only readable by the owner.

Changed 14 months ago by vipsoft

gerritvanaaken: please use the forum for further followup (instead of commenting on a closed ticket). You can safely ignore files in the tmp folder when ftp-ing.

Note: See TracTickets for help on using tickets.