@@ -270,51 +270,6 @@ def startBackup(tempStoragePath, backupName, backupPath, metaPath = None):
270270
271271 make_archive (os .path .join (tempStoragePath ,"public_html" ), 'gztar' , os .path .join ("/home" ,domainName ,"public_html" ))
272272
273- ##### Saving SSL Certificates if any
274-
275- sslStoragePath = '/etc/letsencrypt/live/' + domainName
276-
277- if os .path .exists (sslStoragePath ):
278- try :
279- copy (os .path .join (sslStoragePath , "cert.pem" ), os .path .join (tempStoragePath , domainName + ".cert.pem" ))
280- copy (os .path .join (sslStoragePath , "fullchain.pem" ), os .path .join (tempStoragePath , domainName + ".fullchain.pem" ))
281- copy (os .path .join (sslStoragePath , "privkey.pem" ), os .path .join (tempStoragePath , domainName + ".privkey.pem" ))
282- except :
283- pass
284-
285- ## Child Domains SSL.
286-
287-
288- childDomains = backupMetaData .findall ('ChildDomains/domain' )
289-
290- try :
291- for childDomain in childDomains :
292-
293- actualChildDomain = childDomain .find ('domain' ).text
294-
295- if os .path .exists (backupUtilities .licenseKey ):
296- completPathToConf = backupUtilities .Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf'
297- copy (completPathToConf , tempStoragePath + '/' + actualChildDomain + '.vhost.conf' )
298-
299- ### Storing SSL for child domainsa
300-
301- sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
302-
303- if os .path .exists (sslStoragePath ):
304- try :
305- copy (os .path .join (sslStoragePath , "cert.pem" ),
306- os .path .join (tempStoragePath , actualChildDomain + ".cert.pem" ))
307- copy (os .path .join (sslStoragePath , "fullchain.pem" ),
308- os .path .join (tempStoragePath , actualChildDomain + ".fullchain.pem" ))
309- copy (os .path .join (sslStoragePath , "privkey.pem" ),
310- os .path .join (tempStoragePath , actualChildDomain + ".privkey.pem" ))
311- make_archive (os .path .join (tempStoragePath , "sslData-" + domainName ), 'gztar' ,
312- sslStoragePath )
313- except :
314- pass
315- except BaseException , msg :
316- pass
317-
318273 logging .CyberCPLogFileWriter .statusWriter (status , "Backing up databases.." )
319274 print '1,None'
320275
@@ -336,11 +291,59 @@ def startBackup(tempStoragePath, backupName, backupPath, metaPath = None):
336291 @staticmethod
337292 def BackupRoot (tempStoragePath , backupName , backupPath , metaPath = None ):
338293
339- ## backup emails
340-
341294 status = os .path .join (backupPath , 'status' )
342295 metaPathInBackup = os .path .join (tempStoragePath , 'meta.xml' )
343296 backupMetaData = ElementTree .parse (metaPathInBackup )
297+
298+ domainName = backupMetaData .find ('masterDomain' ).text
299+ ##### Saving SSL Certificates if any
300+
301+ sslStoragePath = '/etc/letsencrypt/live/' + domainName
302+
303+ if os .path .exists (sslStoragePath ):
304+ try :
305+ copy (os .path .join (sslStoragePath , "cert.pem" ), os .path .join (tempStoragePath , domainName + ".cert.pem" ))
306+ copy (os .path .join (sslStoragePath , "fullchain.pem" ),
307+ os .path .join (tempStoragePath , domainName + ".fullchain.pem" ))
308+ copy (os .path .join (sslStoragePath , "privkey.pem" ),
309+ os .path .join (tempStoragePath , domainName + ".privkey.pem" ))
310+ except BaseException , msg :
311+ logging .CyberCPLogFileWriter .writeToFile ('%s. [283:startBackup]' % (str (msg )))
312+
313+ ## Child Domains SSL.
314+
315+ childDomains = backupMetaData .findall ('ChildDomains/domain' )
316+
317+ try :
318+ for childDomain in childDomains :
319+
320+ actualChildDomain = childDomain .find ('domain' ).text
321+
322+ if os .path .exists (backupUtilities .licenseKey ):
323+ completPathToConf = backupUtilities .Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf'
324+ copy (completPathToConf , tempStoragePath + '/' + actualChildDomain + '.vhost.conf' )
325+
326+ ### Storing SSL for child domainsa
327+
328+ sslStoragePath = '/etc/letsencrypt/live/' + actualChildDomain
329+
330+ if os .path .exists (sslStoragePath ):
331+ try :
332+ copy (os .path .join (sslStoragePath , "cert.pem" ),
333+ os .path .join (tempStoragePath , actualChildDomain + ".cert.pem" ))
334+ copy (os .path .join (sslStoragePath , "fullchain.pem" ),
335+ os .path .join (tempStoragePath , actualChildDomain + ".fullchain.pem" ))
336+ copy (os .path .join (sslStoragePath , "privkey.pem" ),
337+ os .path .join (tempStoragePath , actualChildDomain + ".privkey.pem" ))
338+ make_archive (os .path .join (tempStoragePath , "sslData-" + domainName ), 'gztar' ,
339+ sslStoragePath )
340+ except :
341+ pass
342+ except BaseException , msg :
343+ pass
344+
345+ ## backup emails
346+
344347 domainName = backupMetaData .find ('masterDomain' ).text
345348
346349 if os .path .islink (status ) or os .path .islink (tempStoragePath or os .path .islink (backupPath )) or os .path .islink (metaPath ):
@@ -551,8 +554,8 @@ def startRestore(backupName, dir):
551554 copy (completPath + "/" + masterDomain + ".fullchain.pem" , sslHome + "/fullchain.pem" )
552555
553556 sslUtilities .installSSLForDomain (masterDomain )
554- except :
555- pass
557+ except BaseException , msg :
558+ logging . CyberCPLogFileWriter . writeToFile ( '%s. [555:startRestore]' % ( str ( msg )))
556559
557560 else :
558561 logging .CyberCPLogFileWriter .statusWriter (status , "Error Message: " + result [1 ] + ". Not able to create Account, Databases and DNS Records, aborting. [5009]" )
0 commit comments