Skip to content

No vhost was selected #2776

Closed
Closed

Description

@hugo-connery

Firstly, I ran a successful certonly -d ... type run yesterday, and deployed that to https://sec.it.env.dtu.dk So, well done LetsEncrypt for that.

Today, with the release of 0.5.0 I wanted to re-try the --apache plugin, as it failed yesterday.

I'm running RHEL 7 with IPv6 as a virtual machine over a Windows HyperV installation (just to make stuff interesting ;).

$ uname -a
Linux vwww3.env.dtu.dk 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 19 2015 21:43:13
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
$ ./letsencrypt-auto --version
Checking for new version...
Requesting root privileges to run letsencrypt...
/root/.local/share/letsencrypt/bin/letsencrypt --version
letsencrypt 0.5.0

$ ./letsencrypt-auto --apache -d sec.it.env.dtu.dk
ncurses display .... No names were found in your configuration files.\nYou should specify ServerNames...

Config:
<VirtualHost 192.38.76.15:443 [2001:878:200:2000:0003::2]:443>
ServerAdmin webmaster@env.dtu.dk
DocumentRoot /var/www/html/sec.it.env.dtu.dk
ServerName sec.it.env.dtu.dk
ErrorLog logs/sec.it.env.dtu.dk-error_log
CustomLog logs/sec.it.env.dtu.dk-access_log common
DirectoryIndex index.html
#
# SSL Config
#
SSLEngine on
SSLHonorCipherOrder on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK"
SSLCertificateKeyFile /etc/letsencrypt/live/sec.it.env.dtu.dk/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/sec.it.env.dtu.dk/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/sec.it.env.dtu.dk/chain.pem
# HSTS
Header add Strict-Transport-Security "max-age=15768000"
<Directory /var/www/html/sec.it.env.dtu.dk>
AllowOverride none
Require all granted
Options +Indexes

As you can verify the site works, thus the config is fine. Apache 2.4.6 does not seem to need NameVirtualHost directives, and they are not in the config.

I dont have a problem as the cert isn't expiring soon, and the "certonly" method works fine and I can easily install them. But, it is funny that the client cant see this obvious virtual host. IPv6 ??

Thanks all for the LE efforts.

/Hugo

