usmannasir / cyberpanel

Cyber Panel - The hosting control panel for OpenLiteSpeed
GNU General Public License v3.0
1.53k stars 592 forks source link

[BUG] Backup meta.xml has redundant DNS records and Restore does not handle SSL certificates #1116

Open AsemKhatib opened 1 year ago

AsemKhatib commented 1 year ago

Important Backup and Restore tools in CP CLI needs important fixing to make them production ready.

Describe the bug

  1. backup tools is working fine, however inside meta.xml file which includes all major metadata for each website, includes duplicate DNS records which will be imported later during the restore creating mess in the DNS zone manager and therefore the website.
  2. After restoring a backup via CLI the size of the website still indicate 0MB as if it's empty when it's actually not, same thing for email accounts.
  3. letsencrypt certificates which was part of the backup for each domain are successfully copied to the new system inside /etc/letsencrypt/live/ however when running the command to list them /root/.acme.sh/acme.sh --list the system does not show any persisted certificates, as if they were hard copied without taking care of the config part :
    [root@centos-s-2vcpu-2gb-fra1-01 ~]# ls -la /etc/letsencrypt/live/
    drwxr-xr-x. 12 root root 249 Aug 19 17:50 .
    drwxr-xr-x.  3 root root  18 Aug 19 17:27 ..
    drwxr-xr-x.  2 root root  62 Aug 19 17:45 website.net
    [root@centos-s-2vcpu-2gb-fra1-01 live]# /root/.acme.sh/acme.sh --list
    Main_Domain  KeyLength  SAN_Domains  CA  Created  Renew

To Reproduce What steps did you take when the issue occurred? cyberpanel createBackup --domainName cyberpanel.net cyberpanel restoreBackup --fileName filename

Expected behavior

  1. Backup file meta.xml should pick dns records carefully and not to copy same record twice
  2. Some mechanism needs to be implemented to re-scan files/dirs/emails in the system to recalculate their sizes to be presented in CP interface after each backup restore.
  3. a proper script to migrate letsencrypt certificates in the backup need to be written, at the moment restore script does not take of this part properly.

Operating system: CentOS Linux release 7.9.2009 (Core)

CyberPanel version:

Current Version:  
4.3
Build:  
4
Current Commit:  
dd8ef0598f6c21ea0aa38fa84bd5bef1315e9819

P.s: I will be more than glad to help fix the issue if you tell me exactly where to look, was trying to figure out where to find the package plogical.backupUtilities which I think has the logic of backup and restore, however no luck so far.