How/when does keyhelp re-generate configs from templates?

Locked
superrandom
Posts: 9
Joined: Tue 16. Jun 2020, 20:33

How/when does keyhelp re-generate configs from templates?

Post by superrandom »

Hi there,

I have been lurking around for a bit trying to figure out if a templating system has been implemented yet for apache stuff, or nginx integration. It seems both are remote goals by now, not sure if they're still being implemented or not so I poked around a bit and found that the templates I'm interested in are in

Code: Select all

/keyhelp/install/templates/apache/2.4/
  • 1. Does keyhelp replace templates upon updating?
  • 2. Is it open source so I can fork it maybe?
  • 3. Am I better off making the template file immutable?
Thanks!
User avatar
george
Posts: 87
Joined: Fri 3. Jan 2020, 05:53
Location: AUSTRALIA

Re: How/when does keyhelp re-generate configs from templates?

Post by george »

Hi Superrandom, I have seen similar requests here, but I don't think anyone is actually doing this.
It would be interesting to hear your findings. This will help you get rolling...
1. Does keyhelp replace templates upon updating?

2. Is it open source so I can fork it maybe?

3. Am I better off making the template file immutable?
1. The entire keyhelp directory is replaced upon upgrade.
2. Not open source, so I would ask the developers first.
3. Immutable? Not sure, this may bork the update?

Good luck in your quest!
superrandom
Posts: 9
Joined: Tue 16. Jun 2020, 20:33

Re: How/when does keyhelp re-generate configs from templates?

Post by superrandom »

Thanks :)

I was hoping someone from the dev team comes around here.

For 3; there's one way to find out! hehe
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: How/when does keyhelp re-generate configs from templates?

Post by Alexander »

Hello!

The file you found (/keyhelp/install/templates/apache/2.4/) is only for the KeyHelp vhost itself. It has nothing to do with the generation of domain vhosts.

If you want to add additional vhost directives, you can use the "Apache settings" tab within the settings of the domain (admin area only).


Do not set the immutable flag anywhere within /home/keyhelp/www/keyhelp, as this will break the panel update.


Due to an improved system I have recently implemented for some configuration files, I now would have all tools ready to implement an Apache-vhost-template-feature. I put your request on my list for KeyHelp 20.3 (next KeyHelp version will be 20.2) - do not pin me on that ;).

The support of Nginx is on the roadmap.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
superrandom
Posts: 9
Joined: Tue 16. Jun 2020, 20:33

Re: How/when does keyhelp re-generate configs from templates?

Post by superrandom »

That's very nice. And yes, precisely KeyHelp's own config is what I was after. Specifically:

Code: Select all

# Subdomain catch-all
IncludeOptional keyhelp/subdomain_catch_all.conf

# Default page, if domain not available.
<VirtualHost *:##webserver.https_port##>
    ServerName ##server.domain##
    ServerAlias *.##server.domain##
    SSLEngine On
    SSLCertificateFile /etc/ssl/keyhelp/keyhelp.pem
    SSLCertificateChainFile /etc/ssl/keyhelp/keyhelp-ca.crt
    Redirect / https://##server.domain##/index.php?page=notavailable
</VirtualHost>

# Default page | Redirect HTTP -> HTTPS
<VirtualHost *:##webserver.http_port##>
    ServerName ##server.domain##
    ServerAlias *.##server.domain##
    Redirect / https://##server.domain##/index.php?page=notavailable
</VirtualHost>
I don't want the visitor to end up on a "domain not available" page. If the domain resolved to the server's IP it must be either in progress of being added or by design.

Also the certificate stuff is hardcoded, and I couldn't find another way to implement my wildcard cert with redirection to HTTPs. Essentially what I'm doing is allowing users (which I treat as sites because it's just me on the VPS) to have their own subdomain already covered by the wildcard certificate. Another scenario is to use user.domain.name as a development copy of the live site.

If I can't set immutable flags on templates then my only other option would be to manually check for updates and run replacements again. I'd rather do that in templates but I have a feeling the ioncube obfuscated code will have already generated the actual config files by that time. Is there a way to manually trigger re-generation of config files from templates?

That's awesome that nginx and apache vhost templating are coming. I won't hold you to it, but will eagerly await.

Thank you!
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: How/when does keyhelp re-generate configs from templates?

Post by Alexander »

And yes, precisely KeyHelp's own config is what I was after.
If this is the case, then update the resulting file

Code: Select all

/etc/apache2/keyhelp/keyhelp.conf
and set the immutable flag on it, this would be fine.

This file would only receive an update during a panel update and only if it would be necessary. If it cannot be updated due to the immutable flag, it will report the error, but will carry on, so no problem.

Is there a way to manually trigger re-generation of config files from templates?
Yes, but this does not include the KeyHelp's own vhost, and will only update the user's domains vhost and bind files.

Code: Select all

php /home/keyhelp/www/keyhelp/bin/rewrite_user_configs.php 
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
superrandom
Posts: 9
Joined: Tue 16. Jun 2020, 20:33

Re: How/when does keyhelp re-generate configs from templates?

Post by superrandom »

You are awesome. Thank you again, that will work.
Locked