Ability to prevent autossl editing .htaccess files
This request was superseded by https://features.cpanel.net/topic/autossl-act-differently-based-on-apache-version
cPanel currently plans to edit .htaccess rewrite rules in v60 to make sure rewrite rules don't block AutoSSL verification.
We have added appropriate rules to vhosts includes (that require Apache 2.4 or LiteSpeed to work) rendering editing .htaccess files useless in our case.
cPanel's idea is to not just add lines at the beginning or the end of htaccess files but to edit rules that customer's have added to their .htaccess files. We do not want to take the risk of cPanel's automatic edits confusing customers who don't understand why their rules have changed, or maybe even breaking existing .htaccess files causing issues on websites.
We want an option to prevent autossl from editing .htaccess files. This option would be for advanced users so could be in the form of a touch file (something like '/usr/local/apache/autossl_disable_htaccess_edit'). If the file exists then autossl would skip editing .htaccess files.
I got some clarification on how the feature in the other request was added, and it looks like, if you're running Apache 2.4 and you enable the tweak setting added, then you do get this functionality, so I'm going to mark this request as complete (rather than Not Planned). As always, let me know if you have questions!
I got some clarification on how the feature in the other request was added, and it looks like, if you're running Apache 2.4 and you enable the tweak setting added, then you do get this functionality, so I'm going to mark this request as complete (rather than Not Planned). As always, let me know if you have questions!
One point of clarification here: we are *only* adjusting rules when DCV fails with a redirect error. Additionally, we are adding exceptions to .htaccess files that include redirects only.
For example, if we start here:
After the adjustments the .htaccess would look like this:
Currently we are forced to do this in order to allow us to support Apache 2.2 with AutoSSL. If you are using Apache 2.4 you can avoid this completely by adding code to a pre-virtualhost include to prevent your DCV checks from failing due to redirects.I also want to mention that editing .htaccess files is something cPanel & WHM have done for a very long time, for a multitude of reasons.
One point of clarification here: we are *only* adjusting rules when DCV fails with a redirect error. Additionally, we are adding exceptions to .htaccess files that include redirects only.
For example, if we start here:
After the adjustments the .htaccess would look like this:
Currently we are forced to do this in order to allow us to support Apache 2.2 with AutoSSL. If you are using Apache 2.4 you can avoid this completely by adding code to a pre-virtualhost include to prevent your DCV checks from failing due to redirects.I also want to mention that editing .htaccess files is something cPanel & WHM have done for a very long time, for a multitude of reasons.
For Apache 2.4, I don't think it's a previrtualhost include (noone at cPanel has been able to give us anything like this). What we use is a virtualhost include that occurs inside the virtualhost.
This same include can be adapted to work for Apache 2.2 if placed at the beginning of the .htacess file instead of in the virtualhost.
What I'm failing to find is the reason for adding rewrite cond's to all rules instead of adding 5 lines at the beginning of .htaccess files. This would be less likley to break everything and would be more obvious to users that there site hasn't been hacked.
For Apache 2.4, I don't think it's a previrtualhost include (noone at cPanel has been able to give us anything like this). What we use is a virtualhost include that occurs inside the virtualhost.
This same include can be adapted to work for Apache 2.2 if placed at the beginning of the .htacess file instead of in the virtualhost.
What I'm failing to find is the reason for adding rewrite cond's to all rules instead of adding 5 lines at the beginning of .htaccess files. This would be less likley to break everything and would be more obvious to users that there site hasn't been hacked.
How is cPanel considering millions of websites that the CMS controls the htaccess and more specifically, the sites are version controlled in GIT. With the htaccess on the server side being updated, where a server has only read perms from the repo, it creates issues for the git status and even if the solution is simply to download the new htaccess and send it through GIT from the dev side, that would be a significant job where you own/manage a large number of sites, controlled by GIT.
How is cPanel considering millions of websites that the CMS controls the htaccess and more specifically, the sites are version controlled in GIT. With the htaccess on the server side being updated, where a server has only read perms from the repo, it creates issues for the git status and even if the solution is simply to download the new htaccess and send it through GIT from the dev side, that would be a significant job where you own/manage a large number of sites, controlled by GIT.
One more thing that should be considered is that a lot of people use nginx as a reverse proxy in front of Apache. In those cases all redirects happens at the nginx level such as redirects from http to https and from www to non www. This is the right thing to do for performance reasons. However this also means that all those lines in the .htaccess from CPanel do nothing at all.
I guess once the certificate is issued for the first time and we have enabled all those redirects in nginx there will be no way to renew the certificate without removing the redirects from nginx. Are there any rules published anywhere that we should add at the nginx level?
Moreover Benny said above that if somebody uses Apache 2.4 a pre-virtualhost include is possible. What should be added at there for those who do use Apache 2.4?
One more thing that should be considered is that a lot of people use nginx as a reverse proxy in front of Apache. In those cases all redirects happens at the nginx level such as redirects from http to https and from www to non www. This is the right thing to do for performance reasons. However this also means that all those lines in the .htaccess from CPanel do nothing at all.
I guess once the certificate is issued for the first time and we have enabled all those redirects in nginx there will be no way to renew the certificate without removing the redirects from nginx. Are there any rules published anywhere that we should add at the nginx level?
Moreover Benny said above that if somebody uses Apache 2.4 a pre-virtualhost include is possible. What should be added at there for those who do use Apache 2.4?
Definitely need a solution for this - all mod_rewrite stuff in our git-managed .htaccess files is getting systematically mutilated.. :(
Definitely need a solution for this - all mod_rewrite stuff in our git-managed .htaccess files is getting systematically mutilated.. :(
We have been running for a bit now with our fix to disable rewite rules, in an apache include. This works for all sites that resolve and don't have any non rewrite based rules that deny access to the files but some customer's .htaccess files are still being modified.
Because of this will still need a way (a touch file, a tweak setting or something else…) to forbid cPanel from editing rewrite rules our customers .htaccess files.
Glad to see that we're not the only ones who need this.
We have been running for a bit now with our fix to disable rewite rules, in an apache include. This works for all sites that resolve and don't have any non rewrite based rules that deny access to the files but some customer's .htaccess files are still being modified.
Because of this will still need a way (a touch file, a tweak setting or something else…) to forbid cPanel from editing rewrite rules our customers .htaccess files.
Glad to see that we're not the only ones who need this.
Here are few situations in which we don't want autossl editing the .htaccess file :
If the .htaccess file contains a global Deny from all
If the .htaccess file contains <FilesMatch> for <Files>
cPanel editing customers .htaccess rules is causing confusion for customers, who contact our support with questions like : has my account been hacked ? why are you editing my rewrite rules ? how can we keep default wordpress rules etc.
In our oppinion this feature request should be treated as a bug report and not a feature request.
It's very urgent that cPanel stops doing this on our servers. We don't need it because we have a global include that does this. We don't want it because it creates confusion and customer support requests.
How complicated would it be to add either a touch file or a tweak setting to prevent this from happening ?
Here are few situations in which we don't want autossl editing the .htaccess file :
If the .htaccess file contains a global Deny from all
If the .htaccess file contains <FilesMatch> for <Files>
cPanel editing customers .htaccess rules is causing confusion for customers, who contact our support with questions like : has my account been hacked ? why are you editing my rewrite rules ? how can we keep default wordpress rules etc.
In our oppinion this feature request should be treated as a bug report and not a feature request.
It's very urgent that cPanel stops doing this on our servers. We don't need it because we have a global include that does this. We don't want it because it creates confusion and customer support requests.
How complicated would it be to add either a touch file or a tweak setting to prevent this from happening ?
To clarify for everyone: any edits that are actually causing websites to break need to be reported to our support team, so that we can accomadate and account for them. The edits to the .htaccess files should *never* take a website offline, and if they are then it absolutely IS a bug.
To clarify for everyone: any edits that are actually causing websites to break need to be reported to our support team, so that we can accomadate and account for them. The edits to the .htaccess files should *never* take a website offline, and if they are then it absolutely IS a bug.
Maybe i'm missing something here but there is no need to edit .htaccess files at all:
We've added the following in the pre_main_2.conf in apache 2.4:
it seems to do the job. (we also block anything else that start with a dot).
Maybe i'm missing something here but there is no need to edit .htaccess files at all:
We've added the following in the pre_main_2.conf in apache 2.4:
it seems to do the job. (we also block anything else that start with a dot).
Everybody understand that cPANEL should use httconfig includes and catch all calls for AUTOSSL directly there.
WITHOUT ANY NEEDS to create .txt files and update .htaccess of any customers.
THIS REALLY REALLY SIMPLE AND COMPLETLY TRANSPARENTS.
I have already open a ticket about this.
Everybody understand that cPANEL should use httconfig includes and catch all calls for AUTOSSL directly there.
WITHOUT ANY NEEDS to create .txt files and update .htaccess of any customers.
THIS REALLY REALLY SIMPLE AND COMPLETLY TRANSPARENTS.
I have already open a ticket about this.
Hey everyone. I talked to the Product Owner whose team worked on AutoSSL, and he's considering adding a feature to AutoSSL to help in these situations, but he is incredibly concerned about the correlating increase in support load.
His idea right now is to add an option to "Advanced Options" that would read something like "Prevent cPanel from automatically managing .htaccess files." and would come with a caveat. If the option were enabled, cPanel's support team would not be able to assist you with AutoSSL problems, and enabling that option would add a red banner on the AutoSSL page that we can't help you with AutoSSL unless you turn that off.
How do you folks feel about this? Would this be a good middle ground for you?
Hey everyone. I talked to the Product Owner whose team worked on AutoSSL, and he's considering adding a feature to AutoSSL to help in these situations, but he is incredibly concerned about the correlating increase in support load.
His idea right now is to add an option to "Advanced Options" that would read something like "Prevent cPanel from automatically managing .htaccess files." and would come with a caveat. If the option were enabled, cPanel's support team would not be able to assist you with AutoSSL problems, and enabling that option would add a red banner on the AutoSSL page that we can't help you with AutoSSL unless you turn that off.
How do you folks feel about this? Would this be a good middle ground for you?
We're OK with no autossl support when .htaccess is turned off so long as we can simply turn it back on if we do need support.
If we need support now for autossl, it won't be because of .htaccess issues. Please do this as soon as possible ! :)
We're OK with no autossl support when .htaccess is turned off so long as we can simply turn it back on if we do need support.
If we need support now for autossl, it won't be because of .htaccess issues. Please do this as soon as possible ! :)
Hey everyone, thanks for the feedback and sorry for my delay (I was out all last week). I'm going to pass it on to the team that would be doing the work on this, and will let you know what feedback I get from them. In the meantime, I'd like to ask you to take a look at another, related to request.
AutoSSL should adjust behavior based on Apache version.
If you think that might be a better solution, or at least one that would solve this problem for you, I'd like to ask you to remove your vote from this request, and add it to that one.
I'm going to close comments for now, but please know: even if I didn't approve your comment for discussion here I'm passing on the feedback to our development team. If you'd like to add anything further, feel free to send it my way!
Hey everyone, thanks for the feedback and sorry for my delay (I was out all last week). I'm going to pass it on to the team that would be doing the work on this, and will let you know what feedback I get from them. In the meantime, I'd like to ask you to take a look at another, related to request.
AutoSSL should adjust behavior based on Apache version.
If you think that might be a better solution, or at least one that would solve this problem for you, I'd like to ask you to remove your vote from this request, and add it to that one.
I'm going to close comments for now, but please know: even if I didn't approve your comment for discussion here I'm passing on the feedback to our development team. If you'd like to add anything further, feel free to send it my way!
This request was superseded by https://features.cpanel.net/topic/autossl-act-differently-based-on-apache-version. As such I'm going to mark this one as not-planned. If you have any questions, feel free to email me: benny@cpanel.net.
This request was superseded by https://features.cpanel.net/topic/autossl-act-differently-based-on-apache-version. As such I'm going to mark this one as not-planned. If you have any questions, feel free to email me: benny@cpanel.net.
I got some clarification on how the feature in the other request was added, and it looks like, if you're running Apache 2.4 and you enable the tweak setting added, then you do get this functionality, so I'm going to mark this request as complete (rather than Not Planned). As always, let me know if you have questions!
I got some clarification on how the feature in the other request was added, and it looks like, if you're running Apache 2.4 and you enable the tweak setting added, then you do get this functionality, so I'm going to mark this request as complete (rather than Not Planned). As always, let me know if you have questions!
Replies have been locked on this page!