cyberpanel icon indicating copy to clipboard operation
cyberpanel copied to clipboard

[FEATURE] Re-generate Openlitespeed/Litespeed Configuration

Open jordantrizz opened this issue 1 year ago • 7 comments

Describe the bug When the openlitespeed configuration becomes corrupt, there is no method to re-generate the configuration.

To Reproduce

  1. Delete half of the /usr/local/lsws/config/httpd.conf or remove a vhost file.

Expected behavior A command that regenerates the openlitespeed configuration.

Additional context If any thing is corrupted with the openlitespeed configuration, there is no method to restore the configuration.

jordantrizz avatar Jun 24 '23 15:06 jordantrizz

How about using backups or snapshot from provider?

Dreamer41 avatar Jun 25 '23 03:06 Dreamer41

How about using backups or snapshot from provider?

Sure, that's an option. But this is available in cPanel and GridPane.

jordantrizz avatar Jun 25 '23 14:06 jordantrizz

@jordantrizz

  1. can you change the title from [BUG] to [FEATURE] and add a proper description?
  2. why would the .conf file become corrupted in the first place?.. Full disk? Manual editing? Regeneration of a config file is not a solution to (bad) system management....
  3. You can always restore from Github: https://github.com/usmannasir/cyberpanel/blob/stable/serverStatus/litespeed/httpd.conf https://github.com/usmannasir/cyberpanel/blob/stable/install/litespeed/httpd.conf

jcn50 avatar Aug 12 '23 07:08 jcn50

  1. can you change the title from [BUG] to [FEATURE] and add a proper description?

Done.

2. why would the .conf file become corrupted in the first place?.. Full disk? Manual editing?

I created this issue due to investigating an issue for a friend; they had an outdated Cyberpanel instance which had two hacked WordPress sites. There were random characters on a couple of the Openlitespeed vhost configuration files, which caused only half the sites to function on the server.

Regeneration of a config file is not a solution to (bad) system management....

That's a valid opinion. However, re-generating a default configuration should be an option, it's the same as creating a new site. What happens if Cyberpanel encounters a bug and writes a malformed configuration file? What is the remote transfer tool using?

jordantrizz avatar Sep 28 '23 14:09 jordantrizz

It happened again. Don't know why these @^ are showing up.

virtualHost site1.com {
  vhRoot                  /home/$VH_NAME
  configFile              $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf
  allowSymbolLink         1
  enableScript            1
  restrained              1
}
virtualHost site2.com {
  vhRoot                  /home/$VH_NAME
  configFile              $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf
  allowSymbolLink         1
  ena^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@bleScript            1
  restrained              1
}

jordantrizz avatar Oct 11 '23 01:10 jordantrizz

@jcn50

  • why would the .conf file become corrupted in the first place?.. Full disk? Manual editing? Regeneration of a config file is not a solution to (bad) system management....

You saw my example, don't know where that is coming from, but this server had a couple of sites hacked. Do you have any idea why this might have happened? I've googled and haven't found anything.

  • You can always restore from Github: https://github.com/usmannasir/cyberpanel/blob/stable/serverStatus/litespeed/httpd.conf https://github.com/usmannasir/cyberpanel/blob/stable/install/litespeed/httpd.conf

Sure, but that doesn't regenerate the current server configuration for all the sites and configuration that have been set. I'm assuming that this is all in the database so that changes can be logged and tracked to allow for auditing and version control?

jordantrizz avatar Dec 20 '23 13:12 jordantrizz

Had this happen again, the same characters are showing up for different sites in different sections. But I was able to dig deeper.

^@ is the character which is (ASCII value 0)

You can remove it using tr

tr -d '\0' < httpd_config.conf > httpd_config.conf.fixed

jordantrizz avatar Jan 12 '24 21:01 jordantrizz