"one vhost per file"


#1

I am attempting to install already existing certs in to my Apache installation but it keeps errorring out with “one vhost per file” messages. But, I can’t for the life of me find where the second vhost is though.
Command:
./certbot-auto -vvv --apache -d victory2016.gop -d www.victory2016.gop -d vpn.victory2016.gop
httpd.conf:

> #
> # This is the main Apache HTTP server configuration file.  It contains the
> # configuration directives that give the server its instructions.
> # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
> # In particular, see 
> # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
> # for a discussion of each configuration directive.
> #
> # Do NOT simply read the instructions in here without understanding
> # what they do.  They're here only as hints or reminders.  If you are unsure
> # consult the online docs. You have been warned.  
> #
> # Configuration and logfile names: If the filenames you specify for many
> # of the server's control files begin with "/" (or "drive:/" for Win32), the
> # server will use that explicit path.  If the filenames do *not* begin
> # with "/", the value of ServerRoot is prepended -- so "logs/access_log"
> # with ServerRoot set to "/usr/local/apache2" will be interpreted by the
> # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" 
> # will be interpreted as '/logs/access_log'.
> #
> # ServerRoot: The top of the directory tree under which the server's
> # configuration, error, and log files are kept.
> #
> # Do not add a slash at the end of the directory path.  If you point
> # ServerRoot at a non-local disk, be sure to specify a local disk on the
> # Mutex directive, if file-based mutexes are used.  If you wish to share the
> # same ServerRoot for multiple httpd daemons, you will need to change at
> # least PidFile.
> #
> ServerRoot "/etc/httpd"
> #
> # Mutex: Allows you to set the mutex mechanism and mutex file directory
> # for individual mutexes, or change the global defaults
> #
> # Uncomment and change the directory if mutexes are file-based and the default
> # mutex file directory is not on a local disk or is not appropriate for some
> # other reason.
> #
> # Mutex default:/var/run
> #
> # Listen: Allows you to bind Apache to specific IP addresses and/or
> # ports, instead of the default. See also the <VirtualHost>
> # directive.
> #
> # Change this to Listen on specific IP addresses as shown below to 
> # prevent Apache from glomming onto all bound IP addresses.
> #
> #Listen 12.34.56.78:80
> #Listen 172.27.224.1:80
> Listen 104.207.154.16:443
> Listen 104.207.154.16:80
> #
> # Dynamic Shared Object (DSO) Support
> #
> # To be able to use the functionality of a module which was built as a DSO you
> # have to place corresponding `LoadModule' lines at this location so the
> # directives contained in it are actually available _before_ they are used.
> # Statically compiled modules (those listed by `httpd -l') do not need
> # to be loaded here.
> #
> # Example:
> # LoadModule foo_module modules/mod_foo.so
> #
> LoadModule authn_file_module modules/mod_authn_file.so
> #LoadModule authn_dbm_module modules/mod_authn_dbm.so
> #LoadModule authn_anon_module modules/mod_authn_anon.so
> #LoadModule authn_dbd_module modules/mod_authn_dbd.so
> #LoadModule authn_socache_module modules/mod_authn_socache.so
> LoadModule authn_core_module modules/mod_authn_core.so
> LoadModule authz_host_module modules/mod_authz_host.so
> LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
> LoadModule authz_user_module modules/mod_authz_user.so
> #LoadModule authz_dbm_module modules/mod_authz_dbm.so
> #LoadModule authz_owner_module modules/mod_authz_owner.so
> #LoadModule authz_dbd_module modules/mod_authz_dbd.so
> LoadModule authz_core_module modules/mod_authz_core.so
> #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
> LoadModule access_compat_module modules/mod_access_compat.so
> LoadModule auth_basic_module modules/mod_auth_basic.so
> #LoadModule auth_form_module modules/mod_auth_form.so
> #LoadModule auth_digest_module modules/mod_auth_digest.so
> #LoadModule allowmethods_module modules/mod_allowmethods.so
> #LoadModule file_cache_module modules/mod_file_cache.so
> #LoadModule cache_module modules/mod_cache.so
> #LoadModule cache_disk_module modules/mod_cache_disk.so
> LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
> LoadModule socache_dbm_module modules/mod_socache_dbm.so
> LoadModule socache_memcache_module modules/mod_socache_memcache.so
> LoadModule socache_dc_module modules/mod_socache_dc.so
> #LoadModule watchdog_module modules/mod_watchdog.so
> #LoadModule dbd_module modules/mod_dbd.so
> #LoadModule bucketeer_module modules/mod_bucketeer.so
> #LoadModule dumpio_module modules/mod_dumpio.so
> #LoadModule echo_module modules/mod_echo.so
> #LoadModule case_filter_module modules/mod_case_filter.so
> #LoadModule case_filter_in_module modules/mod_case_filter_in.so
> #LoadModule buffer_module modules/mod_buffer.so
> #LoadModule data_module modules/mod_data.so
> #LoadModule ratelimit_module modules/mod_ratelimit.so
> LoadModule reqtimeout_module modules/mod_reqtimeout.so
> #LoadModule ext_filter_module modules/mod_ext_filter.so
> #LoadModule request_module modules/mod_request.so
> #LoadModule include_module modules/mod_include.so
> LoadModule filter_module modules/mod_filter.so
> #LoadModule reflector_module modules/mod_reflector.so
> #LoadModule substitute_module modules/mod_substitute.so
> #LoadModule sed_module modules/mod_sed.so
> #LoadModule charset_lite_module modules/mod_charset_lite.so
> #LoadModule deflate_module modules/mod_deflate.so
> #LoadModule xml2enc_module modules/mod_xml2enc.so
> #LoadModule proxy_html_module modules/mod_proxy_html.so
> LoadModule mime_module modules/mod_mime.so
> #LoadModule ldap_module modules/mod_ldap.so
> LoadModule log_config_module modules/mod_log_config.so
> #LoadModule log_debug_module modules/mod_log_debug.so
> #LoadModule log_forensic_module modules/mod_log_forensic.so
> #LoadModule logio_module modules/mod_logio.so
> LoadModule lua_module modules/mod_lua.so
> LoadModule env_module modules/mod_env.so
> #LoadModule mime_magic_module modules/mod_mime_magic.so
> #LoadModule expires_module modules/mod_expires.so
> LoadModule headers_module modules/mod_headers.so
> #LoadModule usertrack_module modules/mod_usertrack.so
> #LoadModule unique_id_module modules/mod_unique_id.so
> LoadModule setenvif_module modules/mod_setenvif.so
> LoadModule version_module modules/mod_version.so
> #LoadModule remoteip_module modules/mod_remoteip.so
> #LoadModule proxy_module modules/mod_proxy.so
> #LoadModule proxy_connect_module modules/mod_proxy_connect.so
> #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
> #LoadModule proxy_http_module modules/mod_proxy_http.so
> #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
> #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
> #LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
> #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
> #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
> #LoadModule proxy_express_module modules/mod_proxy_express.so
> #LoadModule session_module modules/mod_session.so
> #LoadModule session_cookie_module modules/mod_session_cookie.so
> #LoadModule session_crypto_module modules/mod_session_crypto.so
> #LoadModule session_dbd_module modules/mod_session_dbd.so
> #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
> #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
> #LoadModule ssl_module modules/mod_ssl.so
> #LoadModule dialup_module modules/mod_dialup.so
> #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
> #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
> #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
> #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
> LoadModule mpm_event_module modules/mod_mpm_event.so
> LoadModule unixd_module modules/mod_unixd.so
> #LoadModule heartbeat_module modules/mod_heartbeat.so
> #LoadModule heartmonitor_module modules/mod_heartmonitor.so
> #LoadModule dav_module modules/mod_dav.so
> LoadModule status_module modules/mod_status.so
> LoadModule autoindex_module modules/mod_autoindex.so
> #LoadModule asis_module modules/mod_asis.so
> #LoadModule info_module modules/mod_info.so
> #LoadModule suexec_module modules/mod_suexec.so
> #LoadModule cgid_module modules/mod_cgid.so
> #LoadModule dav_fs_module modules/mod_dav_fs.so
> #LoadModule dav_lock_module modules/mod_dav_lock.so
> #LoadModule vhost_alias_module modules/mod_vhost_alias.so
> #LoadModule negotiation_module modules/mod_negotiation.so
> LoadModule dir_module modules/mod_dir.so
> #LoadModule actions_module modules/mod_actions.so
> #LoadModule speling_module modules/mod_speling.so
> #LoadModule userdir_module modules/mod_userdir.so
> LoadModule alias_module modules/mod_alias.so
> LoadModule rewrite_module modules/mod_rewrite.so
> <IfModule unixd_module>
> #
> # If you wish httpd to run as a different user or group, you must run
> # httpd as root initially and it will switch.  
> #
> # User/Group: The name (or #number) of the user/group to run httpd as.
> # It is usually good practice to create a dedicated user and group for
> # running httpd, as with most system services.
> #
> User daemon
> Group daemon
> </IfModule>
> # 'Main' server configuration
> #
> # The directives in this section set up the values used by the 'main'
> # server, which responds to any requests that aren't handled by a
> # <VirtualHost> definition.  These values also provide defaults for
> # any <VirtualHost> containers you may define later in the file.
> #
> # All of these directives may appear inside <VirtualHost> containers,
> # in which case these default settings will be overridden for the
> # virtual host being defined.
> #
> #
> # ServerAdmin: Your address, where problems with the server should be
> # e-mailed.  This address appears on some server-generated pages, such
> # as error documents.  e.g. admin@your-domain.com
> #
> ServerAdmin you@example.com
> #
> # ServerName gives the name and port that the server uses to identify itself.
> # This can often be determined automatically, but we recommend you specify
> # it explicitly to prevent problems during startup.
> #
> # If your host doesn't have a registered DNS name, enter its IP address here.
> #
> ServerName victory2016.gop
> #
> # Deny access to the entirety of your server's filesystem. You must
> # explicitly permit access to web content directories in other 
> # <Directory> blocks below.
> #
> <Directory />
>     AllowOverride none
>     Require all denied
> </Directory>
> #
> # Note that from this point forward you must specifically allow
> # particular features to be enabled - so if something's not working as
> # you might expect, make sure that you have specifically enabled it
> # below.
> #
> #
> # DocumentRoot: The directory out of which you will serve your
> # documents. By default, all requests are taken from this directory, but
> # symbolic links and aliases may be used to point to other locations.
> #
> DocumentRoot "/var/www/html"
> <Directory "/var/www/html">
>     #
>     # Possible values for the Options directive are "None", "All",
>     # or any combination of:
>     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
>     #
>     # Note that "MultiViews" must be named *explicitly* --- "Options All"
>     # doesn't give it to you.
>     #
>     # The Options directive is both complicated and important.  Please see
>     # http://httpd.apache.org/docs/2.4/mod/core.html#options
>     # for more information.
>     #
>     Options Indexes FollowSymLinks
>     #
>     # AllowOverride controls what directives may be placed in .htaccess files.
>     # It can be "All", "None", or any combination of the keywords:
>     #   AllowOverride FileInfo AuthConfig Limit
>     #
>     AllowOverride None
>     #
>     # Controls who can get stuff from this server.
>     #
>     Require all granted
> </Directory>
> #
> # DirectoryIndex: sets the file that Apache will serve if a directory
> # is requested.
> #
> <IfModule dir_module>
>     DirectoryIndex index.html
> </IfModule>
> #
> # The following lines prevent .htaccess and .htpasswd files from being 
> # viewed by Web clients. 
> #
> <Files ".ht*">
>     Require all denied
> </Files>
> #
> # ErrorLog: The location of the error log file.
> # If you do not specify an ErrorLog directive within a <VirtualHost>
> # container, error messages relating to that virtual host will be
> # logged here.  If you *do* define an error logfile for a <VirtualHost>
> # container, that host's errors will be logged there and not here.
> #
> ErrorLog "/var/log/httpd/error_log"
> #
> # LogLevel: Control the number of messages logged to the error_log.
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> #
> LogLevel warn
> <IfModule log_config_module>
>     #
>     # The following directives define some format nicknames for use with
>     # a CustomLog directive (see below).
>     #
>     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
>     LogFormat "%h %l %u %t \"%r\" %>s %b" common
>     <IfModule logio_module>
>       # You need to enable mod_logio.c to use %I and %O
>       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
>     </IfModule>
>     #
>     # The location and format of the access logfile (Common Logfile Format).
>     # If you do not define any access logfiles within a <VirtualHost>
>     # container, they will be logged here.  Contrariwise, if you *do*
>     # define per-<VirtualHost> access logfiles, transactions will be
>     # logged therein and *not* in this file.
>     #
>     CustomLog "/var/log/httpd/access_log" common
>     #
>     # If you prefer a logfile with access, agent, and referer information
>     # (Combined Logfile Format) you can use the following directive.
>     #
>     #CustomLog "/var/log/httpd/access_log" combined
> </IfModule>
> <IfModule alias_module>
>     #
>     # Redirect: Allows you to tell clients about documents that used to 
>     # exist in your server's namespace, but do not anymore. The client 
>     # will make a new request for the document at its new location.
>     # Example:
>     # Redirect permanent /foo http://www.example.com/bar
>     #
>     # Alias: Maps web paths into filesystem paths and is used to
>     # access content that does not live under the DocumentRoot.
>     # Example:
>     # Alias /webpath /full/filesystem/path
>     #
>     # If you include a trailing / on /webpath then the server will
>     # require it to be present in the URL.  You will also likely
>     # need to provide a <Directory> section to allow access to
>     # the filesystem path.
>     #
>     # ScriptAlias: This controls which directories contain server scripts. 
>     # ScriptAliases are essentially the same as Aliases, except that
>     # documents in the target directory are treated as applications and
>     # run by the server when requested rather than as documents sent to the
>     # client.  The same rules about trailing "/" apply to ScriptAlias
>     # directives as to Alias.
>     #
>     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
> </IfModule>
> <IfModule cgid_module>
>     #
>     # ScriptSock: On threaded servers, designate the path to the UNIX
>     # socket used to communicate with the CGI daemon of mod_cgid.
>     #
>     #Scriptsock cgisock
> </IfModule>
> #
> # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
> # CGI directory exists, if you have that configured.
> #
> <Directory "/var/www/cgi-bin">
>     AllowOverride None
>     Options None
>     Require all granted
> </Directory>
> <IfModule mime_module>
>     #
>     # TypesConfig points to the file containing the list of mappings from
>     # filename extension to MIME-type.
>     #
>     TypesConfig /etc/httpd/conf/mime.types
>     #
>     # AddType allows you to add to or override the MIME configuration
>     # file specified in TypesConfig for specific file types.
>     #
>     #AddType application/x-gzip .tgz
>     #
>     # AddEncoding allows you to have certain browsers uncompress
>     # information on the fly. Note: Not all browsers support this.
>     #
>     #AddEncoding x-compress .Z
>     #AddEncoding x-gzip .gz .tgz
>     #
>     # If the AddEncoding directives above are commented-out, then you
>     # probably should define those extensions to indicate media types:
>     #
>     AddType application/x-compress .Z
>     AddType application/x-gzip .gz .tgz
>     #
>     # AddHandler allows you to map certain file extensions to "handlers":
>     # actions unrelated to filetype. These can be either built into the server
>     # or added with the Action directive (see below)
>     #
>     # To use CGI scripts outside of ScriptAliased directories:
>     # (You will also need to add "ExecCGI" to the "Options" directive.)
>     #
>     #AddHandler cgi-script .cgi
>     # For type maps (negotiated resources):
>     #AddHandler type-map var
>     #
>     # Filters allow you to process content before it is sent to the client.
>     #
>     # To parse .shtml files for server-side includes (SSI):
>     # (You will also need to add "Includes" to the "Options" directive.)
>     #
>     #AddType text/html .shtml
>     #AddOutputFilter INCLUDES .shtml
> </IfModule>
> #
> # The mod_mime_magic module allows the server to use various hints from the
> # contents of the file itself to determine its type.  The MIMEMagicFile
> # directive tells the module where the hint definitions are located.
> #
> #MIMEMagicFile /etc/httpd/conf/magic
> #
> # Customizable error responses come in three flavors:
> # 1) plain text 2) local redirects 3) external redirects
> #
> # Some examples:
> #ErrorDocument 500 "The server made a boo boo."
> #ErrorDocument 404 /missing.html
> #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
> #ErrorDocument 402 http://www.example.com/subscription_info.html
> #
> #
> # MaxRanges: Maximum number of Ranges in a request before
> # returning the entire resource, or one of the special
> # values 'default', 'none' or 'unlimited'.
> # Default setting is to accept 200 Ranges.
> #MaxRanges unlimited
> #
> # EnableMMAP and EnableSendfile: On systems that support it, 
> # memory-mapping or the sendfile syscall may be used to deliver
> # files.  This usually improves server performance, but must
> # be turned off when serving from networked-mounted 
> # filesystems or if support for these functions is otherwise
> # broken on your system.
> # Defaults: EnableMMAP On, EnableSendfile Off
> #
> #EnableMMAP off
> #EnableSendfile on
> # Supplemental configuration
> #
> # The configuration files in the /etc/httpd/conf/extra/ directory can be 
> # included to add extra features or to modify the default configuration of 
> # the server, or you may simply copy their contents here and change as 
> # necessary.
> # Server-pool management (MPM specific)
> #Include /etc/httpd/conf/extra/httpd-mpm.conf
> # Multi-language error messages
> #Include /etc/httpd/conf/extra/httpd-multilang-errordoc.conf
> # Fancy directory listings
> #Include /etc/httpd/conf/extra/httpd-autoindex.conf
> # Language settings
> #Include /etc/httpd/conf/extra/httpd-languages.conf
> # User home directories
> #Include /etc/httpd/conf/extra/httpd-userdir.conf
> # Real-time info on requests and configuration
> #Include /etc/httpd/conf/extra/httpd-info.conf
> # Virtual hosts
> #Include /etc/httpd/conf/extra/httpd-vhosts.conf
> # Local access to the Apache HTTP Server Manual
> #Include /etc/httpd/conf/extra/httpd-manual.conf
> # Distributed authoring and versioning (WebDAV)
> #Include /etc/httpd/conf/extra/httpd-dav.conf
> # Various default settings
> #Include /etc/httpd/conf/extra/httpd-default.conf
> # Configure mod_proxy_html to understand HTML4/XHTML1
> <IfModule proxy_html_module>
> Include /etc/httpd/conf/extra/proxy-html.conf
> </IfModule>
> # Secure (SSL/TLS) connections
> #Include /etc/httpd/conf/extra/httpd-ssl.conf
> #
> # Note: The following must must be present to support
> #       starting without SSL on platforms with no /dev/random equivalent
> #       but a statically compiled-in mod_ssl.
> #
> <IfModule ssl_module>
> SSLRandomSeed startup builtin
> SSLRandomSeed connect builtin
> </IfModule>
> #
> # uncomment out the below to deal with user agents that deliberately
> # violate open standards by misusing DNT (DNT *must* be a specific
> # end-user choice)
> #
> #<IfModule setenvif_module>
> #BrowserMatch "MSIE 10.0;" bad_DNT
> #</IfModule>
> #<IfModule headers_module>
> #RequestHeader unset DNT env=bad_DNT
> #</IfModule>
> <VirtualHost _default_:80>
>     ServerName victory2016.gop
> </VirtualHost>

