Generating LE Cert for apache default site

I have a VPS which hosts a single site. This site has auto HTTPS forwarding and the site is set up as a VHOST with its own sites-enabled config.

My site works fine.

I've recently seen in the logs a lot of random sites accessing the files on my server as if they had came from my domain. Turns out there's a few sites that have my VPS IP as their A record, and despite the security warning issued to these sites when accessed about impersonation etc, the are still being accessed. It appears to be all bot traffic.

MY apache server has 3 sites-enabled. 2 for the domain I'm using and one for the default config (000). I think that because of the auto forward to HTTPS all these requests are being routed to the SSL config.

I want to create a 000 SSL config to stop these requests being processed further, but running certbot docent allow me to generate an SSL for the default config.

Any ideas?

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: 406oc.co.uk

I ran this command: sudo certbot

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: 406oc.co.uk
2: www.406oc.co.uk
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): c

My web server is (include version): Server version: Apache/2.4.41 (Ubuntu)
Server built: 2023-03-08T17:32:54

The operating system my web server runs on is (include version):
Linux loki 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 2.8.0

You probably can get a certificate for those names, but you shouldn't. Are you sure people are pointing A records to your IP? I can send whatever Host header to whatever IP address.

You can definitely set your Apache not to redirect fqdns you do not recognise.

Just add a 000 virtualhost, on port 80 and 443 (no redirect) with a self signed cert. You can answer with http 403.

You can also just reject these requests, but not with Apache or nginx, you need some kind of waf.

3 Likes

Hello @nickweb,

Using the online tool Let's Debug yields these results:

https://letsdebug.net/www.406oc.co.uk/1754292

CloudflareCDN
WARNING
The domain www.406oc.co.uk is being served through Cloudflare CDN. Any Let's Encrypt certificate installed on the origin server will only encrypt traffic between the server and Cloudflare. It is strongly recommended that the SSL option 'Full SSL (strict)' be enabled.
https://support.cloudflare.com/hc/en-us/articles/200170416-What-do-the-SSL-options-mean-

https://letsdebug.net/406oc.co.uk/1754293

CloudflareCDN
WARNING
The domain 406oc.co.uk is being served through Cloudflare CDN. Any Let's Encrypt certificate installed on the origin server will only encrypt traffic between the server and Cloudflare. It is strongly recommended that the SSL option 'Full SSL (strict)' be enabled.
https://support.cloudflare.com/hc/en-us/articles/200170416-What-do-the-SSL-options-mean-
1 Like

nginx can easily be set up to reject invalid/unknown Hosts with a default server block that 'return 444's to close the connection. Maybe Apache has something similar?

IMO that covers most sites where the point is to turn away bots reasonably early without giving them satisfaction saving every last CPU cycle (for which you'd involve your 'real' OS firewall instead).

3 Likes

Yes, I used to do that. It's not stealthy enough that I'd call it "reject"

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.