Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

Change Default SSL Certificate to Invalid Certificate

John McCarthy shared this idea 8 years ago
Completed

When you try and access a site that does not have SSL installed over HTTPS, it gives you the certificate from the first account with SSL enabled on the server.


This is an issue because a client's SSL certificate should only be used for their site. Any other use could be considered unethical. Additionally, it lets everyone know "Hey, this domain is being hosted on this server."


I think that if a domain does not have SSL enabled, then cPanel should serve a self-signed generic certificate. I contacted the cPanel support team, and they said there was no way to just not respond to an HTTPS request on a non-https enabled domain.

Replies (29)

photo
1

There is a viable work around which is to generate a free self signed certificate and install it to the shared IP. This is because users can only use the shared IP it if it's not already in use by another SSL cert.


We are conferring with our documentation department to get this work around added into our documentation as well.

photo
3

Hi


I don't think that works. I can see 2 users installed ssl certs on our shared Ip address ( server ip )

photo
2

Don't you have to copy the http default virtualhost and put it in the pre virtualhost include enabeling SSL on it ?


It should defenetly be done by default and we shouldn't have to do this…

photo
2

Your work around doesn't work. Multiple ssl cert can be installed on a shared IP. Please give us a solution soon.

photo
2

I should add that this could possibly be optional in the cPanel Tweak settings - perhaps for those that work hard to keep their httpd.conf as short as possible.


Additionally it would be ideal not to have this applied to any site on a dedicated IP - or to make applying it to dedicated IPs optional as well.

photo
2

Wow MikeDVB what a great idea, we do get this question from clients quite often. (Usually in a panic about their site being 'hacked'.

photo
1

cPanel has a default vhost for http but not for https. The solution support gave us was to create a https virtualhost in the include editor.


It's not just an issue with the wrong website showing but also with the wrong ssl showing.


I find it quite difficult to believe that cPanel didn't think of this when implementing sni support, I created a feature request for this some time ago but it didn't gain any traction, maybe this one will !

photo
3

This is much needed because we currently have to manually edit httpd.conf to make cPanel/Apache work the way it really should work automatically.

photo
1

I'm also aware of this issue, thanks for bringing it up Mike.

photo
1

It's so stupid to allowing SSL on shared IP!

Users can install self-signed SSL on IP and make a problems such as https://domain.com redirects to the site with SSL.

We ask, we require to dissable SSL on shared IP with one click.

photo
1

Hi,

the problem is for SNI, we need the chance to disable SNI or that "Is Primary Website on IP Address?" work.. cause now (with cloudlinux) if cusotmer installal SSL with SNI, the the resto of the sites with https go on site of last customer installed SSL with SNI...

photo
1

Just stumbled across this same problem today. Left me scratching my head as to what was "broken" with my config until I found this thread and it suddenly made the sense.


This sounds like a great solution to a (somewhat) vexing issue. Hope to see it in a future release!

photo
1

Hello! You may set your primary SSL VirtualHost either through WHM or via WHM API 1. The page in WHM where this is located is 'Manage SSL Hosts'. On that page there is a 'Make Primary' button that will make the selected domain name the primary VirtualHost for that IP & port combination in Apache.


There is also a WHM API 1 function to do the same thing via the API. Please see the following documentation for more information: http://documentation.cpanel.net/display/SDK/WHM+API+1+Functions+-+set_primary_servername


The functionality is also available in cPanel for users that are on a dedicated IP address if they have the Install SSL feature available to them. The options for setting the primary host is under SSL/TLS Manager >> Manage SSL sites.


Is that what you're looking for?


Thanks!

photo
1

Unless I'm mistaken but last time I did that it stopped users from accesssing https://webmail.theirdomain.tld and https://cpanel.theirdomain.tld if they didn't have a SSL cert configured.


I was told by cPanel support (a few years ago) that I had to choose between to providing shared SSL or having these URL's working.


Havn't tested since to see if it's repaired…

photo
1

This method suggested by cPanelJason appears to be working just fine, allowing you to select the certificate that you’d like to show up as being mismatched. It currently also works on servers that have proxy subdomains enabled.

photo
2

This really does need resolving.


Is there really not a way to resolve this completely with SNI, rather than the "always show the server cert" idea posted above?


Would making no domain "primary" for the IP and dealing with all SSL domains via SNI be a possible solution? I imagine the virtualhost for the proxy cpanel. whm. etc addresses would also then be relevant in some way?

photo
3

Our own experience is that we can temporarily patch the problem by moving the server's shared SSL certificate to be read first in the httpd.conf file, however this frequently breaks when a client installs a new self-signed certificate and it goes to the top of the httpd.conf to be read first.


It would definitely be a temporary solution if we could prevent clients from installing SSL on the server's shared SSL certificate, but the real fix here is for the cPanel developers to implement a fix so the server's shared SSL certificate takes priority and it must always be read first in the httpd.conf file before any other certificates on the server's main IP address. This will solve it for clients who want to install an SNI certificate and for normal clients who probably never use SSL and simply want their HTTPS website to display neutral content (i.e. not another client's website!)


