We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cannot find Apache control command apache2ctl on Arch Linux
I have this problem when using certbot for apache following this guide http://letsencrypt.readthedocs.io/en/latest/using.html#apache

```
$ sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Failed to find apache2ctl in expanded PATH: /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/sbin
The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError('Cannot find Apache control command apache2ctl',)
```
I am on Arch Linux, and it seems that there is no apache2ctl for Arch but certbot requires it?

I tried to installed it but no luck:

```
$ sudo pacman -S apache2
error: target not found: apache2
```

My Apache's version:

```
$ httpd -v
Server version: Apache/2.4.25 (Unix)
Server built:   Dec 20 2016 13:02:2
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `certbot-apache/certbot_apache/constants.py`
Content:
```
1 """Apache plugin constants."""
2 import pkg_resources
3 from certbot import util
4 
5 CLI_DEFAULTS_DEFAULT = dict(
6     server_root="/etc/apache2",
7     vhost_root="/etc/apache2/sites-available",
8     vhost_files="*",
9     logs_root="/var/log/apache2",
10     version_cmd=['apache2ctl', '-v'],
11     define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],
12     restart_cmd=['apache2ctl', 'graceful'],
13     conftest_cmd=['apache2ctl', 'configtest'],
14     enmod=None,
15     dismod=None,
16     le_vhost_ext="-le-ssl.conf",
17     handle_mods=False,
18     handle_sites=False,
19     challenge_location="/etc/apache2",
20     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
21         "certbot_apache", "options-ssl-apache.conf")
22 )
23 CLI_DEFAULTS_DEBIAN = dict(
24     server_root="/etc/apache2",
25     vhost_root="/etc/apache2/sites-available",
26     vhost_files="*",
27     logs_root="/var/log/apache2",
28     version_cmd=['apache2ctl', '-v'],
29     define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],
30     restart_cmd=['apache2ctl', 'graceful'],
31     conftest_cmd=['apache2ctl', 'configtest'],
32     enmod="a2enmod",
33     dismod="a2dismod",
34     le_vhost_ext="-le-ssl.conf",
35     handle_mods=True,
36     handle_sites=True,
37     challenge_location="/etc/apache2",
38     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
39         "certbot_apache", "options-ssl-apache.conf")
40 )
41 CLI_DEFAULTS_CENTOS = dict(
42     server_root="/etc/httpd",
43     vhost_root="/etc/httpd/conf.d",
44     vhost_files="*.conf",
45     logs_root="/var/log/httpd",
46     version_cmd=['apachectl', '-v'],
47     define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],
48     restart_cmd=['apachectl', 'graceful'],
49     conftest_cmd=['apachectl', 'configtest'],
50     enmod=None,
51     dismod=None,
52     le_vhost_ext="-le-ssl.conf",
53     handle_mods=False,
54     handle_sites=False,
55     challenge_location="/etc/httpd/conf.d",
56     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
57         "certbot_apache", "centos-options-ssl-apache.conf")
58 )
59 CLI_DEFAULTS_GENTOO = dict(
60     server_root="/etc/apache2",
61     vhost_root="/etc/apache2/vhosts.d",
62     vhost_files="*.conf",
63     logs_root="/var/log/apache2",
64     version_cmd=['/usr/sbin/apache2', '-v'],
65     define_cmd=['apache2ctl', 'virtualhosts'],
66     restart_cmd=['apache2ctl', 'graceful'],
67     conftest_cmd=['apache2ctl', 'configtest'],
68     enmod=None,
69     dismod=None,
70     le_vhost_ext="-le-ssl.conf",
71     handle_mods=False,
72     handle_sites=False,
73     challenge_location="/etc/apache2/vhosts.d",
74     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
75         "certbot_apache", "options-ssl-apache.conf")
76 )
77 CLI_DEFAULTS_DARWIN = dict(
78     server_root="/etc/apache2",
79     vhost_root="/etc/apache2/other",
80     vhost_files="*.conf",
81     logs_root="/var/log/apache2",
82     version_cmd=['/usr/sbin/httpd', '-v'],
83     define_cmd=['/usr/sbin/httpd', '-t', '-D', 'DUMP_RUN_CFG'],
84     restart_cmd=['apachectl', 'graceful'],
85     conftest_cmd=['apachectl', 'configtest'],
86     enmod=None,
87     dismod=None,
88     le_vhost_ext="-le-ssl.conf",
89     handle_mods=False,
90     handle_sites=False,
91     challenge_location="/etc/apache2/other",
92     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
93         "certbot_apache", "options-ssl-apache.conf")
94 )
95 CLI_DEFAULTS_SUSE = dict(
96     server_root="/etc/apache2",
97     vhost_root="/etc/apache2/vhosts.d",
98     vhost_files="*.conf",
99     logs_root="/var/log/apache2",
100     version_cmd=['apache2ctl', '-v'],
101     define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],
102     restart_cmd=['apache2ctl', 'graceful'],
103     conftest_cmd=['apache2ctl', 'configtest'],
104     enmod="a2enmod",
105     dismod="a2dismod",
106     le_vhost_ext="-le-ssl.conf",
107     handle_mods=False,
108     handle_sites=False,
109     challenge_location="/etc/apache2/vhosts.d",
110     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
111         "certbot_apache", "options-ssl-apache.conf")
112 )
113 CLI_DEFAULTS = {
114     "default": CLI_DEFAULTS_DEFAULT,
115     "debian": CLI_DEFAULTS_DEBIAN,
116     "ubuntu": CLI_DEFAULTS_DEBIAN,
117     "centos": CLI_DEFAULTS_CENTOS,
118     "centos linux": CLI_DEFAULTS_CENTOS,
119     "fedora": CLI_DEFAULTS_CENTOS,
120     "red hat enterprise linux server": CLI_DEFAULTS_CENTOS,
121     "rhel": CLI_DEFAULTS_CENTOS,
122     "amazon": CLI_DEFAULTS_CENTOS,
123     "gentoo": CLI_DEFAULTS_GENTOO,
124     "gentoo base system": CLI_DEFAULTS_GENTOO,
125     "darwin": CLI_DEFAULTS_DARWIN,
126     "opensuse": CLI_DEFAULTS_SUSE,
127     "suse": CLI_DEFAULTS_SUSE,
128 }
129 """CLI defaults."""
130 
131 MOD_SSL_CONF_DEST = "options-ssl-apache.conf"
132 """Name of the mod_ssl config file as saved in `IConfig.config_dir`."""
133 
134 AUGEAS_LENS_DIR = pkg_resources.resource_filename(
135     "certbot_apache", "augeas_lens")
136 """Path to the Augeas lens directory"""
137 
138 REWRITE_HTTPS_ARGS = [
139     "^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[L,NE,R=permanent]"]
140 """Apache version<2.3.9 rewrite rule arguments used for redirections to
141 https vhost"""
142 
143 REWRITE_HTTPS_ARGS_WITH_END = [
144     "^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[END,NE,R=permanent]"]
145 """Apache version >= 2.3.9 rewrite rule arguments used for redirections to
146     https vhost"""
147 
148 OLD_REWRITE_HTTPS_ARGS = [
149     ["^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[L,QSA,R=permanent]"],
150     ["^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[END,QSA,R=permanent]"]]
151 
152 HSTS_ARGS = ["always", "set", "Strict-Transport-Security",
153              "\"max-age=31536000\""]
154 """Apache header arguments for HSTS"""
155 
156 UIR_ARGS = ["always", "set", "Content-Security-Policy",
157             "upgrade-insecure-requests"]
158 
159 HEADER_ARGS = {"Strict-Transport-Security": HSTS_ARGS,
160                "Upgrade-Insecure-Requests": UIR_ARGS}
161 
162 
163 def os_constant(key):
164     """
165     Get a constant value for operating system
166 
167     :param key: name of cli constant
168     :return: value of constant for active os
169     """
170 
171     os_info = util.get_os_info()
172     try:
173         constants = CLI_DEFAULTS[os_info[0].lower()]
174     except KeyError:
175         constants = os_like_constants()
176         if not constants:
177             constants = CLI_DEFAULTS["default"]
178     return constants[key]
179 
180 
181 def os_like_constants():
182     """
183     Try to get constants for distribution with
184     similar layout and configuration, indicated by
185     /etc/os-release variable "LIKE"
186 
187     :returns: Constants dictionary
188     :rtype: `dict`
189     """
190 
191     os_like = util.get_systemd_os_like()
192     if os_like:
193         for os_name in os_like:
194             if os_name in CLI_DEFAULTS.keys():
195                 return CLI_DEFAULTS[os_name]
196     return {}
197
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/certbot-apache/certbot_apache/constants.py b/certbot-apache/certbot_apache/constants.py
--- a/certbot-apache/certbot_apache/constants.py
+++ b/certbot-apache/certbot_apache/constants.py
@@ -110,6 +110,24 @@
     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
         "certbot_apache", "options-ssl-apache.conf")
 )
