Criando certificados LetsEncrypt Wildcard com o Certbot
O que é um certificado wildcard?
Em resumo é um certificado coringa que vai funcionar com qualquer entrada em primeiro nível.
Por exemplo, se eu criar um certificado wildcard como o abaixo
*.gutocarvalho.net
Qualquer domínio em primeiro nível vai conseguir utilizar os certificados, exemplos:
gitlab.gutocarvalho.net jitsi.gutocarvalho.net mattermost.gutocarvalho.net nextcloud.gutocarvalho
Agora veja, wildcard só funciona em primeiro nível, se voce tentar usar em níveis abaixo, em segundo nível como o exemplo abaixo...
app.dev.gutocarvalho.net
... não vai dar bom, neste caso você precisaria criar um certificado wildcard para *.dev.gutocarvalho.net.
É isso, chega de teoria, vamos colocar a mão na massa. ;)
Ambiente
- ProxMox 6.1
- CentOS 7
- Certbot 1.3.0
PreReqs
- Crie um entrada *.seudominio.com.br em seu provedor de DNS
- Essa entrada deve apontar para seu balanceador ou reverse proxy.
Preparando a coisa
yum install -y epel-release
Instalando o certbot
yum install -y certbot python2-certbot-dns-cloudflare-1.3.0-2.el7.noarch
Gerando o cerfificado wildcard
Vamos rodar o comando
certbot —server https://acme-v02.api.letsencrypt.org/directory -d gutocarvalho.net,*.gutocarvalho.net —manual —preferred-challenges dns-01 certonly
Veja que eu passo gutocarvalho.net,*.gutocarvalho.net no parâmetro -d, isso é essencial, não esqueça de colocar o domínio principal junto ao wildcard.
Agora vamos ver a saída esperada.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for gutocarvalho.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.gutocarvalho.net with the following value:
glkhjdljlJKDlkdjksdhlkshjd-_ctdL5ve8Vn2Nnd0
OK, aqui precisamos ir no nosso provedor de DNS e criar a entrada abaixo
_acme-challenge.
com o seguinte conteúdo
glkhjdljlJKDlkdjksdhlkshjd-_ctdL5ve8Vn2Nnd0
Beleza, depois mandar um ENTER e continue
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/gutocarvalho.net-0001/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/gutocarvalho.net-0001/privkey.pem
Your cert will expire on 2020-07-17. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
O certificados foram gerados em /etc/letsencrypt/live/gutocarvalho.net
[root@lb conf.d]# ls /etc/letsencrypt/live/gutocarvalho.net/ -1
cert.pem
chain.pem
fullchain.pem
privkey.pem
README
Certificados gerados, agora você pode usar em seu NGINX, Apache HTTPd ou qualquer outro serviço que deseje utilizar SSL.
Enjoy!
[s] Guto
Se você precisa de ajuda para começar a utilizar certificados LetsEncrypt, fale com a JAC, nosso braço de projetos e consultoria!A JAC oferece um atendimento diferenciado e profissionais bem antenados, pode confiar :)[contato@jac.bsb.br]https://jac.bsb.br
Gostou do conteúdo?
Você também me encontra nessas redes!
Mastodon
PixelFed
Lemmy
WriteFreely
@gutocarvalho@bolha.blog @notamental@bolha.blog @poesias@bolha.blog @contos@bolha.blog
Bookwyrm
Peertube
Friendica
Quer saber mais sobre mim?
Visite meus sites!
E meus blogs:
- https://blogs.gutocarvalho.net
- https://blogs.gutocarvalho.net/falagutera
- https://blogs.gutocarvalho.net/infra
- https://blogs.gutocarvalho.net/opiniao
- https://blogs.gutocarvalho.net/contos
- https://blogs.gutocarvalho.net/poesias
- https://blogs.gutocarvalho.net/lives
- https://blogs.gutocarvalho.net/orixas
- https://blogs.gutocarvalho.net/archives
Conhece o Coletivo Bolha?
Então vem conhecer o bolha.io ou bolhaverso!
- fediverso
- mastodon, https://bolha.us
- pixelfed, https://bolha.photos
- lemmy, https://bolha.forum
- bookwyrnm, https://bolha.review
- writefreely, https://bolha.blog
- peertube, https://bolha.tube
- castopod, https://bolha.studio
- owncast, https://bolha.stream
- friendica, https://bolha.network
- chat
- mattermost, https://mattermost.bolha.chat
- zulip, https://zulip.bolha.chat
- vídeo
- jitsi, https://bolha.video
- jitsi, https://bolha.video
- frontends
- lingva, https://translate.bolha.tools
- libremdb, https://libremdb.bolha.tools
- translations
- libretranslate, https://libretranslate.bolha.tools
- editors
- hedgedoc, https://notes.bolha.tools
- draw.io, https://draw.bolha.tools
- excalidraw, https://excalidraw.bolha.tools
- pdf stirling, https://spdf.bolha.tools
- wisemaping, https://mindmap.bolha.tools
- mermaid, https://mermaid.bolha.tools
- cryptpad, https://cryptad.bolha.tools
- secrets sharing
- yopass, https://yopass.bolha.tools
- password pusher, https://pusher.bolha.tools
- pastbin
- yabin, https://yabin.bolha.tools
- terminal recorder
- ascinnema, https://ascinemma.bolha.tools
- anti paywall
- 13ft, https://open.bolha.tools
Nós temos muito mais para compartilhar contigo!
Quer apoiar nosso trabalho? Você pode!
- https://www.patreon.com/bolha
- https://apoia.se/bolha
- pix@bolha.us
Te vejo no mastodon da bolha.us!
[s]