I was told cPanel had a development case 163469 open for this but I've received an update that it has been closed "as essentially the Shared SSL Certificate function should have reached obsolescence as SNI became implemented across more servers". This is frustrating that no progress is being made and clients are complaining!

photo
1

This issue is very important and i dont understand why cpanel dont work to solve... The once solution is disbaled SSL from the faeture and enable just if cusotmer by dedicated IP, but then they cannot use/see the shared SSL of the server.


In the "Manage SSL Hosts" dont have sense set "Make primary domain", if custmerA install an SSL on the IP and all https://site-with-nossl show the ssl of the custmerA

photo
1

This is a very critical issue. I have a WHM setup with 26 websites and only one has SSL installed. I cannot access any of the 25 sites via https:// because it redirects to the one site that has SSL installed. Please fix the issue.

photo
3

I think it would probably be best just to have an option in WHM to enable SSL on all hosts by default (aka if no SSL is installed they still access said site but with a security warning).

photo
1

It can be solution as well:

##########

I think it would probably be best just to have an option in WHM to enable SSL on all hosts by default (aka if no SSL is installed they still access said site but with a security warning).


##########

photo
1

I got the same issue on my server. I didn't see this request, so i sent a ticket to cpanel thinking it was a bug.

photo
1

Plesk uses a self-signed certificate and then shows the client's website with it. I always liked this since the clients could access their WordPress install through SSL even though they didn't have a certificate. Not really fully secure, but at least encrypted.


Coming to cPanel we had to deal with this quirk. I have included some code here which we put into "Pre VirtualHost Include".

We actually have some more settings somewhere else since we run nginx as reverse proxy, but the below should give a starting point on a regular system. We run cpanel/whm/webmail on a different IP address than the regular sites, so I don't know if some additional rewrite conditions need to check that it doesn't catch the correct domain for the forwards...or if you need a separate IP.

We forward all webmail.... requests for example to https://webmail.makbiz.ca on which we run our SSL certificate.

I hope this helps as a starting point until cPanel fixes this.

In the first part we just add the path to our own SSL certificate.


<VirtualHost ###.###.###.###:443>

ServerName default.no.ssl

ServerAdmin ###@####.###

UseCanonicalName Off

SSLEngine on


SSLCertificateFile /var/cpanel/ssl/installed/certs/#####################.crt

SSLCertificateKeyFile /var/cpanel/ssl/installed/keys/#####################.key

SSLCACertificateFile /var/cpanel/ssl/installed/cabundles/#####################.cabundle


SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

</VirtualHost>


<VirtualHost ###.###.###.###:80 ###.###.###.###:80 ###.###.###.###:443 ###.###.###.###:443>

ServerName randomsubname.#####.##

ServerAlias cpanel.* whm.* webmail.*


ServerAdmin ###@####.###


RewriteEngine On


RewriteCond %{HTTP_HOST} ^webmail\.

RewriteRule (.*) https://webmail.####.### [R,L]


RewriteCond %{HTTP_HOST} ^cpanel\.

RewriteRule (.*) https://cpanel.####.### [R,L]


RewriteCond %{HTTP_HOST} ^whm\.

RewriteRule (.*) https://whm.####.### [R,L]


</VirtualHost>

photo
1

This need to be fixed. We had a lot of clients complaining about this issue, also resellers with dedicated IP that hosts their clients on that IP address.

photo
1

The temporary work around that we came up with was to create a custom theme for the customers that are on the shared IP so when they click on the SSL/TLS Manager in cPanel it takes them to a page that asks them to call us to get setup with a dedicated IP. This prevents accounts on the shared IP from installing SSL's.


We then tracked down all the accounts with SSL's on the shared IP and set them up on dedicated IP's. This left the servers SSL as the only one on the shared IP and redirected sites to our default page.


The only catch is to remember to change the theme when an account gets a dedicated IP for an SSL.


This is not intended to be a permanent fix, just a temporary one until cPanel can fix the SNI. I hope it helps others.

photo
1