Any help would be much appreciated.


#2

Did you check all files included by your config?

This might help:

grep -r "<VirtualHost" /etc/httpd/

If that doesn’t help, try running with -vvvv and provide the full output and log files from /var/log/letsencrypt.


#3

I just deleted every other non-httpd.conf file from /etc/httpd with no change.
The log file:
> 2016-05-28 22:16:28,188:DEBUG:certbot.main:Root logging level set at -10
> 2016-05-28 22:16:28,195:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
> 2016-05-28 22:16:28,202:DEBUG:certbot.main:certbot version: 0.7.0
> 2016-05-28 22:16:28,208:DEBUG:certbot.main:Arguments: [’-vvvv’, ‘–apache’, ‘-d’, ‘victory2016.gop’, ‘-d’, ‘www.victory2016.gop’, ‘-d’, ‘vpn.victory2016.gop’]
> 2016-05-28 22:16:28,215:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
> 2016-05-28 22:16:28,228:DEBUG:certbot.plugins.selection:Requested authenticator apache and installer apache
> 2016-05-28 22:16:28,402:DEBUG:certbot.plugins.selection:Single candidate plugin: * apache
> Description: Apache Web Server - Alpha
> Interfaces: IAuthenticator, IInstaller, IPlugin
> Entry point: apache = certbot_apache.configurator:ApacheConfigurator
> Initialized: <certbot_apache.configurator.ApacheConfigurator object at 0x7f2b05f52bd0>
> Prep: True
> 2016-05-28 22:16:28,410:DEBUG:certbot.plugins.selection:Selected authenticator <certbot_apache.configurator.ApacheConfigurator object at 0x7f2b05f52bd0> and installer <certbot_apache.configurator.ApacheConfigurator object at 0x7f2b05f52bd0>
> 2016-05-28 22:16:28,587:DEBUG:certbot.main:Picked account: <Account(062b9f94568b8ff167d92e6cc5ec6625)>
> 2016-05-28 22:16:28,597:DEBUG:root:Sending GET request to https://acme-v01.api.letsencrypt.org/directory. args: (), kwargs: {}
> 2016-05-28 22:16:28,611:INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
> 2016-05-28 22:16:28,702:DEBUG:requests.packages.urllib3.connectionpool:“GET /directory HTTP/1.1” 200 280
> 2016-05-28 22:16:28,716:DEBUG:root:Received <Response [200]>. Headers: {‘Content-Length’: ‘280’, ‘Expires’: ‘Sat, 28 May 2016 22:16:28 GMT’, ‘Strict-Transport-Security’: ‘max-age=604800’, ‘Server’: ‘nginx’, ‘Connection’: ‘keep-alive’, ‘Pragma’: ‘no-cache’, ‘Cache-Control’: ‘max-age=0, no-cache, no-store’, ‘Date’: ‘Sat, 28 May 2016 22:16:28 GMT’, ‘X-Frame-Options’: ‘DENY’, ‘Content-Type’: ‘application/json’, ‘Replay-Nonce’: ‘lDgSmUBeUnEI5KMnn_FzVRa2k3Q_XdI8jXT1cozavdg’}. Content: ‘{\n “new-authz”: “https://acme-v01.api.letsencrypt.org/acme/new-authz”,\n “new-cert”: “https://acme-v01.api.letsencrypt.org/acme/new-cert”,\n “new-reg”: “https://acme-v01.api.letsencrypt.org/acme/new-reg”,\n “revoke-cert”: “https://acme-v01.api.letsencrypt.org/acme/revoke-cert”\n}’
> 2016-05-28 22:16:28,727:DEBUG:acme.client:Received response <Response [200]> (headers: {‘Content-Length’: ‘280’, ‘Expires’: ‘Sat, 28 May 2016 22:16:28 GMT’, ‘Strict-Transport-Security’: ‘max-age=604800’, ‘Server’: ‘nginx’, ‘Connection’: ‘keep-alive’, ‘Pragma’: ‘no-cache’, ‘Cache-Control’: ‘max-age=0, no-cache, no-store’, ‘Date’: ‘Sat, 28 May 2016 22:16:28 GMT’, ‘X-Frame-Options’: ‘DENY’, ‘Content-Type’: ‘application/json’, ‘Replay-Nonce’: ‘lDgSmUBeUnEI5KMnn_FzVRa2k3Q_XdI8jXT1cozavdg’}): ‘{\n “new-authz”: “https://acme-v01.api.letsencrypt.org/acme/new-authz”,\n “new-cert”: “https://acme-v01.api.letsencrypt.org/acme/new-cert”,\n “new-reg”: “https://acme-v01.api.letsencrypt.org/acme/new-reg”,\n “revoke-cert”: “https://acme-v01.api.letsencrypt.org/acme/revoke-cert”\n}’
> 2016-05-28 22:16:28,756:INFO:certbot.renewal:Cert not yet due for renewal
> 2016-05-28 22:16:34,459:ERROR:certbot_apache.configurator:Error: should only be one vhost in /etc/httpd/conf/httpd.conf
> 2016-05-28 22:16:34,475:DEBUG:certbot.error_handler:Encountered exception:
> Traceback (most recent call last):
> File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/client.py”, line 369, in deploy_certificate
> fullchain_path=fullchain_path)
> File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 217, in deploy_cert
> vhost = self.choose_vhost(domain)
> File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 317, in choose_vhost
> return self._choose_vhost_from_list(target_name, temp)
> File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 335, in _choose_vhost_from_list
> vhost = self.make_vhost_ssl(vhost)
> File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 729, in make_vhost_ssl
> raise errors.PluginError("Currently, we only support "
> PluginError: Currently, we only support configurations with one vhost per file

>     2016-05-28 22:16:34,487:DEBUG:certbot.error_handler:Calling registered functions
>     2016-05-28 22:16:34,500:DEBUG:certbot.main:Exiting abnormally:
>     Traceback (most recent call last):
>       File "/root/.local/share/letsencrypt/bin/letsencrypt", line 11, in <module>
>         sys.exit(main())
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/main.py", line 693, in main
>         return config.func(config, plugins)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/main.py", line 464, in run
>         lineage.chain, lineage.fullchain)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/client.py", line 369, in deploy_certificate
>         fullchain_path=fullchain_path)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py", line 217, in deploy_cert
>         vhost = self.choose_vhost(domain)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py", line 317, in choose_vhost
>         return self._choose_vhost_from_list(target_name, temp)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py", line 335, in _choose_vhost_from_list
>         vhost = self.make_vhost_ssl(vhost)
>       File "/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py", line 729, in make_vhost_ssl
>         raise errors.PluginError("Currently, we only support "
>     PluginError: Currently, we only support configurations with one vhost per file

#4

tl;dr: Try moving the <VirtualHost> to a separate file in /etc/httpd/conf.d/ (they’re included automatically).

I did some additional testing and it looks like certbot doesn’t like the fact that the <VirtualHost> tag is inside of httpd.conf - it would rather have it in a dedicated <VirtualHost> file. I was able to reproduce this on CentOS. The <VirtualHost> count is done after the configurator copies the configuration, and I guess it’s really expecting something more like the Debian/Ubuntu apache configuration style, where <VirtualHost>s reside in a separate, dedicated directory. Not sure if this is intended or a bug. The documentation is a bit ambiguous on this point - the website indicates that the apache plugin is supported on CentOS, while the apache plugin documentation says it’s only supported on Debian-based distributions. We should probably clarify that and say that CentOS is supported, but the configuration needs to be closer to what Debian/Ubuntu does.


Error: should only be one vhost in /etc/apache2
Error: should only be one vhost with apache but only one vhost configured?
#5

I created victory2016.gop.conf at the above location and, despite the fact that Apache detects it, LE now produces the error “Unable to find cert and/or key directives”. I thought LE will add in the SSL-related info if it doesn’t exist.

httpd -S:

VirtualHost configuration:
*:80 is a NameVirtualHost
default server victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
port 80 namevhost victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
alias www.victory2016.gop
port 80 namevhost victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
alias www.victory2016.gop
ServerRoot: "/etc/httpd"
Main DocumentRoot: “/var/www/html"
Main ErrorLog: “/var/log/httpd/error_log"
Mutex default: dir=”/var/run/” mechanism=default
Mutex rewrite-map: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=“daemon” id=2
Group: name=“daemon” id=2

Log file:

2016-05-29 01:21:32,476:DEBUG:certbot.main:Root logging level set at -10
2016-05-29 01:21:32,484:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2016-05-29 01:21:32,492:DEBUG:certbot.main:certbot version: 0.7.0
2016-05-29 01:21:32,499:DEBUG:certbot.main:Arguments: [’-vvvv’, ‘–apache’, ‘-d’, ‘victory2016.gop’, ‘-d’, ‘www.victory2016.gop’, ‘-d’, ‘vpn.victory2016.gop’]
2016-05-29 01:21:32,507:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2016-05-29 01:21:32,523:DEBUG:certbot.plugins.selection:Requested authenticator apache and installer apache
2016-05-29 01:21:32,731:DEBUG:certbot.plugins.selection:Single candidate plugin: * apache
Description: Apache Web Server - Alpha
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: apache = certbot_apache.configurator:ApacheConfigurator
Initialized: <certbot_apache.configurator.ApacheConfigurator object at 0x7ff1b6d68b10>
Prep: True
2016-05-29 01:21:32,741:DEBUG:certbot.plugins.selection:Selected authenticator <certbot_apache.configurator.ApacheConfigurator object at 0x7ff1b6d68b10> and installer <certbot_apache.configurator.ApacheConfigurator object at 0x7ff1b6d68b10>
2016-05-29 01:21:32,917:DEBUG:certbot.main:Picked account: <Account(062b9f94568b8ff167d92e6cc5ec6625)>
2016-05-29 01:21:32,928:DEBUG:root:Sending GET request to https://acme-v01.api.letsencrypt.org/directory. args: (), kwargs: {}
2016-05-29 01:21:32,943:INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
2016-05-29 01:21:33,012:DEBUG:requests.packages.urllib3.connectionpool:“GET /directory HTTP/1.1” 200 280
2016-05-29 01:21:33,021:DEBUG:root:Received <Response [200]>. Headers: {‘Content-Length’: ‘280’, ‘Expires’: ‘Sun, 29 May 2016 01:21:33 GMT’, ‘Strict-Transport-Security’: ‘max-age=604800’, ‘Server’: ‘nginx’, ‘Connection’: ‘keep-alive’, ‘Pragma’: ‘no-cache’, ‘Cache-Control’: ‘max-age=0, no-cache, no-store’, ‘Date’: ‘Sun, 29 May 2016 01:21:33 GMT’, ‘X-Frame-Options’: ‘DENY’, ‘Content-Type’: ‘application/json’, ‘Replay-Nonce’: ‘tt0w4UrkECp9IsoAfc-D2lMbC2ssQS_Bd5UnAYE-JDw’}. Content: '{\n “new-authz”: “https://acme-v01.api.letsencrypt.org/acme/new-authz”,\n “new-cert”: “https://acme-v01.api.letsencrypt.org/acme/new-cert”,\n “new-reg”: “https://acme-v01.api.letsencrypt.org/acme/new-reg”,\n “revoke-cert”: “https://acme-v01.api.letsencrypt.org/acme/revoke-cert”\n}'
2016-05-29 01:21:33,029:DEBUG:acme.client:Received response <Response [200]> (headers: {‘Content-Length’: ‘280’, ‘Expires’: ‘Sun, 29 May 2016 01:21:33 GMT’, ‘Strict-Transport-Security’: ‘max-age=604800’, ‘Server’: ‘nginx’, ‘Connection’: ‘keep-alive’, ‘Pragma’: ‘no-cache’, ‘Cache-Control’: ‘max-age=0, no-cache, no-store’, ‘Date’: ‘Sun, 29 May 2016 01:21:33 GMT’, ‘X-Frame-Options’: ‘DENY’, ‘Content-Type’: ‘application/json’, ‘Replay-Nonce’: ‘tt0w4UrkECp9IsoAfc-D2lMbC2ssQS_Bd5UnAYE-JDw’}): '{\n “new-authz”: “https://acme-v01.api.letsencrypt.org/acme/new-authz”,\n “new-cert”: “https://acme-v01.api.letsencrypt.org/acme/new-cert”,\n “new-reg”: “https://acme-v01.api.letsencrypt.org/acme/new-reg”,\n “revoke-cert”: “https://acme-v01.api.letsencrypt.org/acme/revoke-cert”\n}'
2016-05-29 01:21:33,059:INFO:certbot.renewal:Cert not yet due for renewal
2016-05-29 01:21:34,081:DEBUG:certbot.reverter:Creating backup of /etc/httpd/conf.d/victory2016.gop-le-ssl.conf
2016-05-29 01:21:34,103:INFO:certbot_apache.configurator:Created an SSL vhost at /etc/httpd/conf.d/victory2016.gop-le-ssl.conf
2016-05-29 01:21:34,166:WARNING:certbot_apache.configurator:Cannot find a cert or key directive in /files/etc/httpd/conf.d/victory2016.gop-le-ssl.conf/IfModule/VirtualHost. VirtualHost was not modified
2016-05-29 01:21:34,176:DEBUG:certbot.error_handler:Encountered exception:
Traceback (most recent call last):
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/client.py”, line 369, in deploy_certificate
fullchain_path=fullchain_path)
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 241, in deploy_cert
"Unable to find cert and/or key directives")
PluginError: Unable to find cert and/or key directives

