I’m on Ubuntu 16.04, using the cerbot packages. To generate the certificates, I used:
$ sudo letsencrypt certonly -d mydomain.ca -d www.mydomain.ca -d mail.mydomain.ca
It asks me to select my vhost file from a list (but why? It doesn’t seem to matter which I choose). I select template.inc
which has some templated code. Everything then proceeds successfully. To test the renewal, I force:
$ sudo letsencrypt renew --force-renewal
The error message I get when trying to renew:
2016-07-28 17:37:39,182:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal/mydomain.ca.conf produced an unexpected error: Failed to run Apache plugin non-interactively
Missing command line flag or config entry for this setting:
We were unable to find a vhost with a ServerName or Address of www.mydomain.com.
Which virtual host would you like to choose?
Choices: ['001-otherdomain.conf | otherdomain | | Enabled', '000-anotherdomain.conf | anotherdomain | | Enabled', 'template.inc | Multiple Names | HTTPS | ']
(The best solution is to add ServerName or ServerAlias entries to the VirtualHost directives of your apache configuration files.). Skipping.
I don’t have the original log files, but the process is repeatable. Unfortunately this site won’t let me upload anything because I’m a “new user”. Trying again for a single domain, the stack traces are
2016-07-29 06:47:00,535:INFO:letsencrypt.auth_handler:Performing the following challenges:
2016-07-29 06:47:00,535:INFO:letsencrypt.auth_handler:tls-sni-01 challenge for www.mydomain.ca
2016-07-29 06:47:00,763:DEBUG:letsencrypt.error_handler:Encountered exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/letsencrypt/auth_handler.py", line 115, in _solve_challenges
dv_resp = self.dv_auth.perform(self.dv_c)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 1549, in perform
sni_response = chall_doer.perform()
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 78, in perform
addrs = self._mod_config()
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 100, in _mod_config
achall_addrs = self._get_addrs(achall)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 119, in _get_addrs
vhost = self.configurator.choose_vhost(achall.domain, temp=True)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 314, in choose_vhost
return self._choose_vhost_from_list(target_name, temp)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 318, in _choose_vhost_from_list
vhost = display_ops.select_vhost(target_name, self.vhosts)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/display_ops.py", line 29, in select_vhost
code, tag = _vhost_menu(domain, vhosts)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/display_ops.py", line 93, in _vhost_menu
raise errors.MissingCommandlineFlag(msg)
MissingCommandlineFlag: Failed to run Apache plugin non-interactively
Missing command line flag or config entry for this setting:
We were unable to find a vhost with a ServerName or Address of www.mydomain.ca.
Which virtual host would you like to choose?
Choices: ['001-mycomputer.conf | mycomputer | | Enabled', '000-localhost.conf | localhost | | Enabled', 'template.inc | Multiple Names | HTTPS | ']
(The best solution is to add ServerName or ServerAlias entries to the VirtualHost directives of your apache configuration files.)
2016-07-29 06:47:00,763:DEBUG:letsencrypt.error_handler:Calling registered functions
2016-07-29 06:47:00,764:INFO:letsencrypt.auth_handler:Cleaning up challenges
2016-07-29 06:47:00,973:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal/www.mydomain.ca.conf produced an unexpected error: Failed to run Apache plugin non-interactively
Missing command line flag or config entry for this setting:
We were unable to find a vhost with a ServerName or Address of www.mydomain.ca.
Which virtual host would you like to choose?
Choices: ['001-mycomputer.conf | mycomputer | | Enabled', '000-localhost.conf | localhost | | Enabled', 'template.inc | Multiple Names | HTTPS | ']
(The best solution is to add ServerName or ServerAlias entries to the VirtualHost directives of your apache configuration files.). Skipping.
2016-07-29 06:47:00,973:DEBUG:letsencrypt.cli:Traceback was:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 1017, in renew
obtain_cert(lineage_config, plugins, renewal_candidate)
File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 706, in obtain_cert
_, action = _auth_from_domains(le_client, config, domains, lineage)
File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 457, in _auth_from_domains
new_certr, new_chain, new_key, _ = le_client.obtain_certificate(domains)
File "/usr/lib/python2.7/dist-packages/letsencrypt/client.py", line 252, in obtain_certificate
return self.obtain_certificate_from_csr(domains, csr) + (key, csr)
File "/usr/lib/python2.7/dist-packages/letsencrypt/client.py", line 225, in obtain_certificate_from_csr
authzr = self.auth_handler.get_authorizations(domains)
File "/usr/lib/python2.7/dist-packages/letsencrypt/auth_handler.py", line 80, in get_authorizations
cont_resp, dv_resp = self._solve_challenges()
File "/usr/lib/python2.7/dist-packages/letsencrypt/auth_handler.py", line 115, in _solve_challenges
dv_resp = self.dv_auth.perform(self.dv_c)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 1549, in perform
sni_response = chall_doer.perform()
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 78, in perform
addrs = self._mod_config()
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 100, in _mod_config
achall_addrs = self._get_addrs(achall)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/tls_sni_01.py", line 119, in _get_addrs
vhost = self.configurator.choose_vhost(achall.domain, temp=True)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 314, in choose_vhost
return self._choose_vhost_from_list(target_name, temp)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py", line 318, in _choose_vhost_from_list
vhost = display_ops.select_vhost(target_name, self.vhosts)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/display_ops.py", line 29, in select_vhost
code, tag = _vhost_menu(domain, vhosts)
File "/usr/lib/python2.7/dist-packages/letsencrypt_apache/display_ops.py", line 93, in _vhost_menu
raise errors.MissingCommandlineFlag(msg)
MissingCommandlineFlag: Failed to run Apache plugin non-interactively
Missing command line flag or config entry for this setting:
We were unable to find a vhost with a ServerName or Address of www.mydomain.ca.
Which virtual host would you like to choose?
Choices: ['001-mycomputer.conf | mycomputer | | Enabled', '000-localhost.conf | localhost | | Enabled', 'template.inc | Multiple Names | HTTPS | ']
(The best solution is to add ServerName or ServerAlias entries to the VirtualHost directives of your apache configuration files.)
2016-07-29 06:47:00,974:DEBUG:letsencrypt.cli:Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/letsencrypt", line 9, in <module>
load_entry_point('letsencrypt==0.4.1', 'console_scripts', 'letsencrypt')()
File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 1986, in main
return config.func(config, plugins)
File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 1034, in renew
len(renew_failures), len(parse_failures)))
Error: 1 renew failure(s), 0 parse failure(s)
If you want the full content, I can send that too.
Yes, I’m only talking about the renew
command here. For the original certificate generation, it’s a bit of an inconvenience to have to select an arbitrary vhost, but otherwise it works. This is something we only have to deal with once. For the renewal, however, the command just fails and exits, unless I enable my “dummy” catch-all vhost above.