Update site_api.py

防跨站攻击(open_basedir) 手动设置生效,不自动生效
This commit is contained in:
midoks
2019-04-24 23:40:55 +08:00
parent c6ca74631b
commit 435319ac1f
+7 -8
View File
@@ -994,7 +994,6 @@ class site_api:
path = request.form.get('path', '').encode('utf-8')
path = self.getPath(path)
print path
if path == "" or mid == '0':
return public.returnJson(False, "目录不能为空!")
@@ -1013,13 +1012,13 @@ class site_api:
public.writeFile(file, conf)
# 创建basedir
userIni = path + '/.user.ini'
if os.path.exists(userIni):
public.execShell("chattr -i " + userIni)
public.writeFile(userIni, 'open_basedir=' + path + '/:/tmp/:/proc/')
public.execShell('chmod 644 ' + userIni)
public.execShell('chown root:root ' + userIni)
public.execShell('chattr +i ' + userIni)
# userIni = path + '/.user.ini'
# if os.path.exists(userIni):
# public.execShell("chattr -i " + userIni)
# public.writeFile(userIni, 'open_basedir=' + path + '/:/tmp/:/proc/')
# public.execShell('chmod 644 ' + userIni)
# public.execShell('chown root:root ' + userIni)
# public.execShell('chattr +i ' + userIni)
public.restartWeb()
public.M("sites").where("id=?", (mid,)).setField('path', path)