2016-05-29 01:21:34,188:DEBUG:certbot.error_handler:Calling registered functions
2016-05-29 01:21:34,202:DEBUG:certbot.main:Exiting abnormally:
Traceback (most recent call last):
File “/root/.local/share/letsencrypt/bin/letsencrypt”, line 11, in
sys.exit(main())
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/main.py”, line 693, in main
return config.func(config, plugins)
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/main.py”, line 464, in run
lineage.chain, lineage.fullchain)
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot/client.py”, line 369, in deploy_certificate
fullchain_path=fullchain_path)
File “/root/.local/share/letsencrypt/lib/python2.7/site-packages/certbot_apache/configurator.py”, line 241, in deploy_cert
"Unable to find cert and/or key directives")
PluginError: Unable to find cert and/or key directives

.conf file:

> <VirtualHost *:80>
>   ServerName victory2016.gop
>   ServerAlias www.victory2016.gop
>   ErrorLog /var/log/httpd/example.err
>   CustomLog /var/log/httpd/example.log combined
>   DocumentRoot /var/www/html2
>   <Directory "/var/www/html2">
>     Order allow,deny
>     Allow from all
>   </Directory>
> </VirtualHost>

#6

I’m not entirely sure what happened there. Does the file /etc/httpd/conf.d/victory2016.gop-le-ssl.conf exist? If it does, could you try deleting it and then running the client again?


