All posts by Don Matteo

lebt in der Schweiz, ist System Engineer MCP bei A-Enterprise GmbH. Mitglied des UNBLOG Knowledge Network. Author und Blogger zu den Themen, Tutorials für Linux und Open Source.

How to Check Lets Encrypt Certificate Expiry Date

When using Let’s Encrypt certificates, which are provided via Certbot and the ACME protocol by the ACME client software, known as Certbot for Linux operating systems, it is intended to check expiry date that the certificates must be renewed every 90 days before they expire.

Many of us are familiar with the e-mail: Let’s Encrypt certificate expiration notice for domain.

Your certificate (or certificates) for the names listed below will expire in 20 days (on 31 Mar 23 08:33 +0000). Please make sure to renew your certificate before then, or visitors to your web site will encounter errors.

We recommend renewing certificates automatically when they have a third of their total lifetime left. For Let’s Encrypt’s current 90-day certificates, that means renewing 30 days before expiration. See https://letsencrypt.org/docs/integration-guide/ for details.

myhost.example.tld

So let’s see the options, using commands in examples, to get the expiry date of Let’s Encrypt certificates to renew them by certbot in time for our myhost server before they expire and become invalid.

Check Certificates Expiry Date

To view a list of the certificates Certbot knows about, run the certificates subcommand in the terminal shell:

$ sudo certbot certificates

This returns details similar as follows, along with the Expiry Date:

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: myhost.domain.org
    Domains: myhost.domain.org
    Expiry Date: 2023-03-26 08:39:39+00:00 (VALID: 14 days)
    Certificate Path: /etc/letsencryp/live/myhost.example.tld/fullchain.pem
    Private Key Path: /etc/letsencryp/live/myhost.example.tld/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Let’s see how the expiry date of any certificate can be queried, so not just only Let’s Encrypt certificates.

$ sudo openssl x509 -dates -noout < /etc/letsencrypt/live/myhost.example.tld/cert.pem

This command, running in a Linux terminal, displays the expiration date of each certificate, according to the ITU-T standard specifications for X.509 digital certificates.

Renew Let’s Encrypt Certificates use Certbot

The Let’s Encrypt certificates can be renewed before they expire using this command.

$ sudo certbot renew

Next the Let’s Encrypt certificate is only renewed for the domain domain.org and it’s hostname myhost.example.tld, using the apache2 webserver.

$ sudo certbot --apache -d example.tld -d myhost.example.tld

The Let’s Encrypt certificate should only be renewed for the hostname myhost.example.tld.

e.g. using various services such as an SMTP mail transport agent that uses starttls.

$ sudo certbot --standalone certonly -d myhost.example.tld

The mission is to create a more secure and privacy-respecting World-Wide Web by promoting the widespread adoption of HTTPS.

Let’s Encrypt certificates are valid for 90 days, during which renewal can take place at any time. This is handled by an automated process designed to overcome manual creatio. Validation, signing, installation, and renewal of certificates for secure websites.

The project claims its goal is to make encrypted connections to World Wide Web servers ubiquitous. By eliminating payment, web server configuration, validation email management and certificate renewal tasks. It is meant to significantly lower the complexity of setting up and maintaining TLS encryption.

Set MySQL root password to blank

How to set a blank MySQL root password

In some situations a blank mysql root password is useful, e.g. when providing tests, when multiple database schemes have to be imported, or simply when deploing sql databases are to be provided for tests.

mysql root password

In the terminal, first open MySQL with the root account.

$ sudo mysql

For some MySQL root password configurations, the following command may need to be execute with root password entry.

$ mysql -u root -p

If you need to set an empty password for the root user, this can be created with this command.

MariaDB> SET PASSWORD FOR 'root'@'localhost' = '';

If the password of an existing user is to be set to blank, the following ALTER USER command can be used.

MariaDB> ALTER USER 'user'@'localhost' IDENTIFIED BY '';

The following command creates a new user and will set a blank password.

MariaDB> CREATE USER 'user'@'localhost' IDENTIFIED BY '';

Alternatively, mysqladmin can be used to empty the root password.

$ sudo mysqladmin -u root -pcurrent_password password ''

Note. MySQL can also be managed easily and clearly in the phpMyAdmin graphical web interface.

Conclusion

In this post I show how to set a blank mysql root password can be useful in situations such as when deploying tests when multiple database schemes need to be imported, or simply when sql databases are to be deployed for testing in non-production environments where it should go for simplification without major hurdles.