wsgi脚本的环境被隔离在httpd,CentOS 7上
我正在使用mod_wsgi在CentOS 7上托pipe一个简单的wsgi应用程序 ,并尝试删除下面所示的隔离。 wsgi应用程序, 以下脚本是我的wsgi应用程序。 它会创build一个名为/tmp/test-wsgi.txt的文件 枚举/tmp的内容作为一个简单的json列表 码: def application(environ, start_response): status = '200 OK' headers = [('Content-Type', 'application/json')] start_response(status, headers) with open('/tmp/test-wsgi.txt', 'w+') as w: w.write('hello world') files = os.listdir('/tmp') return json.dumps(files) 当我访问我的Web应用程序时,我收到以下回复 ["test-wsgi.txt"] 太好了! 然而, 以root身份连接到相同的主机服务器, 我打开了一个shell并执行cat /tmp/test-wsgi.txt 从玩弄它,似乎在我的wsgi脚本内的任何文件系统操作(枚举/创build/套接字访问)是“环境隔离” (如chroot监狱)。 奇怪的是我没有configuration任何types的隔离。 httpdconfiguration /etc/httpd/conf.d/my-app.conf <VirtualHost *:80> DocumentRoot /opt/my-app/ WSGIScriptAlias / /opt/my-app/apache/wsgi.py <Directory /opt/my-app/apache> Order […]