Web

Create and export a Let’s Encrypt Wildcard SSL certificate in a PFX format

In this short guide we have create a free Let's Encrypt wildcard certificate.

Before you Begin

We'll need a fresh installation of Ubuntu or Debian linux. The box doesn't need to b e publicly accessible as we will use DNS verification in the creation process.

Install Certbot and generate the certificate

We install the certbot package on the linux machine, then request the wildcard certificate, with DNS verification that require us to create a public TXT record in the domain's zone file. The process guides us through each step

# Install the Let’s Encrypt agent
apt install certbot python-certbot-apache

# Generate the certificate
certbot certonly --manual --preferred-challenges dns -d *.alwayshotcafe.com

root@wildcard:~# certbot certonly --manual --preferred-challenges dns -d *.alwayshotcafe.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): zsolt@opentechtips.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for alwayshotcafe.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.alwayshotcafe.com with the following value:

kquoylyaMHZWxcu6JwT_BiJSmG_yrxr3-qgzNXQr0MA

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

As requested, we add the TXT record to our public DNS file

Note: we need to wait a few minutes before we proceed to allow time for DNS propagation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.alwayshotcafe.com with the following value:

kquoylyaMHZWxcu6JwT_BiJSmG_yrxr3-qgzNXQr0MA

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/alwayshotcafe.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/alwayshotcafe.com/privkey.pem
Your cert will expire on 2020-08-03. 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"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- 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

root@wildcard:~#

Check the certificate files

Here we have our new wildcard certificate. We can use it on this server straight, or export it in a PFX format to be imported on a separate box as needed.

# Export PFX into /tmp/wildcard.pfx
openssl pkcs12 -export -out /tmp/wildcard.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem

Full guide of PFX export here

Zsolt Agoston

Hi, I'm Zsolt, a 34 yo MCSA, MCSE, Cisco CCNA, CCNP, Redhat RHCSA and Offensive Security OSCP certified datacenter engineer from Europe.

Recent Posts

  • Exchange

How to Set Primary SMTP in Exchange Online – M365

Use the Set-Mailbox cmdlet with the -WindowsEmailAddress parameter to set the primary SMTP address in…

May 19, 2022
  • SSL

Display Contents of SSL Certificate from PEM File

A one-liner to display all contents of a SSL public key file.

May 16, 2022
  • SSL

Convert OPENSSH key to RSA type

Use ssh-keygen to convert an OPENSSH key to RSA format

May 13, 2022
  • Linux

Vim – Change Color Scheme for Easy Readability

Set the 'desert' color scheme for Vim. easier on the eyes on dark backgrounds.

April 22, 2022
  • Linux

SSH Private key Authentication to Linux on a Windows Machine

Learn how to use private certificate files to automatically authenticate to SSH servers. No password…

April 20, 2022
  • Linux

How to Configure Static IP on Debian 10

Configure a static IP address on a Debian 10 server using the command line.

April 15, 2022

This website uses cookies.