+CLI_DEFAULTS_ARCH = dict(
+    server_root="/etc/httpd",
+    vhost_root="/etc/httpd/conf",
+    vhost_files="*.conf",
+    logs_root="/var/log/httpd",
+    version_cmd=['apachectl', '-v'],
+    define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],
+    restart_cmd=['apachectl', 'graceful'],
+    conftest_cmd=['apachectl', 'configtest'],
+    enmod=None,
+    dismod=None,
+    le_vhost_ext="-le-ssl.conf",
+    handle_mods=False,
+    handle_sites=False,
+    challenge_location="/etc/httpd/conf",
+    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(
+        "certbot_apache", "options-ssl-apache.conf")
+)
 CLI_DEFAULTS = {
     "default": CLI_DEFAULTS_DEFAULT,
     "debian": CLI_DEFAULTS_DEBIAN,
@@ -125,6 +143,7 @@
     "darwin": CLI_DEFAULTS_DARWIN,
     "opensuse": CLI_DEFAULTS_SUSE,
     "suse": CLI_DEFAULTS_SUSE,
+    "arch": CLI_DEFAULTS_ARCH,
 }
 """CLI defaults."""

{"golden_diff": "diff --git a/certbot-apache/certbot_apache/constants.py b/certbot-apache/certbot_apache/constants.py\n--- a/certbot-apache/certbot_apache/constants.py\n+++ b/certbot-apache/certbot_apache/constants.py\n@@ -110,6 +110,24 @@\n     MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n         \"certbot_apache\", \"options-ssl-apache.conf\")\n )\n+CLI_DEFAULTS_ARCH = dict(\n+    server_root=\"/etc/httpd\",\n+    vhost_root=\"/etc/httpd/conf\",\n+    vhost_files=\"*.conf\",\n+    logs_root=\"/var/log/httpd\",\n+    version_cmd=['apachectl', '-v'],\n+    define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],\n+    restart_cmd=['apachectl', 'graceful'],\n+    conftest_cmd=['apachectl', 'configtest'],\n+    enmod=None,\n+    dismod=None,\n+    le_vhost_ext=\"-le-ssl.conf\",\n+    handle_mods=False,\n+    handle_sites=False,\n+    challenge_location=\"/etc/httpd/conf\",\n+    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n+        \"certbot_apache\", \"options-ssl-apache.conf\")\n+)\n CLI_DEFAULTS = {\n     \"default\": CLI_DEFAULTS_DEFAULT,\n     \"debian\": CLI_DEFAULTS_DEBIAN,\n@@ -125,6 +143,7 @@\n     \"darwin\": CLI_DEFAULTS_DARWIN,\n     \"opensuse\": CLI_DEFAULTS_SUSE,\n     \"suse\": CLI_DEFAULTS_SUSE,\n+    \"arch\": CLI_DEFAULTS_ARCH,\n }\n \"\"\"CLI defaults.\"\"\"\n", "issue": "Cannot find Apache control command apache2ctl on Arch Linux\nI have this problem when using certbot for apache following this guide http://letsencrypt.readthedocs.io/en/latest/using.html#apache\r\n\r\n```\r\n$ sudo certbot --apache\r\nSaving debug log to /var/log/letsencrypt/letsencrypt.log\r\nFailed to find apache2ctl in expanded PATH: /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/sbin\r\nThe apache plugin is not working; there may be problems with your existing configuration.\r\nThe error was: NoInstallationError('Cannot find Apache control command apache2ctl',)\r\n```\r\nI am on Arch Linux, and it seems that there is no apache2ctl for Arch but certbot requires it?\r\n\r\nI tried to installed it but no luck:\r\n\r\n```\r\n$ sudo pacman -S apache2\r\nerror: target not found: apache2\r\n```\r\n\r\nMy Apache's version:\r\n\r\n```\r\n$ httpd -v\r\nServer version: Apache/2.4.25 (Unix)\r\nServer built:   Dec 20 2016 13:02:2\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Apache plugin constants.\"\"\"\nimport pkg_resources\nfrom certbot import util\n\nCLI_DEFAULTS_DEFAULT = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/sites-available\",\n    vhost_files=\"*\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_DEBIAN = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/sites-available\",\n    vhost_files=\"*\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=\"a2enmod\",\n    dismod=\"a2dismod\",\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=True,\n    handle_sites=True,\n    challenge_location=\"/etc/apache2\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_CENTOS = dict(\n    server_root=\"/etc/httpd\",\n    vhost_root=\"/etc/httpd/conf.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/httpd\",\n    version_cmd=['apachectl', '-v'],\n    define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apachectl', 'graceful'],\n    conftest_cmd=['apachectl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/httpd/conf.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"centos-options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_GENTOO = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/vhosts.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['/usr/sbin/apache2', '-v'],\n    define_cmd=['apache2ctl', 'virtualhosts'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/vhosts.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_DARWIN = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/other\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['/usr/sbin/httpd', '-v'],\n    define_cmd=['/usr/sbin/httpd', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apachectl', 'graceful'],\n    conftest_cmd=['apachectl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/other\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_SUSE = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/vhosts.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=\"a2enmod\",\n    dismod=\"a2dismod\",\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/vhosts.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS = {\n    \"default\": CLI_DEFAULTS_DEFAULT,\n    \"debian\": CLI_DEFAULTS_DEBIAN,\n    \"ubuntu\": CLI_DEFAULTS_DEBIAN,\n    \"centos\": CLI_DEFAULTS_CENTOS,\n    \"centos linux\": CLI_DEFAULTS_CENTOS,\n    \"fedora\": CLI_DEFAULTS_CENTOS,\n    \"red hat enterprise linux server\": CLI_DEFAULTS_CENTOS,\n    \"rhel\": CLI_DEFAULTS_CENTOS,\n    \"amazon\": CLI_DEFAULTS_CENTOS,\n    \"gentoo\": CLI_DEFAULTS_GENTOO,\n    \"gentoo base system\": CLI_DEFAULTS_GENTOO,\n    \"darwin\": CLI_DEFAULTS_DARWIN,\n    \"opensuse\": CLI_DEFAULTS_SUSE,\n    \"suse\": CLI_DEFAULTS_SUSE,\n}\n\"\"\"CLI defaults.\"\"\"\n\nMOD_SSL_CONF_DEST = \"options-ssl-apache.conf\"\n\"\"\"Name of the mod_ssl config file as saved in `IConfig.config_dir`.\"\"\"\n\nAUGEAS_LENS_DIR = pkg_resources.resource_filename(\n    \"certbot_apache\", \"augeas_lens\")\n\"\"\"Path to the Augeas lens directory\"\"\"\n\nREWRITE_HTTPS_ARGS = [\n    \"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[L,NE,R=permanent]\"]\n\"\"\"Apache version<2.3.9 rewrite rule arguments used for redirections to\nhttps vhost\"\"\"\n\nREWRITE_HTTPS_ARGS_WITH_END = [\n    \"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[END,NE,R=permanent]\"]\n\"\"\"Apache version >= 2.3.9 rewrite rule arguments used for redirections to\n    https vhost\"\"\"\n\nOLD_REWRITE_HTTPS_ARGS = [\n    [\"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[L,QSA,R=permanent]\"],\n    [\"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[END,QSA,R=permanent]\"]]\n\nHSTS_ARGS = [\"always\", \"set\", \"Strict-Transport-Security\",\n             \"\\\"max-age=31536000\\\"\"]\n\"\"\"Apache header arguments for HSTS\"\"\"\n\nUIR_ARGS = [\"always\", \"set\", \"Content-Security-Policy\",\n            \"upgrade-insecure-requests\"]\n\nHEADER_ARGS = {\"Strict-Transport-Security\": HSTS_ARGS,\n               \"Upgrade-Insecure-Requests\": UIR_ARGS}\n\n\ndef os_constant(key):\n    \"\"\"\n    Get a constant value for operating system\n\n    :param key: name of cli constant\n    :return: value of constant for active os\n    \"\"\"\n\n    os_info = util.get_os_info()\n    try:\n        constants = CLI_DEFAULTS[os_info[0].lower()]\n    except KeyError:\n        constants = os_like_constants()\n        if not constants:\n            constants = CLI_DEFAULTS[\"default\"]\n    return constants[key]\n\n\ndef os_like_constants():\n    \"\"\"\n    Try to get constants for distribution with\n    similar layout and configuration, indicated by\n    /etc/os-release variable \"LIKE\"\n\n    :returns: Constants dictionary\n    :rtype: `dict`\n    \"\"\"\n\n    os_like = util.get_systemd_os_like()\n    if os_like:\n        for os_name in os_like:\n            if os_name in CLI_DEFAULTS.keys():\n                return CLI_DEFAULTS[os_name]\n    return {}\n", "path": "certbot-apache/certbot_apache/constants.py"}], "after_files": [{"content": "\"\"\"Apache plugin constants.\"\"\"\nimport pkg_resources\nfrom certbot import util\n\nCLI_DEFAULTS_DEFAULT = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/sites-available\",\n    vhost_files=\"*\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_DEBIAN = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/sites-available\",\n    vhost_files=\"*\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=\"a2enmod\",\n    dismod=\"a2dismod\",\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=True,\n    handle_sites=True,\n    challenge_location=\"/etc/apache2\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_CENTOS = dict(\n    server_root=\"/etc/httpd\",\n    vhost_root=\"/etc/httpd/conf.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/httpd\",\n    version_cmd=['apachectl', '-v'],\n    define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apachectl', 'graceful'],\n    conftest_cmd=['apachectl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/httpd/conf.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"centos-options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_GENTOO = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/vhosts.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['/usr/sbin/apache2', '-v'],\n    define_cmd=['apache2ctl', 'virtualhosts'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/vhosts.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_DARWIN = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/other\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['/usr/sbin/httpd', '-v'],\n    define_cmd=['/usr/sbin/httpd', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apachectl', 'graceful'],\n    conftest_cmd=['apachectl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/other\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_SUSE = dict(\n    server_root=\"/etc/apache2\",\n    vhost_root=\"/etc/apache2/vhosts.d\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/apache2\",\n    version_cmd=['apache2ctl', '-v'],\n    define_cmd=['apache2ctl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apache2ctl', 'graceful'],\n    conftest_cmd=['apache2ctl', 'configtest'],\n    enmod=\"a2enmod\",\n    dismod=\"a2dismod\",\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/apache2/vhosts.d\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS_ARCH = dict(\n    server_root=\"/etc/httpd\",\n    vhost_root=\"/etc/httpd/conf\",\n    vhost_files=\"*.conf\",\n    logs_root=\"/var/log/httpd\",\n    version_cmd=['apachectl', '-v'],\n    define_cmd=['apachectl', '-t', '-D', 'DUMP_RUN_CFG'],\n    restart_cmd=['apachectl', 'graceful'],\n    conftest_cmd=['apachectl', 'configtest'],\n    enmod=None,\n    dismod=None,\n    le_vhost_ext=\"-le-ssl.conf\",\n    handle_mods=False,\n    handle_sites=False,\n    challenge_location=\"/etc/httpd/conf\",\n    MOD_SSL_CONF_SRC=pkg_resources.resource_filename(\n        \"certbot_apache\", \"options-ssl-apache.conf\")\n)\nCLI_DEFAULTS = {\n    \"default\": CLI_DEFAULTS_DEFAULT,\n    \"debian\": CLI_DEFAULTS_DEBIAN,\n    \"ubuntu\": CLI_DEFAULTS_DEBIAN,\n    \"centos\": CLI_DEFAULTS_CENTOS,\n    \"centos linux\": CLI_DEFAULTS_CENTOS,\n    \"fedora\": CLI_DEFAULTS_CENTOS,\n    \"red hat enterprise linux server\": CLI_DEFAULTS_CENTOS,\n    \"rhel\": CLI_DEFAULTS_CENTOS,\n    \"amazon\": CLI_DEFAULTS_CENTOS,\n    \"gentoo\": CLI_DEFAULTS_GENTOO,\n    \"gentoo base system\": CLI_DEFAULTS_GENTOO,\n    \"darwin\": CLI_DEFAULTS_DARWIN,\n    \"opensuse\": CLI_DEFAULTS_SUSE,\n    \"suse\": CLI_DEFAULTS_SUSE,\n    \"arch\": CLI_DEFAULTS_ARCH,\n}\n\"\"\"CLI defaults.\"\"\"\n\nMOD_SSL_CONF_DEST = \"options-ssl-apache.conf\"\n\"\"\"Name of the mod_ssl config file as saved in `IConfig.config_dir`.\"\"\"\n\nAUGEAS_LENS_DIR = pkg_resources.resource_filename(\n    \"certbot_apache\", \"augeas_lens\")\n\"\"\"Path to the Augeas lens directory\"\"\"\n\nREWRITE_HTTPS_ARGS = [\n    \"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[L,NE,R=permanent]\"]\n\"\"\"Apache version<2.3.9 rewrite rule arguments used for redirections to\nhttps vhost\"\"\"\n\nREWRITE_HTTPS_ARGS_WITH_END = [\n    \"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[END,NE,R=permanent]\"]\n\"\"\"Apache version >= 2.3.9 rewrite rule arguments used for redirections to\n    https vhost\"\"\"\n\nOLD_REWRITE_HTTPS_ARGS = [\n    [\"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[L,QSA,R=permanent]\"],\n    [\"^\", \"https://%{SERVER_NAME}%{REQUEST_URI}\", \"[END,QSA,R=permanent]\"]]\n\nHSTS_ARGS = [\"always\", \"set\", \"Strict-Transport-Security\",\n             \"\\\"max-age=31536000\\\"\"]\n\"\"\"Apache header arguments for HSTS\"\"\"\n\nUIR_ARGS = [\"always\", \"set\", \"Content-Security-Policy\",\n            \"upgrade-insecure-requests\"]\n\nHEADER_ARGS = {\"Strict-Transport-Security\": HSTS_ARGS,\n               \"Upgrade-Insecure-Requests\": UIR_ARGS}\n\n\ndef os_constant(key):\n    \"\"\"\n    Get a constant value for operating system\n\n    :param key: name of cli constant\n    :return: value of constant for active os\n    \"\"\"\n\n    os_info = util.get_os_info()\n    try:\n        constants = CLI_DEFAULTS[os_info[0].lower()]\n    except KeyError:\n        constants = os_like_constants()\n        if not constants:\n            constants = CLI_DEFAULTS[\"default\"]\n    return constants[key]\n\n\ndef os_like_constants():\n    \"\"\"\n    Try to get constants for distribution with\n    similar layout and configuration, indicated by\n    /etc/os-release variable \"LIKE\"\n\n    :returns: Constants dictionary\n    :rtype: `dict`\n    \"\"\"\n\n    os_like = util.get_systemd_os_like()\n    if os_like:\n        for os_name in os_like:\n            if os_name in CLI_DEFAULTS.keys():\n                return CLI_DEFAULTS[os_name]\n    return {}\n", "path": "certbot-apache/certbot_apache/constants.py"}]}