]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_md.html.en
Simplifies the rewrite block for serving pre-compressed content.
[apache] / docs / manual / mod / mod_md.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
4 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mod_md - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_md</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../en/mod/mod_md.html" title="English">&nbsp;en&nbsp;</a></p>
30 </div>
31 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Managing domains across virtual hosts, certificate provisioning 
32         via the ACME protocol
33     </td></tr>
34 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
35 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>md_module</td></tr>
36 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_md.c</td></tr>
37 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.5.0 and later</td></tr></table>
38 <h3>Summary</h3>
39
40         <p>
41         This module manages common properties of domains for one or more virtual hosts. 
42         Specifically it can use the ACME protocol
43         (<a href="https://datatracker.ietf.org/doc/draft-ietf-acme-acme/">RFC Draft</a>) 
44         to automate certificate provisioning. These will be configured for managed domains and
45         their virtual hosts automatically. This includes renewal of certificates before they
46         expire. The most famous Certificate Authority currently implementing the ACME protocol
47         is <a href="https://letsencrypt.org/">Let's Encrypt</a>.</p>
48         
49         <div class="warning"><h3>Warning</h3>
50             <p>This module is experimental. Its behaviors, directives, and 
51                 defaults are subject to more change from release to 
52                 release relative to other standard modules. Users are encouraged to 
53                 consult the "CHANGES" file for potential updates.</p>
54         </div>
55
56         <p>Simple configuration example:</p>
57         
58         <div class="note"><h3>TLS in a VirtualHost context</h3>
59         <pre class="prettyprint lang-config">ManagedDomain example.org
60
61 &lt;VirtualHost *:443&gt;
62     ServerName example.org
63     DocumentRoot htdocs/a
64
65     SSLEngine on
66     # no certificates specification needed!
67 &lt;/VirtualHost&gt;</pre>
68
69         <p>
70             This setup will, on server start, contact
71             <a href="https://letsencrypt.org/">Let's Encrypt</a>
72             to request a certificate for the domain. If Let's Encrypt can verify the ownership
73             of the domain, the module will retrieve the certificate and its chain, store it
74             in the local file system (see <code class="directive"><a href="#mdstoredir">MDStoreDir</a></code>)
75             and provide it, on next restart, to mod_ssl.
76         </p><p>
77             This happens while the server is already running. All other hosts will continue
78             to work as before. While a certificate is not available, requests for the managed
79             domain will be answered with a '503 Service Unavailable'. 
80         </p>
81         </div>
82
83     </div>
84 <div id="quickview"><h3 class="directives">Directives</h3>
85 <ul id="toc">
86 <li><img alt="" src="../images/down.gif" /> <a href="#manageddomain">ManagedDomain</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#manageddomainsection">&lt;ManagedDomain&gt;</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#mdcachallenges">MDCAChallenges</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#mdcertificateagreement">MDCertificateAgreement</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#mdcertificateauthority">MDCertificateAuthority</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#mdcertificateprotocol">MDCertificateProtocol</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#mddrivemode">MDDriveMode</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#mdhttpproxy">MDHttpProxy</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#mdmember">MDMember</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#mdmembers">MDMembers</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#mdmuststaple">MDMustStaple</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#mdnotifycmd">MDNotifyCmd</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#mdportmap">MDPortMap</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#mdprivatekeys">MDPrivateKeys</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#mdrenewwindow">MDRenewWindow</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#mdrequirehttps">MDRequireHttps</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#mdstoredir">MDStoreDir</a></li>
103 </ul>
104 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_md">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_md">Report a bug</a></li></ul><h3>See also</h3>
105 <ul class="seealso">
106 <li><a href="#comments_section">Comments</a></li></ul></div>
107
108 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
109 <div class="directive-section"><h2><a name="ManagedDomain" id="ManagedDomain">ManagedDomain</a> <a name="manageddomain" id="manageddomain">Directive</a></h2>
110 <table class="directive">
111 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define list of domain names that belong to one group.</td></tr>
112 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ManagedDomain <var>dns-name</var> [ <var>other-dns-name</var>... ]</code></td></tr>
113 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
114 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
115 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
116 </table>
117             <p>
118                 All the names in the list are managed as one Managed Domain (MD). 
119                 mod_md will request one single certificate that is valid for all these names. This
120                 directive uses the global settings (see other MD directives below). If you
121                 need specific settings for one MD, use
122                 the <code class="directive"><a href="#manageddomain">&lt;ManagedDomain&gt;</a></code>.
123             </p><p>
124                 There are 2 additional settings that are necessary for a Managed Domain:
125                 <code class="directive"><a href="../mod/core.html#serveradmin">ServerAdmin</a></code>
126                 and <code class="directive"><a href="#mdcertificateagreement">MDCertificateAgreement</a></code>.
127                 The mail address of <code class="directive"><a href="../mod/core.html#serveradmin">ServerAdmin</a></code>
128                 is used to register at the CA (Let's Encrypt by default).
129                 The CA may use it to notify you about
130                 changes in its service or status of your certificates.
131             </p><p>
132                 The second setting, <code class="directive"><a href="#mdcertificateagreement">MDCertificateAgreement</a></code>, 
133                 is the URL of the Terms of Service of the CA. When you configure the URL, 
134                 you confirm that you have read and agree to the terms described in the linked 
135                 document. Before you do that, the CA will  not hand out certificates to you.
136             </p>
137             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ServerAdmin mailto:admin@example.org
138 MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf
139 ManagedDomain example.org www.example.org
140
141 &lt;VirtualHost *:443&gt;
142     ServerName example.org
143     DocumentRoot htdocs/root
144
145     SSLEngine on
146 &lt;/VirtualHost&gt;
147
148 &lt;VirtualHost *:443&gt;
149     ServerName www.example.org
150     DocumentRoot htdocs/www
151
152     SSLEngine on
153 &lt;/VirtualHost&gt;</pre>
154 </div>
155             <p>
156                 There are two special names that you may use in this directive: 'manual'
157                 and 'auto'. This determines if a Managed Domain shall have exactly the 
158                 name list as is configured ('manual') or offer more convenience. With 'auto'
159                 all names of a virtual host are added to a MD. Conventiently, 'auto' is also
160                 the default.
161             </p>
162             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ManagedDomain example.org
163
164 &lt;VirtualHost *:443&gt;
165     ServerName example.org
166     ServerAlias www.example.org
167     DocumentRoot htdocs/root
168
169     SSLEngine on
170 &lt;/VirtualHost&gt;
171
172 ManagedDomain example2.org auto
173
174 &lt;VirtualHost *:443&gt;
175     ServerName example2.org
176     ServerAlias www.example2.org
177     ...
178 &lt;/VirtualHost&gt;</pre>
179 </div>
180             <p>
181                 In this example, the domain 'www.example.org' is automatically added to
182                 the MD 'example.org'. Similarly for 'example2.org' where 'auto' is configured
183                 explicitly. Whenever you add more ServerAlias names to this
184                 virtual host, they will be added as well to the Manged Domain.
185             </p><p>
186                 If this is too much automagic for you, define 'manual' mode. 
187                 <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> will then complain if the names do not match.
188             </p>
189         
190 </div>
191 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
192 <div class="directive-section"><h2><a name="ManagedDomainsection" id="ManagedDomainsection">&lt;ManagedDomain&gt;</a> <a name="manageddomainsection" id="manageddomainsection">Directive</a></h2>
193 <table class="directive">
194 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to the same managed domains.</td></tr>
195 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;ManagedDomain <var>dns-name</var> [ <var>other-dns-name</var>... ]&gt;...&lt;/ManagedDomain&gt;</code></td></tr>
196 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
197 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
198 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
199 </table>
200             <p>
201                 This directive allows you to define a Managed Domain (MD) with specific
202                 settings, different from the global MD* ones. For example, you can have
203                 such an MD use another CA then Let's Encrypt, have its unique renewal duration
204                 etc.
205             </p>
206             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">&lt;ManagedDomain sandbox.example.org&gt;
207     MDCertificateAuthority   https://someotherca.com/ACME
208     MDCertificateAgreement   https://someotherca.com/terms/v_1.02.pdf
209 &lt;/ManagedDomain&gt;</pre>
210 </div>
211         
212 </div>
213 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
214 <div class="directive-section"><h2><a name="MDCAChallenges" id="MDCAChallenges">MDCAChallenges</a> <a name="mdcachallenges" id="mdcachallenges">Directive</a></h2>
215 <table class="directive">
216 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Type of ACME challenge used to prove domain ownership.</td></tr>
217 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDCAChallenges name [ name ... ]</code></td></tr>
218 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDCAChallenges tls-sni-01 http-01</code></td></tr>
219 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
220 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
221 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
222 </table>
223             <p>
224                 This tells <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> which challenge types it shall use in
225                 which order when proving domain ownership. The names are protocol specific. The
226                 current ACME protocol version that Let's Encrypt speaks defines two challenge
227                 types that are supported by <code class="module"><a href="../mod/mod_md.html">mod_md</a></code>. By default, it will try
228                 the one on port 443 when available.
229             </p>
230         
231 </div>
232 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
233 <div class="directive-section"><h2><a name="MDCertificateAgreement" id="MDCertificateAgreement">MDCertificateAgreement</a> <a name="mdcertificateagreement" id="mdcertificateagreement">Directive</a></h2>
234 <table class="directive">
235 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The URL of the Terms-of-Service document, that the CA server requires you to accept.</td></tr>
236 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDCertificateAgreement url-of-terms-of-service</code></td></tr>
237 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
240 </table>
241             <p>When you use <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> to obtain a certificate, you become a customer of the CA (e.g. Let's Encrypt). That means you need to read and agree to their Terms of Service, 
242             so that you understand what they offer and what they might exclude or require from you. 
243             <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> cannot, by itself, agree to such a thing. 
244             </p>
245             <p>In case of Let's Encrypt, their current <a href="https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf">Terms of Service are here</a>. 
246             Those terms might (and probably will) change over time. So, the certificate renewal might require you to update this agreement URL.</p>
247             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf
248 ManagedDomain example.org www.example.org mail.example.org</pre>
249 </div>
250         
251 </div>
252 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
253 <div class="directive-section"><h2><a name="MDCertificateAuthority" id="MDCertificateAuthority">MDCertificateAuthority</a> <a name="mdcertificateauthority" id="mdcertificateauthority">Directive</a></h2>
254 <table class="directive">
255 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The URL of the ACME Certificate Authority service.</td></tr>
256 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDCertificateAuthority url</code></td></tr>
257 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDCertificateAuthority https://acme-v01.api.letsencrypt.org/directory</code></td></tr>
258 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
259 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
260 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
261 </table>
262             <p>
263                 The URL where the CA offers its service.
264             </p><p>
265                 Let's Encrypt offers, right now, two such URLs. One for the real certificates and
266                 one for testing (their staging area, at https://acme-staging.api.letsencrypt.org/directory).
267                 In order to have <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> use this testing service, configure your
268                 server like this: 
269             </p>
270             <div class="example"><h3>LE Staging Setup</h3><pre class="prettyprint lang-config">MDCertificateAuthority https://acme-staging.api.letsencrypt.org/directory
271 MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf</pre>
272 </div>
273         
274 </div>
275 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
276 <div class="directive-section"><h2><a name="MDCertificateProtocol" id="MDCertificateProtocol">MDCertificateProtocol</a> <a name="mdcertificateprotocol" id="mdcertificateprotocol">Directive</a></h2>
277 <table class="directive">
278 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The protocol to use with the Certificate Authority.</td></tr>
279 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDCertificateProtocol protocol</code></td></tr>
280 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDCertificateProtocol ACME</code></td></tr>
281 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
282 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
283 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
284 </table>
285             <p>Specifies the protocol to use. Currently, only <code>ACME</code> is supported.</p>
286         
287 </div>
288 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
289 <div class="directive-section"><h2><a name="MDDriveMode" id="MDDriveMode">MDDriveMode</a> <a name="mddrivemode" id="mddrivemode">Directive</a></h2>
290 <table class="directive">
291 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control when it is allowed to obtain/renew certificates.</td></tr>
292 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDDriveMode always|auto|manual</code></td></tr>
293 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDDriveMode auto</code></td></tr>
294 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
295 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
296 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
297 </table>
298             <p>In 'auto' mode, <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> will <em>drive</em> a Managed Domain's
299             properties (e.g. certificate management) whenever necessary. When a MD is not used
300             in any virtual host, the module will do nothing. When a certificate is missing, it
301             will try to get one. When a certificate expires soon (see 
302             <code class="directive"><a href="#mdrenewwindow">MDRenewWindow</a></code>), it will
303             renew it.
304             </p><p>
305             In 'manual' mode, it is your duty to do all this. The module will provide the existing
306             certificate to mod_ssl, if available. But it will not contact the CA for signup/renewal.
307             This can be useful in clustered setups where you want just one node to perform
308             the driving.
309             </p><p>
310             The third mode 'always' is like 'auto' only that <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> will not
311             check if the MD is actually used somewhere. 
312             </p>
313         
314 </div>
315 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
316 <div class="directive-section"><h2><a name="MDHttpProxy" id="MDHttpProxy">MDHttpProxy</a> <a name="mdhttpproxy" id="mdhttpproxy">Directive</a></h2>
317 <table class="directive">
318 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a proxy for outgoing connections.</td></tr>
319 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDHttpProxy url</code></td></tr>
320 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
321 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
322 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
323 </table>
324             <p>Use a http proxy to connect to the MDCertificateAuthority. Define this
325             if your webserver can only reach the internet with a forward proxy.
326             </p>
327         
328 </div>
329 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
330 <div class="directive-section"><h2><a name="MDMember" id="MDMember">MDMember</a> <a name="mdmember" id="mdmember">Directive</a></h2>
331 <table class="directive">
332 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Additional hostname for the managed domain.</td></tr>
333 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDMember hostname</code></td></tr>
334 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
335 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
336 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
337 </table>
338             <p>
339             Instead of listing all dns names on the same line, you may use
340             <code class="directive"><a href="#mdmember">MDMember</a></code> to add such names
341             to a managed domain.
342             </p>
343             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">&lt;ManagedDomain example.org&gt;
344     MDMember www.example.org
345     MDMember mail.example.org
346 &lt;/ManagedDomain example.org&gt;</pre>
347 </div>
348             <p>
349                If you use it in the global context, outside a specific MD, you can only
350                specify one value, 'auto' or 'manual' as the default for all other MDs. See
351                <code class="directive"><a href="#manageddomain">&lt;ManagedDomain&gt;</a></code> for a
352                description of these special values.
353             </p>
354         
355 </div>
356 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
357 <div class="directive-section"><h2><a name="MDMembers" id="MDMembers">MDMembers</a> <a name="mdmembers" id="mdmembers">Directive</a></h2>
358 <table class="directive">
359 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control if the alias domain names are automatically added.</td></tr>
360 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDMembers auto|manual</code></td></tr>
361 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDMembers auto</code></td></tr>
362 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
363 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
364 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
365 </table>
366             <p>Defines if the <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code> and
367                <code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code> values of a VirtualHost
368                are automatically added to the members of a Managed Domain or not.
369             </p>
370         
371 </div>
372 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
373 <div class="directive-section"><h2><a name="MDMustStaple" id="MDMustStaple">MDMustStaple</a> <a name="mdmuststaple" id="mdmuststaple">Directive</a></h2>
374 <table class="directive">
375 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control if new certificates carry the OCSP Must Staple flag.</td></tr>
376 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDMustStaple on|off</code></td></tr>
377 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDMustStaple off</code></td></tr>
378 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
379 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
380 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
381 </table>
382             <p>Defines if newly requested certificate should have the OCSP Must Staple flag 
383             set or not. If a certificate has this flag, the server is required to send a 
384             OCSP stapling response to every client. This only works if you configure 
385             mod_ssl to generate this (see <code class="directive"><a href="../mod/mod_ssl.html#sslusestapling">SSLUseStapling</a></code>
386             and friends).
387             </p>
388         
389 </div>
390 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
391 <div class="directive-section"><h2><a name="MDNotifyCmd" id="MDNotifyCmd">MDNotifyCmd</a> <a name="mdnotifycmd" id="mdnotifycmd">Directive</a></h2>
392 <table class="directive">
393 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Run a program when Managed Domain are ready.</td></tr>
394 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDNotifyCmd  path</code></td></tr>
395 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
396 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
397 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
398 </table>
399             <p>The configured executable is run when Managed Domains have signed up or
400             renewed their certificates. It is given the names of the processed MDs as
401             arguments. It should return status code 0 to indicate that it has 
402             run successfully.
403             </p>
404         
405 </div>
406 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
407 <div class="directive-section"><h2><a name="MDPortMap" id="MDPortMap">MDPortMap</a> <a name="mdportmap" id="mdportmap">Directive</a></h2>
408 <table class="directive">
409 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Map external to internal ports for domain ownership verification.</td></tr>
410 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDPortMap map1 [ map2 ]</code></td></tr>
411 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDPortMap 80:80 443:443</code></td></tr>
412 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
413 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
414 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
415 </table>
416             <p>
417                 The ACME protocol provides two method to verify domain ownership: one that uses
418                 port 80 and one for port 443. If your server is not reachable by at least one
419                 of the two, ACME will not work for you.
420             </p><p>
421                 <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> will look at your server configuration and try to figure
422                 out which of those are available. Then it can select the proper ACME challenge
423                 to create a certificate for your site.
424             </p><p>
425                 However if you have some fancy port forwarding in place, your server may be
426                 reachable from the Internet on port 443, but the local port that httpd uses is
427                 another one. Your server might only listen on ports 5001 and 5002, but be reached
428                 on ports 443 and 80. How should <code class="module"><a href="../mod/mod_md.html">mod_md</a></code> figure that one out?
429             </p><p>
430                 With MDPortMap you can tell it which 'Internet port' corresponds to which local
431                 port.
432             </p>
433             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">MDPortMap 80:- 443:5002</pre>
434 </div>
435             <p>
436                 This example says that the server is not reachable on port 80 from the outside, but
437                 local port 5002 is the one responding to https: requests.
438             </p>
439         
440 </div>
441 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
442 <div class="directive-section"><h2><a name="MDPrivateKeys" id="MDPrivateKeys">MDPrivateKeys</a> <a name="mdprivatekeys" id="mdprivatekeys">Directive</a></h2>
443 <table class="directive">
444 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Set type and size of the private keys generated.</td></tr>
445 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDPrivateKeys type [ params... ]</code></td></tr>
446 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDPrivateKeys RSA 2048</code></td></tr>
447 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
448 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
449 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
450 </table>
451             <p>
452                 Defines what kind of private keys are generated for a managed domain and with
453                 what parameters. The only supported type right now is 'RSA' and the only parameter
454                 it takes is the number of bits used for the key.
455             </p><p>
456                 The current (2017) recommendation is at least 2048 bits and a smaller number is
457                 not accepted here. Higher numbers offer longer security, but are computationally more 
458                 expensive, e.g. increase the load on your server. That might or might not be an
459                 issue for you.
460             </p><p>
461                 Other key types will be defined in the future.
462             </p>
463             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">MDPrivateKeys RSA 3072</pre>
464 </div>
465             <p>
466                 Please note that this setting only has an effect on new keys. Any existing
467                 private key you have remains unaffected. Also, this only affects private keys
468                 generated for certificates. ACME account keys are unaffected by this.
469             </p>
470         
471 </div>
472 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
473 <div class="directive-section"><h2><a name="MDRenewWindow" id="MDRenewWindow">MDRenewWindow</a> <a name="mdrenewwindow" id="mdrenewwindow">Directive</a></h2>
474 <table class="directive">
475 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control when a certificate will be renewed.</td></tr>
476 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDRenewWindow duration</code></td></tr>
477 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDRenewWindow 33%</code></td></tr>
478 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
479 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
480 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
481 </table>
482             <p>
483             If the validity of the certificate falls below duration, mod_md will get a 
484             new signed certificate.
485             </p><p>
486             Normally, certificates are valid for around 90 days and mod_md will renew 
487             them the earliest 33% of their complete lifetime before they expire (so for 
488             90 days validity, 30 days before it expires). If you think this is not what 
489             you need, you can specify either the exact time, as in:
490             </p>
491             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config"># 21 days before expiry
492 MDRenewWindow 21d 
493 # 30 seconds (might be close)
494 MDRenewWindow 30s
495 # 10% of the cert lifetime
496 MDRenewWindow 10%</pre>
497 </div>
498             <p>When in auto drive mode, the module will check every 12 hours at least 
499             what the status of the managed domains is and if it needs to do something. 
500             On errors, for example when the CA is unreachable, it will initially retry 
501             after some seconds. Should that continue to fail, it will back off to a 
502             maximum interval of hourly checks.
503             </p>
504         
505 </div>
506 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
507 <div class="directive-section"><h2><a name="MDRequireHttps" id="MDRequireHttps">MDRequireHttps</a> <a name="mdrequirehttps" id="mdrequirehttps">Directive</a></h2>
508 <table class="directive">
509 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Redirects http: traffic to https: for Managed Domains.</td></tr>
510 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDRequireHttps off|temporary|permanent</code></td></tr>
511 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDRequireHttps off</code></td></tr>
512 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
513 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
514 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
515 </table>
516             <p>This is a convenience directive to ease http: to https: migration of 
517             your Managed Domains. With:
518             </p>
519             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">MDRequireHttps temporary</pre>
520 </div>
521             <p>you announce that you want all traffic via http: URLs to be redirected 
522             to the https: ones, for now. This is safe and you can remove this again at
523             any time.
524             </p><p>
525                 <strong>The following has consequences: </strong>if you want client to <strong>no longer</strong> use the
526              http: URLs, configure:
527             </p>
528             <div class="example"><h3>Permanent (for at least half a year!)</h3><pre class="prettyprint lang-config">MDRequireHttps permanent</pre>
529 </div>
530             <p>This does two things:
531             </p>
532             <ol>
533                 <li>All request to the <code>http:</code> resources are redirected to the
534                     same url with the <code>https:</code> scheme using the <code>301</code>
535                 status code. This tells clients that this is intended to be forever and
536                 the should update any links they have accordingly.
537                 </li>
538                 <li>All answers to <code>https:</code> requests will carry the header
539                     <code>Strict-Transport-Security</code> with a life time of half a year.
540                     This tells the browser that it <strong>never</strong> (for half a year) shall use <code>http:</code>
541                     when talking to this domain name. Browsers will, after having seen this, refuse
542                     to contact your unencrypted site. This prevents malicious middleware to
543                     downgrade connections and listen/manipulate the traffic. Which is good. But
544                     you cannot simply take it back again.
545                 </li>
546             </ol>
547             <p>You can achieve the same with mod_alias and some Redirect configuration,
548             basically. If you do it yourself, please make sure to exclude the paths 
549             /.well-known/* from your redirection, otherwise mod_md might have trouble 
550             signing on new certificates.
551             </p>
552             <p>If you set this globally, it applies to all managed domains. If you want 
553             it for a specific domain only, use:
554             </p>
555             <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">&lt;ManagedDomain xxx.yyy&gt;
556   MDRequireHttps temporary
557 &lt;/ManagedDomain&gt;</pre>
558 </div>
559         
560 </div>
561 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
562 <div class="directive-section"><h2><a name="MDStoreDir" id="MDStoreDir">MDStoreDir</a> <a name="mdstoredir" id="mdstoredir">Directive</a></h2>
563 <table class="directive">
564 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Path on the local file system to store the Managed Domains data.</td></tr>
565 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MDStoreDir path</code></td></tr>
566 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MDStoreDir md</code></td></tr>
567 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
568 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
569 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_md</td></tr>
570 </table>
571             <p>
572                 Defines where on the local file system the Managed Domain data is stored. This is
573                 an absolute path or interpreted relative to the server root. The default will create
574                 a directory 'md' in your server root.
575             </p><p>
576                 If you move this and have already data, be sure to move/copy the data first to
577                 the new location, reconfigure and then restart the server. If you reconfigure
578                 and restart first, the server will try to get new certificates that it thinks
579                 are missing.
580             </p>
581         
582 </div>
583 </div>
584 <div class="bottomlang">
585 <p><span>Available Languages: </span><a href="../en/mod/mod_md.html" title="English">&nbsp;en&nbsp;</a></p>
586 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
587 <script type="text/javascript"><!--//--><![CDATA[//><!--
588 var comments_shortname = 'httpd';
589 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_md.html';
590 (function(w, d) {
591     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
592         d.write('<div id="comments_thread"><\/div>');
593         var s = d.createElement('script');
594         s.type = 'text/javascript';
595         s.async = true;
596         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
597         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
598     }
599     else {
600         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
601     }
602 })(window, document);
603 //--><!]]></script></div><div id="footer">
604 <p class="apache">Copyright 2017 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
605 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
606 if (typeof(prettyPrint) !== 'undefined') {
607     prettyPrint();
608 }
609 //--><!]]></script>
610 </body></html>