Activity

  1. pde commented on Apr 6, 2016

    @pde
    Member

    @joohoi want to take this?

  2. added this to the 0.6.0 milestone on Apr 6, 2016
  3. pde commented on Apr 6, 2016

    @pde
    Member

    @hugo-connery the fact that you have a ServerName directive should be enough for this config to work, so I think this is definitely a bug...

  4. joohoi commented on Apr 6, 2016

    @joohoi
    Member

    Yeah, I'll take this.

    @hugo-connery thanks for extensive information about the environment! However if you could send us the output of:

    python -c 'import platform;print([platform.system(),platform.linux_distribution()[0]])'

    to make sure we end up using the correct system layout and defaults for your distribution (want to verify that we are actually searching correct paths for the vhosts)

  5. hugo-connery commented on Apr 6, 2016

    @hugo-connery
    Author

    Hi,

    No problem. Will do. I appreciate the fast response.

    Long live LE.

    Hugo Connery

    Head of IT, DTU Environment, http://www.env.dtu.dk
    Reduce the risk of using IT by understanding it.


    From: Joona Hoikkala [notifications@github.com]
    Sent: Wednesday, 6 April 2016 19:46
    To: letsencrypt/letsencrypt
    Cc: Hugo Maxwell Connery
    Subject: Re: [letsencrypt/letsencrypt] No vhost was selected (#2776)

    Yeah, I'll take this. @hugo-conneryhttps://github.com/hugo-connery thanks for extensive information about the environment! However if you could send us the output of:

    python -c 'import platform;print([platform.system(),platform.linux_distribution()[0]])'

    to make sure we end up using the correct system layout and defaults for your distribution (want to verify that we are actually searching correct paths for the vhosts)

    �
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHubhttps://github.com//issues/2776#issuecomment-206484850

  6. hugo-connery commented on Apr 6, 2016

    @hugo-connery
    Author

    Hi,

    I'm not sure that this is going to help you much, but

    ['Linux', 'CentOS Linux']

    is the output of the command you wished me to run.

    I would think that this is a sub-set of the information
    I already supplied.

    Whatever.

    Hugo Connery

    Head of IT, DTU Environment, http://www.env.dtu.dk
    Reduce the risk of using IT by understanding it.


    From: Joona Hoikkala [notifications@github.com]
    Sent: Wednesday, 6 April 2016 19:46
    To: letsencrypt/letsencrypt
    Cc: Hugo Maxwell Connery
    Subject: Re: [letsencrypt/letsencrypt] No vhost was selected (#2776)

    Yeah, I'll take this. @hugo-conneryhttps://github.com/hugo-connery thanks for extensive information about the environment! However if you could send us the output of:

    python -c 'import platform;print([platform.system(),platform.linux_distribution()[0]])'

    to make sure we end up using the correct system layout and defaults for your distribution (want to verify that we are actually searching correct paths for the vhosts)

    �
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHubhttps://github.com//issues/2776#issuecomment-206484850

  7. joohoi commented on Apr 6, 2016

    @joohoi
    Member

    Yeah, it's just the actual calls we're using to get the distribution / os string, so wanted to make sure that it's detected correctly - just like it seems to be.

    I confirmed that your VirtualHost configuration parses fine, so it must be something related to configuration layout / distribution defaults.

    Does your virtualhost configuration file reside under /etc/httpd/conf.d and does the configuration file that holds the vhost have other vhosts in it?

  8. bmw commented on Apr 7, 2016

    @bmw
    Member

    Perhaps another instance of this?

  9. bret-miller commented on Apr 7, 2016

    @bret-miller

    In case it is, here is some information:
    Letsencrypt says:

    We were unable to find a vhost with a ServerName or Address of www.cbmission.org.
    Which virtual host would you like to choose?
    
    

    /etc/apache2/sites-available/cbmission.org.conf says at the top:

    <VirtualHost *:80>
            ServerName cbmission.org
            ServerAlias www.cbmission.org
    

    and later:

    </VirtualHost>
    <VirtualHost *:443>
            ServerName cbmission.org
            ServerAlias www.cbmission.org
    

    python -c 'import platform;print([platform.system(),platform.linux_distribution()[0]])' says:
    ['Linux', 'Ubuntu']
    Note that this configuration was working perfectly until I updated to client version 0.5.0 today. Now I have to manually edit the apache config files after letsencrypt issues the certificate.

    Let me know if there's other information that would be helpful.

  10. thorstensiefert commented on Apr 7, 2016

    @thorstensiefert

    Got the same issue with two vhosts which where perfectly configured before - and destroyed after the renewal process.

    Am 07.04.2016 um 21:45 schrieb Bret Miller notifications@github.com:

    In case it is, here is some information:
    Letsencrypt says:
    We were unable to find a vhost with a ServerName or Address of www.cbmission.org.
    Which virtual host would you like to choose?

    /etc/apache2/sites-available/cbmission.org.conf says at the top:

    ServerName cbmission.org
    ServerAlias www.cbmission.org

    and later:

    ServerName cbmission.org
    ServerAlias www.cbmission.org

    python -c 'import platform;print([platform.system(),platform.linux_distribution()[0]])' says:
    ['Linux', 'Ubuntu']

    Note that this configuration was working perfectly until I updated to client version 0.5.0 today. Now I have to manually edit the apache config files after letsencrypt issues the certificate.

    Let me know if there's other information that would be helpful.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly or view it on GitHub

  11. joohoi commented on Apr 9, 2016

    @joohoi
    Member

    @bret-miller & @thorstensiefert & @hugo-connery : could you post the contents of LE log file to a pastebin in case it has some more information on this. The file in question is /var/log/letsencrypt/letsencrypt.log

  12. bret-miller commented on Apr 11, 2016

    @bret-miller

    I did several domains on Friday. Here's the log from then:
    http://pastebin.com/tZtV9eks

  13. joohoi commented on Apr 11, 2016

    @joohoi
    Member

    @bret-miller The log file doesn't seem to have a reference to the failed run you reported earlier, or did the run(s) on the log also result into similarily broken config files? If not, could you check /var/log/letsencrypt/letsencrypt.log.1 letsencrypt.log.2 and so on, for the one that has the information on the run with domain www.cbmission.org

  14. 22 remaining items

  15. shaneonabike commented on Apr 14, 2016

    @shaneonabike

    Or better yet put that into the help documentation of the command-line tool

  16. thorstensiefert commented on Apr 14, 2016

    @thorstensiefert

    I'll give it a try.
    Thx

    Am 14.04.2016 um 16:47 schrieb Joona Hoikkala notifications@github.com:

    @hugo-connery @thorstensiefert If you are still having problems, (and it's not caused by having multiple vhosts in single file), could you provide some more information, for example the tarball of your apache config to enable me to look further into this matter?

    —
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHub

  17. hugo-connery commented on Apr 15, 2016

    @hugo-connery
    Author

    Hi,

    Much improvement. The cert was renewed and installed and configured.

    It complained about:

    Unable to add title

    IMPORTANT NOTES:

    • We were unable to set up enhancement redirect for your server,
      however, we successfully installed your certificate.
    • Congratulations! Your certificate and chain have been saved at
      /etc/letsencrypt/live/sec.it.env.dtu.dk/fullchain.pem. Your cert
      will expire on 2016-07-14. To obtain a new version of the
      certificate in the future, simply run Let's Encrypt again.

    And the certificate configuration lines do not use either
    chain.pem or fullchain.pem (which is not a problem, but I
    note these things).

    Cheers, Hugo

  18. thorstensiefert commented on Apr 16, 2016

    @thorstensiefert

    @joohoi I tried (#2776 (comment)) and it works fine for me.
    Thx!

  19. hugo-connery commented on Apr 16, 2016

    @hugo-connery
    Author

    Where to put the documentation?

    I suggest a page at letsencrypt.org which talks about the recommended structure for vhost definitions under /etc/httpd/conf.d/

    That page, which should show a minimal server config with two sites, can be linked to from the getting started page in the section where it discusses Apache.

    Secondly, it can be issued as an information message if someone uses letsencrypt-auto --apache.

    i.e "Please use our recommended configuration layout for virtual hosts for better results: https://letsencrypt.org/apache-vhost-config.html"

    or equivalent.

    Thanks to all who have contributed to the thread. I'm happy to have a working model which I can then use for all my other sites and servers :)

    /Hugo

  20. joohoi commented on Apr 16, 2016

    @joohoi
    Member

    @thorstensiefert awesome!

    @hugo-connery I think that the correct place would actually be a notification that the client emits when it stumbles across a vhost file with more than one VirtualHost definition. I'll create a new issue for that, because this issue is too long to quickly get a glimpse of what's going on.

    Another thing: that message "Unable to add title" is emitted by reverter, which handles config rollbacks, and it basically gets printed when the reverer is unable to add a checkpoint for a file. Might be worthwhile to investigate further, if on the next run it still gets displayed, but I wouldn't worry for it as of now.

  21. joohoi commented on Apr 16, 2016

    @joohoi
    Member

    Reason: User has multiple VirtualHost configurations per file. 0.5.0 enforces stricter rules on vhost configuration, so the client is unable to find correct VirtualHost configurations.

    Solution: Split VirtualHost configurations to one vhost per file.

    I think this issue is pretty much solved. @hugo-connery I think you can close this for now, and open a new one for the reverter error if you stumble upon it again, it's outside of the scope of this issue.

  22. hugo-connery commented on Apr 16, 2016

    @hugo-connery
    Author

    Yes. Issue is closed.

    Source of problem (multiple vhosts in a config file) identified and fixing this fixes the problem.

    /Hugo

  23. Gn13l commented on Apr 29, 2016

    @Gn13l

    I also had the same issue with the same resolution. My HTTP and HTTPS vhosts were defined in the same config file. Separating them solved the issue.

  24. timbru31 commented on Apr 29, 2016

    @timbru31

    I've experienced the same issue and was very sad to see that the support for multiple vhosts per config file was removed - and even worse no correct error message was displayed :(
    My config files were working fine for years and personally I prefer multiple vhosts per config.

  25. zertrin commented on May 1, 2016

    @zertrin

    Everything was working fine with multiple VHosts per config file provided that they weren't for the same port (i.e. VHost:80 and VHost:443 in the same config file was ok, whereas Vhost:443 + VHost:443 was not supported).

    And now this doesn't work anymore? Why?

    That's quite a PITA since I have a long list of conf files for each subdomain which combines the VHost 80 and the VHost 443 and now I have to split all of them in two...

    I know that multiple HTTPS VHosts per file was never supported, but one HTTPS VHost + the HTTP one did work fine before. And now it's not supported anymore apparently? To me that looks like a regression...

  26. zertrin commented on May 1, 2016

    @zertrin

    In case it may be useful to someone else, I've used a small bash script to help me split my numerous config files:

    #!/bin/bash
    set -e
    
    NAME=$1
    
    #csplit -f $NAME.conf $NAME.conf '/^<VirtualHost \*:443>$/'
    csplit -f $NAME.conf $NAME.conf '/^<IfModule mod_ssl\.c>$/'
    mv $NAME.conf00 $NAME-80.conf
    mv $NAME.conf01 $NAME-443.conf
    a2dissite $NAME.conf
    a2ensite $NAME-80.conf
    a2ensite $NAME-443.conf

    It uses the csplit program (in the coreutils package in Debian jessie for example) to find a pattern where the file is to be split.

    Depending on your config files, the pattern can be /^<VirtualHost \*:443>$/ or /^<IfModule mod_ssl\.c>$/ or something else. (adapt the csplit line in the script accordingly)

    The convention assumed here is that:

    • the original filename of the config is mysite.conf
    • you call the script above as follow ./split_vhosts.sh mysite
    • the resulting files are called mysite-80.conf and mysite-443.conf (assuming the first VHost in the original config file was for port 80 and the second for port 443)
    • It calls a2dissite mysite.conf to deactivate the original conf file
    • it calls a2ensite for each of the split files.

    Now it's still your job to check that the resulting files are correct and to reload apache. The original config files are not deleted, you may want to do it manually once you've made sure everything works.

  27. pde commented on May 12, 2016

    @pde
    Member

    The fix for this shipped today. Please open a new ticket if you're seeing this problem in Certbot 0.6.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions