Skip to content

Commit 187c13c

Browse files
committed
security fix in backups
1 parent 7f9f606 commit 187c13c

File tree

1 file changed

+8
-49
lines changed

1 file changed

+8
-49
lines changed

plogical/backupUtilities.py

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,62 +1954,21 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
19541954

19551955
schedulerPath = '/home/cyberpanel/%s-backup.txt' % (backupDomain)
19561956

1957-
if not os.path.exists(backupPath) or not os.path.islink(backupPath):
1958-
command = 'mkdir -p %s' % (backupPath)
1959-
ProcessUtilities.executioner(command)
1960-
else:
1961-
writeToFile = open(schedulerPath, 'w')
1962-
writeToFile.writelines('1269')
1963-
writeToFile.close()
1964-
return 0
1957+
command = 'mkdir -p %s' % (backupPath)
1958+
ProcessUtilities.executioner(command, website.externalApp)
19651959

1966-
if not os.path.exists(backupPath) or not os.path.islink(backupPath):
1967-
command = 'chown -R %s:%s %s' % (website.externalApp, website.externalApp, backupPath)
1968-
ProcessUtilities.executioner(command)
1969-
else:
1970-
writeToFile = open(schedulerPath, 'w')
1971-
writeToFile.writelines('1278')
1972-
writeToFile.close()
1973-
return 0
19741960

19751961
##
19761962

1977-
if not os.path.exists(tempStoragePath) or not os.path.islink(tempStoragePath):
1978-
command = 'mkdir -p %s' % (tempStoragePath)
1979-
ProcessUtilities.executioner(command)
1980-
else:
1981-
writeToFile = open(schedulerPath, 'w')
1982-
writeToFile.writelines('1289')
1983-
writeToFile.close()
1984-
return 0
1963+
command = 'mkdir -p %s' % (tempStoragePath)
1964+
ProcessUtilities.executioner(command, website.externalApp)
19851965

1986-
if not os.path.exists(tempStoragePath) or not os.path.islink(tempStoragePath):
1987-
command = 'chown -R %s:%s %s' % (website.externalApp, website.externalApp, tempStoragePath)
1988-
ProcessUtilities.executioner(command)
1989-
else:
1990-
writeToFile = open(schedulerPath, 'w')
1991-
writeToFile.writelines('1298')
1992-
writeToFile.close()
1993-
return 0
1966+
command = 'chown -R %s:%s %s' % (website.externalApp, website.externalApp, tempStoragePath)
1967+
ProcessUtilities.executioner(command, website.externalApp)
19941968

19951969
##
1996-
if not os.path.exists(status) or not os.path.islink(status):
1997-
command = 'touch %s' % (status)
1998-
ProcessUtilities.executioner(command)
1999-
else:
2000-
writeToFile = open(schedulerPath, 'w')
2001-
writeToFile.writelines('1308')
2002-
writeToFile.close()
2003-
return 0
2004-
2005-
if not os.path.exists(status) or not os.path.islink(status):
2006-
command = 'chown cyberpanel:cyberpanel %s' % (status)
2007-
ProcessUtilities.executioner(command)
2008-
else:
2009-
writeToFile = open(schedulerPath, 'w')
2010-
writeToFile.writelines('1317')
2011-
writeToFile.close()
2012-
return 0
1970+
command = 'touch %s' % (status)
1971+
ProcessUtilities.executioner(command, website.externalApp)
20131972

20141973
result = backupUtilities.prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath)
20151974

0 commit comments

Comments
 (0)