#7

‘victory2016.gop.conf’ is the only file in that directory. LE seems to delete that other file after it crashes.


#8

Can you run grep -r "SSLCertificateFile" /etc/httpd/ to see if this directive is being set somewhere else?

The client should add that directive to /etc/httpd/conf.d/victory2016.gop-le-ssl.conf when it’s creating that file. There is some code that removes duplicate SSLCertificateFile directives, and I suspect that it somehow counts a SSLCertificateFile set somewhere else (possibly outside of a <VirtualHost> tag, which IIRC would make it global). So basically the client is creating a file with the correct directives, but then de-dupes them and later complains that they’re missing.

If you find something like that, removing all SSL-related directives (primarily SSLCertificateFile and SSLCertificateKeyFile) should do the trick.


#9

grep returns nothing and removing every other file that could be causing a problem produces the same error. What would happen if I removed the part of the code that it is failing at? Is there anyway to tell where it thinks the directive is before it deletes it? Also, is there anything wrong with Apache reporting the vhost twice in one of my previous tests?

grep:

[user@server ~]# grep -r “SSLCertificateFile” /etc/httpd/
[user@server ~]#


#10

That would actually be a good explanation for both the initial error and the overzealous de-duping. I created a similar config and httpd -S only lists my vhost once. Now the question is why the file is included twice. I suppose grep’ing for “Include” would be a good start.


