Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple subdomains with lets encrypt

I have an attractive message indicating me that it is unfortunately not possible to generate a certificate for multiple subdomains:

Wildcard domains are not supported: *.mynewsiteweb.com

On the other hand it would be possible to generate it one by one for each subdomain.

Is there a better solution? Thank you :)




Edit

Now Certbot supports the Wildcard since 0.22.0 version (2018-03-07)

Links

  • Automatic script: https://certbot.eff.org
  • Documentation: https://certbot.eff.org/docs

Thanks

  • Certbot ❤
  • Jahid
  • Ozzy Tashtepe
  • trojan
  • Jay Riley
like image 545
Breith Avatar asked Sep 04 '16 22:09

Breith


People also ask

Can I use LetsEncrypt for subdomains?

LetsEncrypt does not provide a script for auto-renewing certificates with wildcard subdomain. There's a script certbot-auto that can be setup in cron (if using Linux), that can auto-renew single domain SSL certificates. The same script can also be used to manually install and renew wildcard subdomains.

Can I use SSL certificate on multiple subdomains?

SSL.com's Wildcard Certificate lets you protect multiple subdomains with one easy solution! No need to install a separate certificate for each subdomain – a Wildcard Certificate can handle them all. Save money and simplify certificate management with a Wildcard Certificate from SSL.com!

Can I create multiple subdomains?

Each domain name can have up to 500 subdomains. You can also add multiple levels of subdomains, such as info.blog.yoursite.com. A subdomain can be up to 255 characters long, but if you have multiple levels in your subdomain, each level can only be 63 characters long.

Do you need a certificate for each subdomain?

To secure all subdomains of your domain, you will need to get a wildcard certificate.


2 Answers

Prior to support for wildcards I found it necessary to explicitly list each domain on a certificate in the form

… -d example.com -d www.example.com -d blog.example.com -d www.blog.example.com … 

(which due to complexities in the odd mix of redirected domains I'm using worked best with the --webroot authentication).

Thanks to Trojan's explanation and documentation here:

https://certbot.eff.org/docs/install.html?highlight=wildcard

I was able to generate wildcard certs that are live now. Unfortunately there is not a plugin for EasyDNS.com yet, so I had to perform manual validation (Where Trojans example saved the day). With this approach I was able to generate a certificate in the form

… -d *.example.com -d example.com -d *.blog.example.com … 

Since (for example's sake) blog.example.com was already covered by the *.example.com wildcard, I only had to add the wildcard for *.blog.example.com. In fact certbot would not allow redundancy (complained if I tried to include both *.example.com and www.example.com).

Currently available plug-ins are listed here:

https://certbot.eff.org/docs/using.html#dns-plugins

As of this writing they include these DNS providers:

  • certbot-dns-cloudflare
  • certbot-dns-cloudxns
  • certbot-dns-digitalocean
  • certbot-dns-dnsimple
  • certbot-dns-dnsmadeeasy
  • certbot-dns-google
  • certbot-dns-luadns
  • certbot-dns-nsone
  • certbot-dns-rfc2136
  • certbot-dns-route53

Perhaps I'll take a peek over the weekend and see how hard it is to write a plug-in for my own DNS provider.

like image 54
Jay Riley Avatar answered Sep 22 '22 04:09

Jay Riley


it is unfortunately not possible to generate a certificate for multiple subdomains

Not true. It is possible to generate a cert for multiple sub-domains. Just include those subdomains in the configuration file by their names:

domains = example.org, www.example.org, sub.example.org, www.sub.example.org

Then run certbot with the configuration file:

certbot-auto -c config.ini

You will have to verify ownership for each domain.

See more about configuration file.

like image 42
Jahid Avatar answered Sep 24 '22 04:09

Jahid