Resolving a certbot apache plugin syntax error

I got an email yesterday showing that one of my TLS certificates had failed to renew.

Looking in the log - /var/log/letsencrypt/letsencrypt.log - I saw:

2022-04-12 20:49:35,195:DEBUG:certbot_apache._internal.configurator:Apache version is 2.4.53
2022-04-12 20:49:35,844:DEBUG:certbot._internal.plugins.disco:Other error:(PluginEntryPoint#apache): There has been an error in parsing the file /etc/apache2/sites-enabled/decoded.legal-tor-ssh.conf on line 159: Syntax error

(Technically, for the eagle-eyed, this particular log entry was created when I attempted to re-run certbot just now.)

Weird, because apache is running fine.

I’d normally test for an apache config issue with apachectl configtest, and so I did, and it was clear. Which is consistent with apache running fine.

I took a look at the config file shown in the error message, and there was indeed an error: I had failed to close the opening tag, <IfModule mod_ssl.c>.

I closed the tag - </IfModule> - and re-ran certbot, and it was fine.