For those interested, we added this to the pre vhost include section in cPanel :


  1. <VirtualHost MAIN_IP:443>
  2. ServerName newns10.monarobase.net
  3. DocumentRoot /usr/local/apache/htdocs
  4. ServerAdmin YOUR_COMPANY_MAIL
  5. SSLEngine on
  6. SSLCertificateFile /var/cpanel/ssl/cpanel/cpanel.pem
  7. SSLCertificateKeyFile /var/cpanel/ssl/cpanel/cpanel.pem
  8. SSLCACertificateFile /var/cpanel/ssl/cpanel/cpanel.pem
  9. SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
  10. </VirtualHost>

Just replace MAIN_IP and YOUR_COMPANY_MAIL by your details.

cPanel seem's to be looking into doing something more complex than this instead of just fixing this bug though.

photo
1

Hey folks! A fix for this specific problem isn't on our roadmap yet, but we are working on a plugin to satisfy this Let's Encrypt request. Once that plugin is public I'll be able to take a closer look at the ways it will or will not help, but I believe that it will act as an acceptable workaround for this request. I'll update everyone again once I have more information!

photo
2

We now just create a default virtual host for port 443, based on the port 80 one cPanel already creates and include it in the apache include editor in WHM. It completly solves the problem of showing another site's website.


I still don't see why cPanel does this for port 80 by default but refuses to also do it by default for port 443.

photo
2

I wouldn't say that "refuses" is fair. Other things have taken a higher priority, sure, but no one is refuting that it's a good idea. :)

photo
1

Well, this is such a basic thing that it should have been done years ago.

I think that not displaying a different website than the URL shows and people went to should have been implemented a long time ago. Certainly before Paper Lantern was introduced for example.

It's really more like a bug than a feature request that an unrelated website is shown - and I do like the idea at https://medium.com/quality-functions/the-zero-bug-policy-b0bd987be684#.q8pkynbzq for dealing with bugs vs feature requests.

photo
1

Calm down guys — you can already do this. Simply create a hosting account on the SNI IP using whatever domain or subdomain you wish to show up as the SSL default, install an SSL certificate on that domain, then under 'Manage SSL Hosts' in WHM, click the 'Make Primary' link next to that.

photo
1

Sorry for employing the term 'refuses', however the reason why I employed it is that cPanel's postion was, according to your support staff, that adding a default vhost was not a solution as this was a bug with Apache.


In my oppinion showing another customer's website should be concidered a high priority bug and not a feature request. Just imagine the problems this could cause if you where to host for example two competing brands, or two religious websites with different religions… It could see webhosts being taken to court for this.


What I'm saying here is that all you have to do to prevent the above issue is to edit the default template to include a port 443 vhost on the shared IP. That should take about 5 minutes, and it's not against any Apache documentation or rules to have a default vhost.


The default vhost for port 443 has currently two reasons to exist :


1) So sites that don't have a SSL vhost don't show another site

2) So when you access a domain that isn't created on the server but points to the server IP via https it doesn't how another website.


Should we maybe create another feature request to create a default vhost for port 443 for reason two as cPanel seems to be blocked on treating this as a bug with Apache ?

photo
1

Yeah this is not a feature request , it is a total mess up. Google blacklisted one of my clients from search because it was going to another penalized website on HTTPS. We fixed this years ago by setting a 404 on that clients HTTPS site. But apparently when you install new SSL on shared IPs they become the new default, we just have to make sure we set the right one as primary always.

photo
1

Surely cPanel should simply move the block (shown below from v58) within the /var/cpanel/templates/apache2_4/main.default to somewhere in front of the rest of the vhosts.


This problem has been around for like forever and it's a no brainer to fix - come on cPanel!


  1. [% ips_in_use.push("127.0.0.1") %]

photo
2

Hey all! While the Let's Encrypt plugin isn't yet public, and this specific problem has not yet been addressed, v58 now has a public feature called AutoSSL that will help with this problem specifically. After AutoSSL is enabled, cPanel & WHM will automatically attempt to issue certificates for the domains on your server. You can read more about AutoSSL in our release notes, and Documentation site. Let me know if you have any questions!

photo
1

Somehow I missed updating you all here, but this feature has been added as of version 62. From the release notes:

https://documentation.cpanel.net/display/ALD/62+Release+Notes


  1. Automatically install best available certificate for new addon domain, parked domain, or subdomain
  2. When you create an addon domain, parked domain, or subdomain, the system will attempt to automatically secure that domain with an existing certificate. If no certificate exists within the domain’s virtual host, but another certificate matches the domain, the system will secure the domain with that certificate.If no certificate matches the domain, the system will install a self-signed certificate for the domain.
  3. All websites receive an SSL certificate
  4. Any website created in cPanel & WHM now receives an SSL certificate. A self-signed certificate is added if no other SSL certificates are available.

As always, feel free to let me know if you have questions!

Replies have been locked on this page!