#11

Could it be related to this https://bz.apache.org/bugzilla/show_bug.cgi?id=52532?

[user@server ~]# grep -r “Include” /etc/httpd/
/etc/httpd/conf/httpd.conf: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
/etc/httpd/conf/httpd.conf: # (You will also need to add “Includes” to the “Options” directive.)
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-mpm.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-multilang-errordoc.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-autoindex.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-languages.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-userdir.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-info.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-vhosts.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-manual.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-dav.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-default.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/proxy-html.conf
/etc/httpd/conf/httpd.conf:#Include /etc/httpd/conf/extra/httpd-ssl.conf
/etc/httpd/conf/httpd.conf:Include conf.d/*.conf
[user@server ~]# httpd -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
port 80 namevhost victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
alias www.victory2016.gop
port 80 namevhost victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
alias www.victory2016.gop
ServerRoot: "/etc/httpd"
Main DocumentRoot: “/var/www/html"
Main ErrorLog: “/var/log/httpd/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir=”/var/run/” mechanism=default
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=“daemon” id=2
Group: name=“daemon” id=2

Oddly enough, when I define the ip address on the vhost, Apache stops reports multiple vhosts yet LE still find the directives.

[user@server ~]# httpd -S
VirtualHost configuration:
104.207.154.16:80 victory2016.gop (/etc/httpd/conf.d/victory2016.gop.conf:1)
ServerRoot: "/etc/httpd"
Main DocumentRoot: “/var/www/html"
Main ErrorLog: “/var/log/httpd/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir=”/var/run/” mechanism=default
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=“daemon” id=2
Group: name=“daemon” id=2


#12

The ServerAlias doesn’t seem to be causing this (tested just now), so I think that bug is about the <VirtualHost www.example.com:80 www.example.org:80> tag itself. That wouldn’t apply here, since you’re simply using a wildcard.

The Include directives look fine as well. I’m pretty much out of ideas.

You could try following this guide (more or less) to the letter and see if that specific config structure somehow fixes the issue. I don’t see anything that’s different which could be causing this, but I could be missing something.


#13

I will probably just reinstall the server itself. Something is dangerously wrong with its Apache anyway as it refused to accept my SSL settings when I inserted them manually.
Thanks for your help anyway.


#14

perfect! that did it for me. I moved the vhost part in a separated file and all works great and easy now. thx