|
|
|
@ -357,15 +357,18 @@ class site_api: |
|
|
|
|
|
|
|
|
|
def setDirUserIniApi(self): |
|
|
|
|
path = request.form.get('path', '') |
|
|
|
|
runPath = request.form.get('runPath', '') |
|
|
|
|
filename = path + '/.user.ini' |
|
|
|
|
self.delUserInI(path) |
|
|
|
|
|
|
|
|
|
if os.path.exists(filename): |
|
|
|
|
self.delUserInI(path) |
|
|
|
|
mw.execShell("which chattr && chattr -i " + filename) |
|
|
|
|
os.remove(filename) |
|
|
|
|
return mw.returnJson(True, '已清除防跨站设置!') |
|
|
|
|
mw.writeFile(filename, 'open_basedir=' + path + |
|
|
|
|
'/:/www/server/php:/tmp/:/proc/') |
|
|
|
|
|
|
|
|
|
self.setDirUserINI(path, runPath) |
|
|
|
|
mw.execShell("which chattr && chattr +i " + filename) |
|
|
|
|
|
|
|
|
|
return mw.returnJson(True, '已打开防跨站设置!') |
|
|
|
|
|
|
|
|
|
def logsOpenApi(self): |
|
|
|
@ -2357,17 +2360,17 @@ location ^~ {from} { |
|
|
|
|
|
|
|
|
|
# 设置目录防御 |
|
|
|
|
def setDirUserINI(self, sitePath, runPath): |
|
|
|
|
newPath = sitePath + runPath |
|
|
|
|
|
|
|
|
|
filename = newPath + '/.user.ini' |
|
|
|
|
if os.path.exists(filename): |
|
|
|
|
mw.execShell("chattr -i " + filename) |
|
|
|
|
os.remove(filename) |
|
|
|
|
return mw.returnJson(True, '已清除防跨站设置!') |
|
|
|
|
|
|
|
|
|
newPath = sitePath + runPath |
|
|
|
|
self.delUserInI(newPath) |
|
|
|
|
|
|
|
|
|
openPath = 'open_basedir={}/:{}/'.format(newPath, sitePath) |
|
|
|
|
|
|
|
|
|
mw.writeFile(filename, openPath + ':/www/server/php:/tmp/:/proc/') |
|
|
|
|
mw.execShell("chattr +i " + filename) |
|
|
|
|
|
|
|
|
|