You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stefan Eissing <st...@greenbytes.de> on 2017/09/01 14:39:15 UTC
Re: Listen 443 https
I get the first feedback from Apache users that want their http: only hosts to also serve https:. This is nice feedback to improve usability of mod_md.
Ideally, what these people want - and that is purely my interpretation - is to add a few lines to their config and - voila - https: is available. And, honestly, why should they not expect that?
Example: Duplication/Redirect
They have something like:
----------------------------------
Listen 80
<VirtualHost *:80>
ServerName xxx.yyy
...
</VirtualHost>
----------------------------------
and want to also make that available on https:
----------------------------------
Listen http://*:80
Listen https://*:443
<VirtualHost *:80>
ServerName xxx.yyy
AlternatePorts 443
...
</VirtualHost>
----------------------------------
or redirect everyone to https:
----------------------------------
Listen http://*:80
Listen https://*:443
<VirtualHost *:443>
ServerName xxx.yyy
RedirectPermanentFrom 80
...
</VirtualHost>
----------------------------------
I am not hooked on the names, but I hope you understand the intent? Anyone with me on this?
Cheers,
Stefan
> Am 10.08.2017 um 16:19 schrieb Stefan Eissing <st...@greenbytes.de>:
>
>> Am 10.08.2017 um 16:09 schrieb William A Rowe Jr <wr...@rowe-clan.net>:
>>
>> Let's break it down and consider the implications of Listen...
>>
>> On Thu, Aug 10, 2017 at 8:28 AM, Stefan Eissing
>> <st...@greenbytes.de> wrote:
>>> Now that mod_md has landed in trunk, I am looking at more ways
>>> to simplify a SSL configuration. Looking at the Listen directive,
>>> it has an optional 2nd protocol parameter.
>>>
>>> Would it be unreasonable to assume that a
>>> Listen NNN https
>>>
>>> means that "SSLEngine on" should be the default in all
>>> <VirtualHost *:NNN>
>>> ServerName xxx.yyy
>>> ...
>>> </VirtualHost>
>>>
>>> sections?
>>
>> Firstly, we have well understood protocols definitions, so there
>> are several shorthand flavors that could be introduced;
>>
>> Listen https
>>
>> has a very plain and obvious meaning. Thus, so would these;
>>
>> Listen https://192.168.1.1
>> Listen https://xxx.yyy
>> Listen https://192.168.1.1:8443
>> Listen https://xxx.yyy:8443
>
> I like this.
Coming back to this. If we - optionally - would support this in the 'Listen' directive
Re: Listen 443 https
Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 01.09.2017 um 17:12 schrieb Eric Covener <co...@gmail.com>:
>
> On Fri, Sep 1, 2017 at 10:39 AM, Stefan Eissing
> <st...@greenbytes.de> wrote:
>> I get the first feedback from Apache users that want their http: only hosts to also serve https:. This is nice feedback to improve usability of mod_md.
>>
>> Ideally, what these people want - and that is purely my interpretation - is to add a few lines to their config and - voila - https: is available. And, honestly, why should they not expect that?
>>
>>
>>
>> Example: Duplication/Redirect
>>
>> They have something like:
>> ----------------------------------
>> Listen 80
>> <VirtualHost *:80>
>> ServerName xxx.yyy
>> ...
>> </VirtualHost>
>> ----------------------------------
>>
>> and want to also make that available on https:
>> ----------------------------------
>> Listen http://*:80
>> Listen https://*:443
>>
>> <VirtualHost *:80>
>> ServerName xxx.yyy
>> AlternatePorts 443
>> ...
>> </VirtualHost>
>> ----------------------------------
>>
>> or redirect everyone to https:
>> ----------------------------------
>> Listen http://*:80
>> Listen https://*:443
>>
>> <VirtualHost *:443>
>> ServerName xxx.yyy
>> RedirectPermanentFrom 80
>> ...
>> </VirtualHost>
>
> I am not keen on the syntax because we already permit multiple
> addresses in the VirtualHost tag.
>
> How about e.g.
>
> <virtualhost *:80 *:443>
> # no protocol
> ServerName example.com
> # repurpose "optional" or pick something new
> SSLEgine optional
> # Extend SSLRequireSSL. no-arg is deny. Default w/ "redirect" is
> 80, 443. For redirects, may need to not match TCP listening port
> SSLRequireSSL ["redirect" [ from-port to-port ]]
> </virtualhost>
I like the SSLRequireSSL gist. I was thinking about this over the weekend and like the following a lot:
SSLEngine *:443 10.0.0.1:8001
SSLRequireSSL ["temporary"|"permanent" [ from-port to-port ]]
with "permanent" as default and port 443, or the first port in SSLEngine - if given - as default.
This can be specified in a <VirtualHost> or, better even, in the base server. I think this can, together with multiple ports at <VirtualHost>, simplify configurations of TLS hosts. At least for people who want to offer the same resources on 80 and 443, or want to migrate existing *:80 hosts to TLS.
What do you think?
-Stefan
Re: Listen 443 https
Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 14.09.2017 um 16:19 schrieb Eric Covener <co...@gmail.com>:
>
>> To recap: I am looking for an easy way to instruct someone to enable https: for
>>
>> Listen 80
>>
>> <VirtualHost *:80>
>> ServerName blabla.org
>> ...lots of stuff...
>> </VirtualHost>
>>
>> and with the current trunk, she can change this to:
>>
>> Listen 80
>> Listen 443
>> SSLEngine *:443
>>
>> ManagedDomain blabla.org
>> <VirtualHost *:443 *:80>
>> ServerName blabla.org
>> ...lots of stuff...
>> </VirtualHost>
>>
>> Hey, it's not that I *want* to define this on my own. I am asking since March for feedback on these things here. I am not sure how to react to "Don't like this so much." now.
>
> It's a bit hard for me to understand the contrast points in this
> thread, even with the followups, especially as a non-mod_ssl user. So
> take my earlier feedback from today with a grain of salt. My
> personal preference is to give someone directives with expressive
> names if the objective is to make the basic configuration easier.
Understood. I can totally agree to the point about descriptive names. I am not a big fan of "SSLEngine" myself. I chose it because:
a) it already is the central directive to enable mod_ssl
b) there are other *Engine configs similar, so it is a common pattern in httpd.
c) A new directive would need to describe how it interacts with SSLEngine and what has precedence where.
But we could use a different name. I would, no matter the name, like a directive that is one line in the global context. Editing the same directives in all virtual hosts is tedious, error-prone work *).
One other way of providing more descriptive SSL setups would be a new "SSLPolicy" directives. We could pre-define
<SSLPolicy auto-enable>
SSLEngine *:443
</SSLPolicy>
and people just add
SSLPolicy auto-enable
to their httpd.conf (we need *some* new config, to make that happen in 2.4.x).
Cheers,
Stefan
*) I already got several people testing mod_md and forgetting "SSLEngine on". The problem is that clients often spew out a cryptic (haha!) error message about TLS record lengths or some such that does not really help people to discover their, easy to fix, mistake.
Re: Listen 443 https
Posted by Eric Covener <co...@gmail.com>.
> To recap: I am looking for an easy way to instruct someone to enable https: for
>
> Listen 80
>
> <VirtualHost *:80>
> ServerName blabla.org
> ...lots of stuff...
> </VirtualHost>
>
> and with the current trunk, she can change this to:
>
> Listen 80
> Listen 443
> SSLEngine *:443
>
> ManagedDomain blabla.org
> <VirtualHost *:443 *:80>
> ServerName blabla.org
> ...lots of stuff...
> </VirtualHost>
>
> Hey, it's not that I *want* to define this on my own. I am asking since March for feedback on these things here. I am not sure how to react to "Don't like this so much." now.
It's a bit hard for me to understand the contrast points in this
thread, even with the followups, especially as a non-mod_ssl user. So
take my earlier feedback from today with a grain of salt. My
personal preference is to give someone directives with expressive
names if the objective is to make the basic configuration easier.
Re: Listen 443 https
Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 14.09.2017 um 14:56 schrieb Eric Covener <co...@gmail.com>:
>
> On Fri, Sep 8, 2017 at 5:03 AM, Stefan Eissing
> <st...@greenbytes.de> wrote:
>>
>>> Am 08.09.2017 um 04:37 schrieb William A Rowe Jr <wr...@rowe-clan.net>:
>>>
>>> Reminder, this will not work with the current server_rec, we have a 1:1 correspondence to the server port. We would need to stop looking at that field and track the port entirely on the connection and the server rec addresses array.
>>
>> Urgs.
>>
>> 1. Irregardless of multiple addresses in a VirtualHost, I still like the idea of
>>
>> SSLEngine *:443 local_interface:8001
>>
>> that is best used in the base server, once.
>> a) I think it is easy to understand what it does.
>> b) It prevents missing 'SSLEngine on' in a VirtualHost that needs it
>> c) It causes required fails when a VirtualHost on a SSL port has no certificates
>
> What do the parameters mean here?
Those are the addresses (same format as in VirtualHost) where "SSLEngine on" is implied, for all vhosts where no other SSLEngine is defined.
>>
>> With that, we could advise people who want to start using SSL to include the following in their main conf:
>>
>> Listen 443
>> # The following fails if your OpenSSL is not new enough.
>> SSLPolicy modern
>> SSLEngine *:443
>
> I don't like this so much.
You mean, you will not use it? Or that you think this leads to misconfigurations? Or that there is an easier way?
> I'd rather a new directive altogether if it will live outside of the
> affected VH and that the name convey a little more of what it's doing.
>
>> 2. For people *moving* from http: to https: for a VirtualHost, we'd advise
>>
>> <VirtualHost *:80>
>> ServerName yourhostname
>> Redirect 301 "/" "https://yourhostname/"
>> </VirtualHost>
>>
>> <VirtualHost *:443>
>> ServerName yourhostname
>> ...the former http: config
>> </VirtualHost>
>>
>
> The only difference from the as-is here is that the SSL config is
> implicit because of some global directive, right?
No, the SSL config is inherited, just as it is now. You can still overwrite it in the vhost.
>
>>
>> 3. For people wanting to offer both http: and https: for the same resources (maybe for a trial period), what would we tell them?
>> a) Copy to a new VirtualHost
>> b) Make separate file and Include in two VirtualHost?
>> c) Macros???
>
> I think this leads back to 1 VH with directives like SSLRequireSSL and
> automatic SSL over 443 or opted in ports.
> Or, global configs w/ no VH at all that just work.
I am not sure what you mean and if you think it's positive or not.
To recap: I am looking for an easy way to instruct someone to enable https: for
Listen 80
<VirtualHost *:80>
ServerName blabla.org
...lots of stuff...
</VirtualHost>
and with the current trunk, she can change this to:
Listen 80
Listen 443
SSLEngine *:443
ManagedDomain blabla.org
<VirtualHost *:443 *:80>
ServerName blabla.org
...lots of stuff...
</VirtualHost>
Hey, it's not that I *want* to define this on my own. I am asking since March for feedback on these things here. I am not sure how to react to "Don't like this so much." now.
Cheers,
Stefan
Re: Listen 443 https
Posted by Eric Covener <co...@gmail.com>.
On Fri, Sep 8, 2017 at 5:03 AM, Stefan Eissing
<st...@greenbytes.de> wrote:
>
>> Am 08.09.2017 um 04:37 schrieb William A Rowe Jr <wr...@rowe-clan.net>:
>>
>> Reminder, this will not work with the current server_rec, we have a 1:1 correspondence to the server port. We would need to stop looking at that field and track the port entirely on the connection and the server rec addresses array.
>
> Urgs.
>
> 1. Irregardless of multiple addresses in a VirtualHost, I still like the idea of
>
> SSLEngine *:443 local_interface:8001
>
> that is best used in the base server, once.
> a) I think it is easy to understand what it does.
> b) It prevents missing 'SSLEngine on' in a VirtualHost that needs it
> c) It causes required fails when a VirtualHost on a SSL port has no certificates
What do the parameters mean here?
>
> With that, we could advise people who want to start using SSL to include the following in their main conf:
>
> Listen 443
> # The following fails if your OpenSSL is not new enough.
> SSLPolicy modern
> SSLEngine *:443
I don't like this so much.
I'd rather a new directive altogether if it will live outside of the
affected VH and that the name convey a little more of what it's doing.
> 2. For people *moving* from http: to https: for a VirtualHost, we'd advise
>
> <VirtualHost *:80>
> ServerName yourhostname
> Redirect 301 "/" "https://yourhostname/"
> </VirtualHost>
>
> <VirtualHost *:443>
> ServerName yourhostname
> ...the former http: config
> </VirtualHost>
>
The only difference from the as-is here is that the SSL config is
implicit because of some global directive, right?
>
> 3. For people wanting to offer both http: and https: for the same resources (maybe for a trial period), what would we tell them?
> a) Copy to a new VirtualHost
> b) Make separate file and Include in two VirtualHost?
> c) Macros???
I think this leads back to 1 VH with directives like SSLRequireSSL and
automatic SSL over 443 or opted in ports.
Or, global configs w/ no VH at all that just work.
Re: Listen 443 https
Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 08.09.2017 um 04:37 schrieb William A Rowe Jr <wr...@rowe-clan.net>:
>
> Reminder, this will not work with the current server_rec, we have a 1:1 correspondence to the server port. We would need to stop looking at that field and track the port entirely on the connection and the server rec addresses array.
Urgs.
1. Irregardless of multiple addresses in a VirtualHost, I still like the idea of
SSLEngine *:443 local_interface:8001
that is best used in the base server, once.
a) I think it is easy to understand what it does.
b) It prevents missing 'SSLEngine on' in a VirtualHost that needs it
c) It causes required fails when a VirtualHost on a SSL port has no certificates
With that, we could advise people who want to start using SSL to include the following in their main conf:
Listen 443
# The following fails if your OpenSSL is not new enough.
SSLPolicy modern
SSLEngine *:443
2. For people *moving* from http: to https: for a VirtualHost, we'd advise
<VirtualHost *:80>
ServerName yourhostname
Redirect 301 "/" "https://yourhostname/"
</VirtualHost>
<VirtualHost *:443>
ServerName yourhostname
...the former http: config
</VirtualHost>
?
3. For people wanting to offer both http: and https: for the same resources (maybe for a trial period), what would we tell them?
a) Copy to a new VirtualHost
b) Make separate file and Include in two VirtualHost?
c) Macros???
Cheers,
Stefan
-------------------------------------------------------------------
Quick scan where we use server_rec->port:
core:
AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r)
{
...
port = r->parsed_uri.port_str ? r->parsed_uri.port :
r->server->port ? r->server->port :
ap_default_port(r);
mod_log_config.c:
static const char *log_server_port(request_rec *r, char *a)
{
apr_port_t port;
if (*a == '\0' || !strcasecmp(a, "canonical")) {
port = r->server->port ? r->server->port : ap_default_port(r);
}
ssl_engine_init.c:
if ((sc->enabled == SSL_ENABLED_TRUE) && (s->port == DEFAULT_HTTP_PORT)) {
ssl_util.c:
char *ssl_util_vhostid(apr_pool_t *p, server_rec *s)
{
char *id;
SSLSrvConfigRec *sc;
char *host;
apr_port_t port;
host = s->server_hostname;
if (s->port != 0)
port = s->port;
else {
vhost.c:
/* the Port has to match now, because the rest don't have ports associated
* with them. */
if (port != s->port) {
return 0;
}
> On Fri, Sep 1, 2017 at 10:12 AM, Eric Covener <co...@gmail.com> wrote:
> > On Fri, Sep 1, 2017 at 10:39 AM, Stefan Eissing
> > <st...@greenbytes.de> wrote:
> >> I get the first feedback from Apache users that want their http: only hosts to also serve https:. This is nice feedback to improve usability of mod_md.
> >>
> >> Ideally, what these people want - and that is purely my interpretation - is to add a few lines to their config and - voila - https: is available. And, honestly, why should they not expect that?
> >>
> >>
> >>
> >> Example: Duplication/Redirect
> >>
> >> They have something like:
> >> ----------------------------------
> >> Listen 80
> >> <VirtualHost *:80>
> >> ServerName xxx.yyy
> >> ...
> >> </VirtualHost>
> >> ----------------------------------
> >>
> >> and want to also make that available on https:
> >> ----------------------------------
> >> Listen http://*:80
> >> Listen https://*:443
> >>
> >> <VirtualHost *:80>
> >> ServerName xxx.yyy
> >> AlternatePorts 443
> >> ...
> >> </VirtualHost>
> >> ----------------------------------
> >>
> >> or redirect everyone to https:
> >> ----------------------------------
> >> Listen http://*:80
> >> Listen https://*:443
> >>
> >> <VirtualHost *:443>
> >> ServerName xxx.yyy
> >> RedirectPermanentFrom 80
> >> ...
> >> </VirtualHost>
> >
> > I am not keen on the syntax because we already permit multiple
> > addresses in the VirtualHost tag.
> >
> > How about e.g.
> >
> > <virtualhost *:80 *:443>
>
> Again, fo
Re: Listen 443 https
Posted by William A Rowe Jr <wr...@rowe-clan.net>.
Reminder, this will not work with the current server_rec, we have a 1:1
correspondence to the server port. We would need to stop looking at that
field and track the port entirely on the connection and the server rec
addresses array.
On Fri, Sep 1, 2017 at 10:12 AM, Eric Covener <co...@gmail.com> wrote:
> On Fri, Sep 1, 2017 at 10:39 AM, Stefan Eissing
> <st...@greenbytes.de> wrote:
>> I get the first feedback from Apache users that want their http: only
hosts to also serve https:. This is nice feedback to improve usability of
mod_md.
>>
>> Ideally, what these people want - and that is purely my interpretation -
is to add a few lines to their config and - voila - https: is available.
And, honestly, why should they not expect that?
>>
>>
>>
>> Example: Duplication/Redirect
>>
>> They have something like:
>> ----------------------------------
>> Listen 80
>> <VirtualHost *:80>
>> ServerName xxx.yyy
>> ...
>> </VirtualHost>
>> ----------------------------------
>>
>> and want to also make that available on https:
>> ----------------------------------
>> Listen http://*:80
>> Listen https://*:443
>>
>> <VirtualHost *:80>
>> ServerName xxx.yyy
>> AlternatePorts 443
>> ...
>> </VirtualHost>
>> ----------------------------------
>>
>> or redirect everyone to https:
>> ----------------------------------
>> Listen http://*:80
>> Listen https://*:443
>>
>> <VirtualHost *:443>
>> ServerName xxx.yyy
>> RedirectPermanentFrom 80
>> ...
>> </VirtualHost>
>
> I am not keen on the syntax because we already permit multiple
> addresses in the VirtualHost tag.
>
> How about e.g.
>
> <virtualhost *:80 *:443>
Again, fo
Re: Listen 443 https
Posted by Eric Covener <co...@gmail.com>.
On Fri, Sep 1, 2017 at 10:39 AM, Stefan Eissing
<st...@greenbytes.de> wrote:
> I get the first feedback from Apache users that want their http: only hosts to also serve https:. This is nice feedback to improve usability of mod_md.
>
> Ideally, what these people want - and that is purely my interpretation - is to add a few lines to their config and - voila - https: is available. And, honestly, why should they not expect that?
>
>
>
> Example: Duplication/Redirect
>
> They have something like:
> ----------------------------------
> Listen 80
> <VirtualHost *:80>
> ServerName xxx.yyy
> ...
> </VirtualHost>
> ----------------------------------
>
> and want to also make that available on https:
> ----------------------------------
> Listen http://*:80
> Listen https://*:443
>
> <VirtualHost *:80>
> ServerName xxx.yyy
> AlternatePorts 443
> ...
> </VirtualHost>
> ----------------------------------
>
> or redirect everyone to https:
> ----------------------------------
> Listen http://*:80
> Listen https://*:443
>
> <VirtualHost *:443>
> ServerName xxx.yyy
> RedirectPermanentFrom 80
> ...
> </VirtualHost>
I am not keen on the syntax because we already permit multiple
addresses in the VirtualHost tag.
How about e.g.
<virtualhost *:80 *:443>
# no protocol
ServerName example.com
# repurpose "optional" or pick something new
SSLEgine optional
# Extend SSLRequireSSL. no-arg is deny. Default w/ "redirect" is
80, 443. For redirects, may need to not match TCP listening port
SSLRequireSSL ["redirect" [ from-port to-port ]]
</virtualhost>