Bug report #18353

QGIS Server can't work with /tmp directory

Added by René-Luc ReLuc about 6 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:QGIS Server
Affected QGIS version:3.0.0 Regression?:No
Operating System:Linux (Ubuntu, Debian) Easy fix?:No
Pull Request or Patch supplied:No Resolution:no timely feedback
Crashes QGIS or corrupts data:No Copied to github as #:26243

Description

This is a generic issue about QGIS Server and Temporary directory.

If the environment variable HOME is set to /tmp and QGIS Server is used with fcgi, the message ERROR: Opening of authentication db FAILED is added at the end of the response. This message comes from QgsAuthManager https://github.com/qgis/QGIS/blob/master/src/core/auth/qgsauthmanager.cpp#L128 and is sent to the stdout.
The HOME variable has to be set to a directory that is not considered as a temporary directory by Qt and QGIS

If the project path is in /tmp, QGIS Server can't read it!
The WMS GetCapabilities response

<ServerException>Project file error</ServerException>

The QGIS Server log:

[30961][14:38:58] ******************** New request ***************
[30961][14:38:58] REMOTE_ADDR: 127.0.0.1
[30961][14:38:58] HTTP_USER_AGENT: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
[30961][14:38:58] MAP:/tmp/qgis/montpellier.qgs
[30961][14:38:58] REQUEST:GetCapabilities
[30961][14:38:58] SERVICE:WMS
[30961][14:38:58] Request finished in 6 ms

The QGIS log:

../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] ******************** New request ***************
../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] REMOTE_ADDR: 127.0.0.1
../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] HTTP_USER_AGENT: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] MAP:/tmp/qgis/montpellier.qgs
../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] REQUEST:GetCapabilities
../src/core/qgsmessagelog.cpp: 27: (logMessage) [0ms] 2018-03-06T14:40:23 Server[0] SERVICE:WMS
../src/server/qgsserver.cpp: 176: (configPath) [0ms] MAP:/tmp/qgis/montpellier.qgs
../src/core/qgsmessagelog.cpp: 27: (logMessage) [8ms] 2018-03-06T14:40:23 Server[0] Request finished in 8 ms

With QGIS Server 2.18, the WMS GetCapabilities response is not the same:

<ServiceExceptionReport version="1.3.0"><ServiceException code="WMS configuration error">There was an error reading the project file or the SLD configuration</ServiceException></ServiceExceptionReport>

In the log

Error, configuration file '/tmp/qgis/montpellier.qgs' does not exist

But the file exists!

History

#1 Updated by René-Luc ReLuc about 6 years ago

Alessandro Pasotti can you take a look ?

#2 Updated by Alessandro Pasotti almost 6 years ago

Hi, I looked at the code and made quick test but I cannot reproduce the issue.
There is nothing in the code that checks for the auth DB being in a temporary folder, you can set the path of the auth DB with the env var QGIS_AUTH_PASSWORD_FILE.
The error message is output to the console because there is no GUI and it was designed to work from a script.

#3 Updated by Alessandro Pasotti almost 6 years ago

Can we close this one?

#4 Updated by Alessandro Pasotti almost 6 years ago

  • Status changed from Open to Feedback

#5 Updated by Jürgen Fischer over 5 years ago

Is apache2 running under systemd with a private /tmp (ie. /tmp/systemd-private-.*-apache2.service-.*/tmp/)? In that case PrivateTmp in /lib/systemd/system/apache2.service has to be disabled to let apache and it children see the actual /tmp

#6 Updated by Jürgen Fischer about 5 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

Bulk closing 82 tickets in feedback state for more than 90 days affecting an old version. Feel free to reopen if it still applies to a current version and you have more information that clarify the issue.

Also available in: Atom PDF