You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by frank picabia <fp...@gmail.com> on 2022/05/18 19:20:55 UTC

[users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

We have a server with over 300 vhosts on it.  Marketing/CMS madness I guess.
All on the same domain name.  Many VirtualHosts are defined with *:443
and then ServerName to rely on SNI.
We have a wildcard cert for the domain and all the hosts use that.

Now there is a different domain to add for SSL.  For some reason
the first domain name's certificate is being found.  I've put the
IP for our new comer domain so we have <VirtualHost 1.1.1.1:443 >
but it is still finding the other cert.  This IP is uniquely assigned
with the different domain, as you'd expect with DNS.  So it can't
be a overlap of the IP used elsewhere.

Researching this problem ("wrong cert loaded for vhost"),
I read that in the initial SSL connection, it
is talking to the IP, and whatever values we have for ServerName
have no bearing until the page is being accessed.  If that's the case
then it might have matched another vhost with *:443 first
I tried putting my new domain at the top of ssl.conf but it made no
difference.

I'm thinking I need to edit each *:443 case and change it to the
appropriate IP.
That will be a lot of work, so I'm looking for affirmation that is likely
to make the difference.

Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by "Paul Kudla (SCOM.CA Internet Services Inc.)" <pa...@scom.ca>.
ok this is starting to make more sense as we go along ....

I went through all of this myself when setting up origionally

i found that i can not use vhosts easily with ssl / sni / sans etc

and san is a nightmare to manage everytime you make a cert change.

it was just more reliable to use individual config entries and sni and 
proper certs for the domain.

also note certrs today handle the domain.com & www.domain.com in one 
cert (or apache - never really did figure that out)

basically domain.com handles both with the ServerAlias


also (why i forgot about it) vhosts allows users to criss cross 
directories data wise (ie all rights are users www:www) which is why i 
went away from that type of config.

unless this has changed i ended up dumping vhosts config and went with 
individual config entries per website.


examples below using *:80 & *:443 respectively

<VirtualHost *:80>
ServerName underconstruction.scom.ca
ServerAlias underconstruction.scom.ca
DocumentRoot /www/underconstruction.scom.ca
</VirtualHost>

<VirtualHost *:443>
ServerName underconstruction.scom.ca
ServerAlias underconstruction.scom.ca
DocumentRoot /www/underconstruction.scom.ca
SSLEngine on
SSLProtocol all
SSLCertificateKeyFile /www/scom.ca/ssl/scom.ca.key
SSLCertificateFile /www/scom.ca/ssl/scom.ca.crt
SSLCertificateChainFile /www/scom.ca/ssl/scom.ca.chain
</VirtualHost>

I know its long and drawn out in the config file which is why i wrote a 
python script against a pgsql database to generate my config but IT DOES 
WORK!


a better example (more secure) - this keeps all php scripts and users 
from bleeding into other user directories. This is how onetoone, myself 
and a bunch of other providers got hacked a few years back.

Mainly due to wordpress security issues.

vhosts is convient but not super secure.

<VirtualHost *:80>
ServerName video.guelph.eks.scom.ca
ServerAlias video.guelph.eks.scom.ca
DocumentRoot /www/video.guelph.eks.scom.ca


SuexecUserGroup www www

<Directory "/www/video.guelph.eks.scom.ca/wp-content/uploads/">
<Files "*.php">
Order Deny,Allow
Deny from All
</Files>
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value open_basedir /www/video.guelph.eks.scom.ca:/var/log/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value sys_temp_dir /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value session.save_path /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value soap.wsdl_cache_dir /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value upload_tmp_dir /www/video.guelph.eks.scom.ca/tmp
</Directory>

<Directory "/www/video.guelph.eks.scom.ca">
AllowOverride All
php_value session.save_path "/www/video.guelph.eks.scom.ca/"
</Directory>

</VirtualHost>


&

<VirtualHost *:443>
ServerName video.guelph.eks.scom.ca
ServerAlias video.guelph.eks.scom.ca
DocumentRoot /www/video.guelph.eks.scom.ca


SuexecUserGroup www www

<Directory "/www/video.guelph.eks.scom.ca/wp-content/uploads/">
<Files "*.php">
Order Deny,Allow
Deny from All
</Files>
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value open_basedir /www/video.guelph.eks.scom.ca:/var/log/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value sys_temp_dir /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value session.save_path /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value soap.wsdl_cache_dir /www/video.guelph.eks.scom.ca/tmp/
</Directory>

<Directory /www/video.guelph.eks.scom.ca>
php_admin_value upload_tmp_dir /www/video.guelph.eks.scom.ca/tmp
</Directory>

<Directory "/www/video.guelph.eks.scom.ca">
AllowOverride All
php_value session.save_path "/www/video.guelph.eks.scom.ca/"
</Directory>

SSLEngine on
SSLProtocol all
SSLCertificateKeyFile /www/scom.ca/ssl/scom.ca.key
SSLCertificateFile /www/scom.ca/ssl/scom.ca.crt
SSLCertificateChainFile /www/scom.ca/ssl/scom.ca.chain

</VirtualHost>

Note I have a wildcard ssl cert but the file location setup is clearly 
defined.



Happy Thursday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266

On 5/19/2022 9:11 AM, Rainer Canavan wrote:
> 
> On Wed, May 18, 2022 at 11:53 PM Frank Gingras <th...@apache.org> wrote:
>>
>> Not sure if you saw the other answer on the other email:
>>
>> // If you can't use a SAN, then you need to configure all your vhosts as IP:443, whereas one vhost uses a separate IP, and the remainder uses the second IP.
> 
> That sounds wrong to me. Apache should pick a matching certificate for
> the hostname specified via SNI by the client, if any, or the first one
> configured as a fallback (assuming the vhost IP / * specification
> matches). Note that only vhosts with IP:port are considered, if any
> are specified and match the request. You should be able to use *:443
> for all vhosts.
> 
> Rainer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by Rainer Canavan <ra...@avenga.com.INVALID>.
On Wed, May 18, 2022 at 11:53 PM Frank Gingras <th...@apache.org> wrote:
>
> Not sure if you saw the other answer on the other email:
>
> // If you can't use a SAN, then you need to configure all your vhosts as IP:443, whereas one vhost uses a separate IP, and the remainder uses the second IP.

That sounds wrong to me. Apache should pick a matching certificate for
the hostname specified via SNI by the client, if any, or the first one
configured as a fallback (assuming the vhost IP / * specification
matches). Note that only vhosts with IP:port are considered, if any
are specified and match the request. You should be able to use *:443
for all vhosts.

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by frank picabia <fp...@gmail.com>.
Ok thanks.  We've gotten away with the *:443 shorthand for a long time
because
no one wanted to pony up the money for a cert for the other handful of
hobby domains.

On Wed, May 18, 2022 at 6:54 PM Frank Gingras <th...@apache.org> wrote:

> Not sure if you saw the other answer on the other email:
>
> // If you can't use a SAN, then you need to configure all your vhosts as
> IP:443, whereas one vhost uses a separate IP, and the remainder uses the
> second IP.
>
> On Wed, 18 May 2022 at 17:26, frank picabia <fp...@gmail.com> wrote:
>
>> Sorry, different domain.
>>
>> 300 hosts like *.example1.com
>> and now we have 1 example2.com
>>
>>
>> On Wed, May 18, 2022 at 4:31 PM Frank Gingras <th...@apache.org> wrote:
>>
>>> See if you can add a SAN to that wildcard certificate first.
>>>
>>> On Wed, 18 May 2022 at 15:21, frank picabia <fp...@gmail.com> wrote:
>>>
>>>>
>>>> We have a server with over 300 vhosts on it.  Marketing/CMS madness I
>>>> guess.
>>>> All on the same domain name.  Many VirtualHosts are defined with *:443
>>>> and then ServerName to rely on SNI.
>>>> We have a wildcard cert for the domain and all the hosts use that.
>>>>
>>>> Now there is a different domain to add for SSL.  For some reason
>>>> the first domain name's certificate is being found.  I've put the
>>>> IP for our new comer domain so we have <VirtualHost 1.1.1.1:443 >
>>>> but it is still finding the other cert.  This IP is uniquely assigned
>>>> with the different domain, as you'd expect with DNS.  So it can't
>>>> be a overlap of the IP used elsewhere.
>>>>
>>>> Researching this problem ("wrong cert loaded for vhost"),
>>>> I read that in the initial SSL connection, it
>>>> is talking to the IP, and whatever values we have for ServerName
>>>> have no bearing until the page is being accessed.  If that's the case
>>>> then it might have matched another vhost with *:443 first
>>>> I tried putting my new domain at the top of ssl.conf but it made no
>>>> difference.
>>>>
>>>> I'm thinking I need to edit each *:443 case and change it to the
>>>> appropriate IP.
>>>> That will be a lot of work, so I'm looking for affirmation that is
>>>> likely to make the difference.
>>>>
>>>>
>>>>

Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by Frank Gingras <th...@apache.org>.
Not sure if you saw the other answer on the other email:

// If you can't use a SAN, then you need to configure all your vhosts as
IP:443, whereas one vhost uses a separate IP, and the remainder uses the
second IP.

On Wed, 18 May 2022 at 17:26, frank picabia <fp...@gmail.com> wrote:

> Sorry, different domain.
>
> 300 hosts like *.example1.com
> and now we have 1 example2.com
>
>
> On Wed, May 18, 2022 at 4:31 PM Frank Gingras <th...@apache.org> wrote:
>
>> See if you can add a SAN to that wildcard certificate first.
>>
>> On Wed, 18 May 2022 at 15:21, frank picabia <fp...@gmail.com> wrote:
>>
>>>
>>> We have a server with over 300 vhosts on it.  Marketing/CMS madness I
>>> guess.
>>> All on the same domain name.  Many VirtualHosts are defined with *:443
>>> and then ServerName to rely on SNI.
>>> We have a wildcard cert for the domain and all the hosts use that.
>>>
>>> Now there is a different domain to add for SSL.  For some reason
>>> the first domain name's certificate is being found.  I've put the
>>> IP for our new comer domain so we have <VirtualHost 1.1.1.1:443 >
>>> but it is still finding the other cert.  This IP is uniquely assigned
>>> with the different domain, as you'd expect with DNS.  So it can't
>>> be a overlap of the IP used elsewhere.
>>>
>>> Researching this problem ("wrong cert loaded for vhost"),
>>> I read that in the initial SSL connection, it
>>> is talking to the IP, and whatever values we have for ServerName
>>> have no bearing until the page is being accessed.  If that's the case
>>> then it might have matched another vhost with *:443 first
>>> I tried putting my new domain at the top of ssl.conf but it made no
>>> difference.
>>>
>>> I'm thinking I need to edit each *:443 case and change it to the
>>> appropriate IP.
>>> That will be a lot of work, so I'm looking for affirmation that is
>>> likely to make the difference.
>>>
>>>
>>>

[users@httpd] Re: {Disarmed} Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by "Paul Kudla (SCOM.CA Internet Services Inc.)" <pa...@scom.ca>.
you need to  set the cert files per virtual domain

example :

<VirtualHost *:443>
ServerName underconstruction.scom.ca
ServerAlias underconstruction.scom.ca
DocumentRoot /www/underconstruction.scom.ca
SSLEngine on
SSLProtocol all
SSLCertificateKeyFile /www/scom.ca/ssl/scom.ca.key
SSLCertificateFile /www/scom.ca/ssl/scom.ca.crt
SSLCertificateChainFile /www/scom.ca/ssl/scom.ca.chain
</VirtualHost>


<VirtualHost *:443>
ServerName ekst.ca
ServerAlias ekst.ca
ServerAlias www.ekst.ca
DocumentRoot /www/ekst.ca

SSLEngine on
SSLProtocol all
SSLCertificateFile /www/ekst.ca/ssl/ekst.ca.crt
SSLCertificateKeyFile /www/ekst.ca/ssl/ekst.ca.key
SSLCertificateChainFile /www/ekst.ca/ssl/ekst.ca.chain
</VirtualHost>





Happy Wednesday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266

On 5/18/2022 5:26 PM, frank picabia wrote:
> Sorry, different domain.
> 
> 300 hosts like *.example1.com <http://example1.com>
> and now we have 1 example2.com <http://example2.com>
> 
> 
> On Wed, May 18, 2022 at 4:31 PM Frank Gingras <thumbs@apache.org 
> <ma...@apache.org>> wrote:
> 
>     See if you can add a SAN to that wildcard certificate first.
> 
>     On Wed, 18 May 2022 at 15:21, frank picabia <fpicabia@gmail.com
>     <ma...@gmail.com>> wrote:
> 
> 
>         We have a server with over 300 vhosts on it.  Marketing/CMS
>         madness I guess.
>         All on the same domain name.  Many VirtualHosts are defined with
>         *:443
>         and then ServerName to rely on SNI.
>         We have a wildcard cert for the domain and all the hosts use that.
> 
>         Now there is a different domain to add for SSL.  For some reason
>         the first domain name's certificate is being found.  I've put the
>         IP for our new comer domain so we have <VirtualHost *MailScanner
>         warning: numerical links are often malicious:* 1.1.1.1:443
>         <http://1.1.1.1:443> >
>         but it is still finding the other cert.  This IP is uniquely
>         assigned
>         with the different domain, as you'd expect with DNS.  So it can't
>         be a overlap of the IP used elsewhere.
> 
>         Researching this problem ("wrong cert loaded for vhost"),
>         I read that in the initial SSL connection, it
>         is talking to the IP, and whatever values we have for ServerName
>         have no bearing until the page is being accessed.  If that's the
>         case
>         then it might have matched another vhost with *:443 first
>         I tried putting my new domain at the top of ssl.conf but it made
>         no difference.
> 
>         I'm thinking I need to edit each *:443 case and change it to the
>         appropriate IP.
>         That will be a lot of work, so I'm looking for affirmation that
>         is likely to make the difference.
> 
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by frank picabia <fp...@gmail.com>.
Sorry, different domain.

300 hosts like *.example1.com
and now we have 1 example2.com


On Wed, May 18, 2022 at 4:31 PM Frank Gingras <th...@apache.org> wrote:

> See if you can add a SAN to that wildcard certificate first.
>
> On Wed, 18 May 2022 at 15:21, frank picabia <fp...@gmail.com> wrote:
>
>>
>> We have a server with over 300 vhosts on it.  Marketing/CMS madness I
>> guess.
>> All on the same domain name.  Many VirtualHosts are defined with *:443
>> and then ServerName to rely on SNI.
>> We have a wildcard cert for the domain and all the hosts use that.
>>
>> Now there is a different domain to add for SSL.  For some reason
>> the first domain name's certificate is being found.  I've put the
>> IP for our new comer domain so we have <VirtualHost 1.1.1.1:443 >
>> but it is still finding the other cert.  This IP is uniquely assigned
>> with the different domain, as you'd expect with DNS.  So it can't
>> be a overlap of the IP used elsewhere.
>>
>> Researching this problem ("wrong cert loaded for vhost"),
>> I read that in the initial SSL connection, it
>> is talking to the IP, and whatever values we have for ServerName
>> have no bearing until the page is being accessed.  If that's the case
>> then it might have matched another vhost with *:443 first
>> I tried putting my new domain at the top of ssl.conf but it made no
>> difference.
>>
>> I'm thinking I need to edit each *:443 case and change it to the
>> appropriate IP.
>> That will be a lot of work, so I'm looking for affirmation that is likely
>> to make the difference.
>>
>>
>>

Re: [users@httpd] Re: {Disarmed} Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by Frank Gingras <th...@apache.org>.
That does not look like valid httpd syntax.

If you can't use a SAN, then you need to configure all your vhosts as
IP:443, whereas one vhost uses a separate IP, and the remainder uses the
second IP.

On Wed, 18 May 2022 at 17:02, Paul Kudla (SCOM.CA Internet Services Inc.) <
paul@scom.ca> wrote:

>
> ok san is only useable if the cert is setup that way
>
> i bought a proper *.scom.ca wildcard ssl cert for my domain
>
> i then buy mail.xxx.com certs for the other domains
>
> sni works well when configured this way.
>
> granted san might or might not work (i never tries that) however san was
> designed more for apache web servers vs email etc
>
> san does allow adding domains but i more complicated to control what the
> cert is doing (or not)
>
> sound like what i did will work better for you situation
>
> example sni.conf file (import this at the end of your main dovecot.conf
> file
>
> using :
>
> #Addition ssl config
> !include sni.conf
>
> please note that below i wront a python script to pull the cert from a
> db table
>
> getssl.cert
>
> all it does it return the text for the ssl cert (key first then
> certificate then both Intermediate certs)
>
> you can point this to an ssl key file (the old way) formatted the same
>
> either will work
>
> note you need both the default cert setup AND the local name as well
>
> a *. signifies a wildcard ssl cert
>
> like *.scom.ca
>
> note you need to do something similiar in postfix as well for this to
> work across smtp + dovecot
>
>
>
>
> # cat sni.conf
> #sni.conf
> ssl = yes
> verbose_ssl = yes
> ssl_dh =</usr/local/etc/dovecot/dh-4096.pem
> ssl_prefer_server_ciphers = yes
> #ssl_min_protocol = TLSv1.2
>
> #Default *.scom.ca
> ssl_key =</usr/local/etc/dovecot/scom.pem
> ssl_cert =</usr/local/etc/dovecot/scom.pem
> ssl_ca =</usr/local/etc/dovecot/scom.pem
>
> local_name .scom.ca {
>    ssl_key = /programs/common/getssl.cert -c *.scom.ca -q yes
>    ssl_cert = /programs/common/getssl.cert -c *.scom.ca -q yes
>    ssl_ca = /programs/common/getssl.cert -c *.scom.ca -q yes
> }
>
>
> local_name mail.clancyca.com {
>    ssl_key = /programs/common/getssl.cert -c mail.clancyca.com -q yes
>    ssl_cert = /programs/common/getssl.cert -c mail.clancyca.com -q yes
>    ssl_ca = /programs/common/getssl.cert -c mail.clancyca.com -q yes
> }
>
> local_name secure.clancyca.com {
>    ssl_key = /programs/common/getssl.cert -c secure.clancyca.com -q yes
>    ssl_cert = /programs/common/getssl.cert -c secure.clancyca.com -q yes
>    ssl_ca = /programs/common/getssl.cert -c secure.clancyca.com -q yes
> }
>
> local_name mail.paulkudla.net {
>    ssl_key = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
>    ssl_cert = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
>    ssl_ca = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
> }
>
> local_name mail.ekst.ca {
>    ssl_key = /programs/common/getssl.cert -c mail.ekst.ca -q yes
>    ssl_cert = /programs/common/getssl.cert -c mail.ekst.ca -q yes
>    ssl_ca = /programs/common/getssl.cert -c mail.ekst.ca -q yes
> }
>
> local_name mail.hamletdevelopments.ca {
>    ssl_key = /programs/common/getssl.cert -c mail.hamletdevelopments.ca
> -q yes
>    ssl_cert = /programs/common/getssl.cert -c mail.hamletdevelopments.ca
> -q yes
>    ssl_ca = /programs/common/getssl.cert -c mail.hamletdevelopments.ca
> -q yes
> }
>
>
>
>
> Happy Wednesday !!!
> Thanks - paul
>
> Paul Kudla
>
>
> Scom.ca Internet Services <http://www.scom.ca>
> 004-1009 Byron Street South
> Whitby, Ontario - Canada
> L1N 4S3
>
> Toronto 416.642.7266
> Main 1.866.411.7266
> Fax 1.888.892.7266
>
> On 5/18/2022 3:31 PM, Frank Gingras wrote:
> > See if you can add a SAN to that wildcard certificate first.
> >
> > On Wed, 18 May 2022 at 15:21, frank picabia <fpicabia@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >
> >     We have a server with over 300 vhosts on it.  Marketing/CMS madness
> >     I guess.
> >     All on the same domain name.  Many VirtualHosts are defined with
> *:443
> >     and then ServerName to rely on SNI.
> >     We have a wildcard cert for the domain and all the hosts use that.
> >
> >     Now there is a different domain to add for SSL.  For some reason
> >     the first domain name's certificate is being found.  I've put the
> >     IP for our new comer domain so we have <VirtualHost *MailScanner
> >     warning: numerical links are often malicious:* 1.1.1.1:443
> >     <http://1.1.1.1:443> >
> >     but it is still finding the other cert.  This IP is uniquely assigned
> >     with the different domain, as you'd expect with DNS.  So it can't
> >     be a overlap of the IP used elsewhere.
> >
> >     Researching this problem ("wrong cert loaded for vhost"),
> >     I read that in the initial SSL connection, it
> >     is talking to the IP, and whatever values we have for ServerName
> >     have no bearing until the page is being accessed.  If that's the case
> >     then it might have matched another vhost with *:443 first
> >     I tried putting my new domain at the top of ssl.conf but it made no
> >     difference.
> >
> >     I'm thinking I need to edit each *:443 case and change it to the
> >     appropriate IP.
> >     That will be a lot of work, so I'm looking for affirmation that is
> >     likely to make the difference.
> >
> >
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by *MailScanner* <http://www.mailscanner.info/>, and
> is
> > believed to be clean.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

[users@httpd] Re: {Disarmed} Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by "Paul Kudla (SCOM.CA Internet Services Inc.)" <pa...@scom.ca>.
ok san is only useable if the cert is setup that way

i bought a proper *.scom.ca wildcard ssl cert for my domain

i then buy mail.xxx.com certs for the other domains

sni works well when configured this way.

granted san might or might not work (i never tries that) however san was 
designed more for apache web servers vs email etc

san does allow adding domains but i more complicated to control what the 
cert is doing (or not)

sound like what i did will work better for you situation

example sni.conf file (import this at the end of your main dovecot.conf file

using :

#Addition ssl config
!include sni.conf

please note that below i wront a python script to pull the cert from a 
db table

getssl.cert

all it does it return the text for the ssl cert (key first then 
certificate then both Intermediate certs)

you can point this to an ssl key file (the old way) formatted the same

either will work

note you need both the default cert setup AND the local name as well

a *. signifies a wildcard ssl cert

like *.scom.ca

note you need to do something similiar in postfix as well for this to 
work across smtp + dovecot




# cat sni.conf
#sni.conf
ssl = yes
verbose_ssl = yes
ssl_dh =</usr/local/etc/dovecot/dh-4096.pem
ssl_prefer_server_ciphers = yes
#ssl_min_protocol = TLSv1.2

#Default *.scom.ca
ssl_key =</usr/local/etc/dovecot/scom.pem
ssl_cert =</usr/local/etc/dovecot/scom.pem
ssl_ca =</usr/local/etc/dovecot/scom.pem

local_name .scom.ca {
   ssl_key = /programs/common/getssl.cert -c *.scom.ca -q yes
   ssl_cert = /programs/common/getssl.cert -c *.scom.ca -q yes
   ssl_ca = /programs/common/getssl.cert -c *.scom.ca -q yes
}


local_name mail.clancyca.com {
   ssl_key = /programs/common/getssl.cert -c mail.clancyca.com -q yes
   ssl_cert = /programs/common/getssl.cert -c mail.clancyca.com -q yes
   ssl_ca = /programs/common/getssl.cert -c mail.clancyca.com -q yes
}

local_name secure.clancyca.com {
   ssl_key = /programs/common/getssl.cert -c secure.clancyca.com -q yes
   ssl_cert = /programs/common/getssl.cert -c secure.clancyca.com -q yes
   ssl_ca = /programs/common/getssl.cert -c secure.clancyca.com -q yes
}

local_name mail.paulkudla.net {
   ssl_key = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
   ssl_cert = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
   ssl_ca = /programs/common/getssl.cert -c mail.paulkudla.net -q yes
}

local_name mail.ekst.ca {
   ssl_key = /programs/common/getssl.cert -c mail.ekst.ca -q yes
   ssl_cert = /programs/common/getssl.cert -c mail.ekst.ca -q yes
   ssl_ca = /programs/common/getssl.cert -c mail.ekst.ca -q yes
}

local_name mail.hamletdevelopments.ca {
   ssl_key = /programs/common/getssl.cert -c mail.hamletdevelopments.ca 
-q yes
   ssl_cert = /programs/common/getssl.cert -c mail.hamletdevelopments.ca 
-q yes
   ssl_ca = /programs/common/getssl.cert -c mail.hamletdevelopments.ca 
-q yes
}




Happy Wednesday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266

On 5/18/2022 3:31 PM, Frank Gingras wrote:
> See if you can add a SAN to that wildcard certificate first.
> 
> On Wed, 18 May 2022 at 15:21, frank picabia <fpicabia@gmail.com 
> <ma...@gmail.com>> wrote:
> 
> 
>     We have a server with over 300 vhosts on it.  Marketing/CMS madness
>     I guess.
>     All on the same domain name.  Many VirtualHosts are defined with *:443
>     and then ServerName to rely on SNI.
>     We have a wildcard cert for the domain and all the hosts use that.
> 
>     Now there is a different domain to add for SSL.  For some reason
>     the first domain name's certificate is being found.  I've put the
>     IP for our new comer domain so we have <VirtualHost *MailScanner
>     warning: numerical links are often malicious:* 1.1.1.1:443
>     <http://1.1.1.1:443> >
>     but it is still finding the other cert.  This IP is uniquely assigned
>     with the different domain, as you'd expect with DNS.  So it can't
>     be a overlap of the IP used elsewhere.
> 
>     Researching this problem ("wrong cert loaded for vhost"),
>     I read that in the initial SSL connection, it
>     is talking to the IP, and whatever values we have for ServerName
>     have no bearing until the page is being accessed.  If that's the case
>     then it might have matched another vhost with *:443 first
>     I tried putting my new domain at the top of ssl.conf but it made no
>     difference.
> 
>     I'm thinking I need to edit each *:443 case and change it to the
>     appropriate IP.
>     That will be a lot of work, so I'm looking for affirmation that is
>     likely to make the difference.
> 
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Multi-domain with SSL - Virtualhost all need IPs?

Posted by Frank Gingras <th...@apache.org>.
See if you can add a SAN to that wildcard certificate first.

On Wed, 18 May 2022 at 15:21, frank picabia <fp...@gmail.com> wrote:

>
> We have a server with over 300 vhosts on it.  Marketing/CMS madness I
> guess.
> All on the same domain name.  Many VirtualHosts are defined with *:443
> and then ServerName to rely on SNI.
> We have a wildcard cert for the domain and all the hosts use that.
>
> Now there is a different domain to add for SSL.  For some reason
> the first domain name's certificate is being found.  I've put the
> IP for our new comer domain so we have <VirtualHost 1.1.1.1:443 >
> but it is still finding the other cert.  This IP is uniquely assigned
> with the different domain, as you'd expect with DNS.  So it can't
> be a overlap of the IP used elsewhere.
>
> Researching this problem ("wrong cert loaded for vhost"),
> I read that in the initial SSL connection, it
> is talking to the IP, and whatever values we have for ServerName
> have no bearing until the page is being accessed.  If that's the case
> then it might have matched another vhost with *:443 first
> I tried putting my new domain at the top of ssl.conf but it made no
> difference.
>
> I'm thinking I need to edit each *:443 case and change it to the
> appropriate IP.
> That will be a lot of work, so I'm looking for affirmation that is likely
> to make the difference.
>
>
>

[users@httpd] Re: {Disarmed} Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by "Paul Kudla (SCOM.CA Internet Services Inc.)" <pa...@scom.ca>.
Ok to clarify (this is standard apache from day one moving from 
convential SSL certs towards SNI used today)


# 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 80
#Listen 443


the above will specify the listening address / port

by default this is ALL ip's on ALL interfaces (ie no Listen ip statement 
specified)

and is designated by * when setting up a host entry

*:80 means normal httpd port on ALL avaliable ip's either specified 
above or if NO Listen statement then ALL interfaces will Listen.

*:443 means normal ssl port on ALL avaliable ip's either specified above 
or if NO Listen statement then ALL interfaces will Listen.


1.1.1.1:443 (for example) means non standard ip listen address (this is 
typically NEVER used anymore)

so what ever you tell apache to listen on by default or otherwise "*" 
means exactly that ALL INTERFACES SPECIFIED.


when using sni you MUST specify a seperate VirtualHost (NOT VHOSTS)

<VirtualHost *:80>
ServerName underconstruction.scom.ca
ServerAlias underconstruction.scom.ca
DocumentRoot /www/underconstruction.scom.ca
</VirtualHost>

<VirtualHost *:443>
ServerName underconstruction.scom.ca
ServerAlias underconstruction.scom.ca
DocumentRoot /www/underconstruction.scom.ca
SSLEngine on
SSLProtocol all
SSLCertificateKeyFile /www/scom.ca/ssl/scom.ca.key
SSLCertificateFile /www/scom.ca/ssl/scom.ca.crt
SSLCertificateChainFile /www/scom.ca/ssl/scom.ca.chain
</VirtualHost>


sni will pickup on the servername and then comapre the associated ssl 
cert as specified by the file location.

also note proper certs today get registered as the domain ie in this 
case scom.ca with also allow www.scom.ca (ServerAlias above) but nothing 
else (unless you have a wildcard)


this is all there is to it

notes :

ip addresses used to be assigned before the sni days, meaning that ssl 
only ran on one ip address and one certificate per server instance

which is why you needed 16 ipaddress to host 16 different ssl certificates.

sni was invented because ipv4 addresses are running out (aka most 
upstream providers will not alot ip's for this useage anymore)

and most hosts run multiple domains names etc so sni is just simply more 
efficent.


Note when building

Prerequisites to use SNI

Use OpenSSL 0.9.8f or later

Build OpenSSL with the TLS Extensions option enabled (option 
enable-tlsext; OpenSSL 0.9.8k and later has this enabled by default).

Apache must have been built with that OpenSSL (./configure 
--with-ssl=/path/to/your/openssl). In that case, mod_ssl will 
automatically detect the availability of the TLS extensions and support SNI.

Apache must use that OpenSSL at run-time, which might require setting 
LD_LIBRARY_PATH or equivalent to point to that OpenSSL, maybe in 
bin/envvars. (You'll get unresolved symbol errors at Apache startup if 
Apache was built with SNI but isn't finding the right openssl libraries 
at run-time.)

Also i founs that the

Include apache2/conf/extra/httpd-ssl.conf

had to be modified not to use ssl certs by default (as they get 
specified in the Virtual Hosts statement.

Hope this is a better explanation and clarifies the confusion happening 
below ?



Happy Saturday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266

On 5/20/2022 6:00 PM, Frank Gingras wrote:
> Charles,
> 
> No, you are completely incorrect. You should never define vhosts as 
> <host>:<port>.
> 
> On Fri, 20 May 2022 at 13:09, Yehuda Katz <yehuda@ymkatz.net 
> <ma...@ymkatz.net>> wrote:
> 
>     That is not correct. That causes httpd to try to look up the
>     matching IP address using DNS. Use only IP addresses or wildcards.
> 
>     - Y
> 
>     On Fri, May 20, 2022 at 1:06 PM Bender, Charles
>     <ch...@beachcamera.com.invalid> wrote:
> 
>         Your virtual host is defined wrong. Use the names not IP addresses
> 
>         <VirtualHostexample2.com <http://example2.com>*MailScanner has
>         detected a possible fraud attempt from "1.1.1.13:443" claiming
>         to be* :443 <http://1.1.1.13:443/>>
>         Servername*MailScanner has detected a possible fraud attempt
>         from "linkprotect.cudasvc.com" claiming to be* example2.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
>         SSLEngine on
>         SSLCertificateFile /etc/http/certs/example2.crt
>         ...
>         </VirtualHost>
>         ------------------------------------------------------------------------
>         *From:* frank picabia <fpicabia@gmail.com
>         <ma...@gmail.com>>
>         *Sent:* Friday, May 20, 2022 12:55 PM
>         *To:* users@httpd.apache.org <ma...@httpd.apache.org>
>         <users@httpd.apache.org <ma...@httpd.apache.org>>
>         *Subject:* Re: [users@httpd] Re: Multi-domain with SSL -
>         Virtualhost all need IPs?
>         I'm trying hard to get the lay of the land logic here, and it
>         isn't happening.  I'm bouncing between what I read here,
>         and what apache actually does, and it doesn't add up.
> 
>         In my case we tried to introduce a new domain, let's call it
>         *MailScanner has detected a possible fraud attempt from
>         "linkprotect.cudasvc.com" claiming to be* example2.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,6W_vM4KZBARFuk6DDpPWoNW12LzjGIFV8FRTADGmecW5MGLigif3cCg9i_upqN6olj_Qr7kWBGqNJu2EXeP8QeUVkPmMk1TYwQ1pcBTxx32XgAlhuKEDKcpL&typo=1>
>         It will have a different set of cert files.  I let it have an IP
>         which nothing else shares.
>         I'm keenly aware of this IP as I've set it up in DNS as well.
> 
>         <VirtualHost *MailScanner warning: numerical links are often
>         malicious:* 1.1.1.13:443 <http://1.1.1.13:443>>
>         Servername *MailScanner has detected a possible fraud attempt
>         from "linkprotect.cudasvc.com" claiming to be* example2.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
>         SSLEngine on
>         SSLCertificateFile /etc/http/certs/example2.crt
>         ...
>         </VirtualHost>
> 
>         Every other vhost had a different servername, and they used the
>         cert for *MailScanner has detected a possible fraud attempt from
>         "linkprotect.cudasvc.com" claiming to be* example1.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,hWtAIAcngoqDN67tYYh-JBMRsDu0loXxcOnLFfiTh0kkC73FcXss_uAVRLOtoJLqXOCEN9jyzjXqVBcPyZW7t70FdDG9MVq19wuX_0SAFBLk7qkKRSlWDw,,&typo=1>
>         .  They also had *:443
>         Only for *MailScanner has detected a possible fraud attempt from
>         "linkprotect.cudasvc.com" claiming to be* example1.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,0PHWaifn8IWmWbVOrikm7fz8IiJtabA_5-R1x0XKMlFFo3oBud94pi8En8RPBR3KLTR3QenHwFjS7HQgJNY1qG-nQe_UmNGE2X8vrXjghYl5KQ,,&typo=1>
>         do we have multiple aliases on the same IP.
> 
>         When visiting the *MailScanner has detected a possible fraud
>         attempt from "linkprotect.cudasvc.com" claiming to be*
>         example2.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,QZFYnaarDKwbI4UIuis6AUVr6M_IY5nT64iVqhrFOfC1SFad9Dq-LeBk2Prq7-LyNrzbvo_FfMN1PezvDeICv0bWAkLH1rCsEqr9d-W4KMjU_tMJ5hg,&typo=1>
>         site, the web site shows apache has served a certificate for
>         *MailScanner has detected a possible fraud attempt from
>         "linkprotect.cudasvc.com" claiming to be* example1.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,T_cQOb_HmAeeARzztUhUpYrFdC-M2k8aEzqZWhQryiy784g3BQNmtSe51GNCXcXQIbgEUbfPVEl5zdNv7G3-cgN_D5iSOe-t-0dOr8s9Ogm_ZwvXlaaXXQJDP78,&typo=1>
> 
>         I had believed this was because we had used *:443 rather than
>         explicitly show the IP
>         for all our vhosts.  It seemed the early conversation on SSL/TLS
>         was matching a random
>         vhost via this use of *:443 and that's how it got the cert for
>         *MailScanner has detected a possible fraud attempt from
>         "linkprotect.cudasvc.com" claiming to be* example1.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,Mz11UTCKtiWcGt6Y8IkJjBHQLSOD5JkAKituHpPrZu5-qa6kZmzAj0yKhiovnyiw6bX333zd9IKH73D6x3DQsfQOvC7ztgVXyiO7EUHWBXHjoys4q30,&typo=1>
>         Since before this point all vhosts were on *MailScanner has
>         detected a possible fraud attempt from "linkprotect.cudasvc.com"
>         claiming to be* example1.com
>         <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,8wXSzKIRaGVigrHUZoxWD8812IQ1_5RSU52jRZYKX7BQPnCQrAcHUwhw_BOV_E5zA1jMdtUHbqCd9jwXZ8HLFcDM7HcYG31scrYTMuAWMw,,&typo=1>
>         the wildcard cert it
>         found was always working while we had *:443 in use.
> 
>         What can we say about how multi-domain SSL works that we can
>         rely on?
>         I can find a dozen pages on google search from people who get
>         the wrong
>         certificate and they never get an answer.  Some good hard rules
>         on what
>         is required would probably help a lot of people over the years.
> 
> 
> 
>         On Fri, May 20, 2022 at 11:59 AM Frank Gingras
>         <thumbs@apache.org <ma...@apache.org>> wrote:
> 
>             As mentioned, name-based vhosts will work with SNI and *:443
>             provided that you have the correct certificate assigned to
>             each vhost.
> 
>             In rare cases, you can use IP:443 vhosts if you want
>             specific handling based on the IP used to handle the
>             request, such as https://IP1/ <https://IP1/> or https://IP2/
>             <https://IP2/>. However, it is rarely needed by most servers.
> 
>             For now, you can use *:443, and run apachectl -S to make
>             sure there is no overlap before restarting httpd.
> 
>             On Fri, 20 May 2022 at 07:04, frank picabia
>             <fpicabia@gmail.com <ma...@gmail.com>> wrote:
> 
> 
>                 Sorry, that should not have said "top level domains".  I
>                 meant domains.  Like example.com <http://example.com>,
>                 *MailScanner has detected a possible fraud attempt from
>                 "linkprotect.cudasvc.com" claiming to be* example.net
>                 <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample.net&c=E,1,Lf7WCUECY7EjPemnM7RAgRqLA_RtcGdzOib3lOf7AW0vkHA8LZPhA_Cyx4vxm2UkTXZdaO6ax9tCWnAP4NJ8QbZC7d6pFPimkBkaFwrXGA,,&typo=1>.
> 
> 
>                 On Fri, May 20, 2022 at 7:05 AM frank picabia
>                 <fpicabia@gmail.com <ma...@gmail.com>> wrote:
> 
> 
>                     It looks like there are two requirements for
>                     multiple top level domains with SSL
>                     on the same apache.
> 
>                     1. IP values must be used inside VirtualHost, not *:443
>                     2. All IP values must be unique, even on the same
>                     top level domain
> 
>                     Is the above conjecture true?
> 
>                     We have many setup like this example...
> 
>                     <VirtualHost *:443 >
>                         ServerName *MailScanner has detected a possible
>                     fraud attempt from "linkprotect.cudasvc.com"
>                     claiming to be* s1.example1.com
>                     <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,wsz87BMMp2oMlSddl_CqoJGdX4XfnA4SBhZHzfihJZJUFFJolpRBPQ1tm6G08DwlDNVBTcY1p7ZsxfEAtdfJ59gsZRoDVQeNBtWtKHbD&typo=1>
>                     ...
>                     </VirtualHost>
> 
>                     <VirtualHost *:443 >
>                         ServerName *MailScanner has detected a possible
>                     fraud attempt from "linkprotect.cudasvc.com"
>                     claiming to be* s2.example1.com
>                     <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,7pvCP6udZ3aZHoj-a0jz-AgOyf0BqRRLwQMOAtBCbrpGJX7So009M8zSgwIQRUxx3EB6zyyZKInj66oF7Td7UcJqi0h7gBdt_0zI0uL4PwM06AV6AQ,,&typo=1>
>                     ...
>                     </VirtualHost>
> 
>                     where s1 and s2 are aliases on the same IP.  It has
>                     worked like that for years.  330 vhosts on about 80 IPs.
> 
>                     When I started to convert them to use the actual IP
>                     value rather than *
> 
>                     <VirtualHost *MailScanner warning: numerical links
>                     are often malicious:* 1.1.1.1:443 <http://1.1.1.1:443> >
>                         ServerName *MailScanner has detected a possible
>                     fraud attempt from "linkprotect.cudasvc.com"
>                     claiming to be* s1.example1.com
>                     <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,NvBi26pDh9IxdmyKgHLNK4p32Qv1cFQtyVXbIlC9HHOgiLAV95Pz_D8y_lWST789soOsTkxYjzJJJhMaqd4C8KT5RkVYHb73BPZZCPeWlhB7bt3Z6lPIEdWSe3Wd&typo=1>
>                     ...
>                     </VirtualHost>
>                     <VirtualHost *MailScanner warning: numerical links
>                     are often malicious:* 1.1.1.1:443 <http://1.1.1.1:443> >
>                         ServerName *MailScanner has detected a possible
>                     fraud attempt from "linkprotect.cudasvc.com"
>                     claiming to be* s2.example1.com
>                     <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,8X1MRWLchBd0jtI-FkYh2nb2lyg0LtCgOeCkKgkA16Wdz7Q11brpocrr15c9F9_OqRnWEqwExVy6LEiVykh8JwIhtyIlb2Madiz9yfOano0,&typo=1>
>                     ...
>                     </VirtualHost>
> 
>                     This had nothing to do with the *MailScanner has
>                     detected a possible fraud attempt from
>                     "linkprotect.cudasvc.com" claiming to be*
>                     example2.com
>                     <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,ul_Sx0-1ZWGylDIVnZp9Xcqxf0r3cNY7JsJnUxT2ir53quY-0jVC5gTotkqGkJbvAzWE3tNI01fkJt3aoWuCI0MkdIM9ZPWyrJuBGzFiVA,,&typo=1>
>                     I also want to put in there
>                     but on a unique IP.  I did a few conversions from
>                     *:443, saved it and restarted apache.
>                     Then vhosts I had not touched yet were getting pages
>                     for other
>                     vhosts.  It was random chaos and I reverted to the
>                     previous ssl.conf copy
> 
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by Frank Gingras <th...@apache.org>.
Charles,

No, you are completely incorrect. You should never define vhosts as
<host>:<port>.

On Fri, 20 May 2022 at 13:09, Yehuda Katz <ye...@ymkatz.net> wrote:

> That is not correct. That causes httpd to try to look up the matching IP
> address using DNS. Use only IP addresses or wildcards.
>
> - Y
>
> On Fri, May 20, 2022 at 1:06 PM Bender, Charles
> <ch...@beachcamera.com.invalid> wrote:
>
>> Your virtual host is defined wrong. Use the names not IP addresses
>>
>> <VirtualHost example2.com:443 <http://1.1.1.13:443/>>
>> Servername example2.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
>> SSLEngine on
>> SSLCertificateFile /etc/http/certs/example2.crt
>> ...
>> </VirtualHost>
>> ------------------------------
>> *From:* frank picabia <fp...@gmail.com>
>> *Sent:* Friday, May 20, 2022 12:55 PM
>> *To:* users@httpd.apache.org <us...@httpd.apache.org>
>> *Subject:* Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all
>> need IPs?
>>
>> I'm trying hard to get the lay of the land logic here, and it isn't
>> happening.  I'm bouncing between what I read here,
>> and what apache actually does, and it doesn't add up.
>>
>> In my case we tried to introduce a new domain, let's call it example2.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,6W_vM4KZBARFuk6DDpPWoNW12LzjGIFV8FRTADGmecW5MGLigif3cCg9i_upqN6olj_Qr7kWBGqNJu2EXeP8QeUVkPmMk1TYwQ1pcBTxx32XgAlhuKEDKcpL&typo=1>
>> It will have a different set of cert files.  I let it have an IP which
>> nothing else shares.
>> I'm keenly aware of this IP as I've set it up in DNS as well.
>>
>> <VirtualHost 1.1.1.13:443>
>> Servername example2.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
>> SSLEngine on
>> SSLCertificateFile /etc/http/certs/example2.crt
>> ...
>> </VirtualHost>
>>
>> Every other vhost had a different servername, and they used the
>> cert for example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,hWtAIAcngoqDN67tYYh-JBMRsDu0loXxcOnLFfiTh0kkC73FcXss_uAVRLOtoJLqXOCEN9jyzjXqVBcPyZW7t70FdDG9MVq19wuX_0SAFBLk7qkKRSlWDw,,&typo=1>
>> .  They also had *:443
>> Only for example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,0PHWaifn8IWmWbVOrikm7fz8IiJtabA_5-R1x0XKMlFFo3oBud94pi8En8RPBR3KLTR3QenHwFjS7HQgJNY1qG-nQe_UmNGE2X8vrXjghYl5KQ,,&typo=1>
>> do we have multiple aliases on the same IP.
>>
>> When visiting the example2.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,QZFYnaarDKwbI4UIuis6AUVr6M_IY5nT64iVqhrFOfC1SFad9Dq-LeBk2Prq7-LyNrzbvo_FfMN1PezvDeICv0bWAkLH1rCsEqr9d-W4KMjU_tMJ5hg,&typo=1>
>> site, the web site shows apache has served a certificate for example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,T_cQOb_HmAeeARzztUhUpYrFdC-M2k8aEzqZWhQryiy784g3BQNmtSe51GNCXcXQIbgEUbfPVEl5zdNv7G3-cgN_D5iSOe-t-0dOr8s9Ogm_ZwvXlaaXXQJDP78,&typo=1>
>>
>> I had believed this was because we had used *:443 rather than explicitly
>> show the IP
>> for all our vhosts.  It seemed the early conversation on SSL/TLS was
>> matching a random
>> vhost via this use of *:443 and that's how it got the cert for
>> example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,Mz11UTCKtiWcGt6Y8IkJjBHQLSOD5JkAKituHpPrZu5-qa6kZmzAj0yKhiovnyiw6bX333zd9IKH73D6x3DQsfQOvC7ztgVXyiO7EUHWBXHjoys4q30,&typo=1>
>> Since before this point all vhosts were on example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,8wXSzKIRaGVigrHUZoxWD8812IQ1_5RSU52jRZYKX7BQPnCQrAcHUwhw_BOV_E5zA1jMdtUHbqCd9jwXZ8HLFcDM7HcYG31scrYTMuAWMw,,&typo=1>
>> the wildcard cert it
>> found was always working while we had *:443 in use.
>>
>> What can we say about how multi-domain SSL works that we can rely on?
>> I can find a dozen pages on google search from people who get the wrong
>> certificate and they never get an answer.  Some good hard rules on what
>> is required would probably help a lot of people over the years.
>>
>>
>>
>> On Fri, May 20, 2022 at 11:59 AM Frank Gingras <th...@apache.org> wrote:
>>
>> As mentioned, name-based vhosts will work with SNI and *:443 provided
>> that you have the correct certificate assigned to each vhost.
>>
>> In rare cases, you can use IP:443 vhosts if you want specific handling
>> based on the IP used to handle the request, such as https://IP1/ or
>> https://IP2/. However, it is rarely needed by most servers.
>>
>> For now, you can use *:443, and run apachectl -S to make sure there is no
>> overlap before restarting httpd.
>>
>> On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com> wrote:
>>
>>
>> Sorry, that should not have said "top level domains".  I meant domains.
>> Like example.com, example.net
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample.net&c=E,1,Lf7WCUECY7EjPemnM7RAgRqLA_RtcGdzOib3lOf7AW0vkHA8LZPhA_Cyx4vxm2UkTXZdaO6ax9tCWnAP4NJ8QbZC7d6pFPimkBkaFwrXGA,,&typo=1>
>> .
>>
>>
>> On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com> wrote:
>>
>>
>> It looks like there are two requirements for multiple top level domains
>> with SSL
>> on the same apache.
>>
>> 1. IP values must be used inside VirtualHost, not *:443
>> 2. All IP values must be unique, even on the same top level domain
>>
>> Is the above conjecture true?
>>
>> We have many setup like this example...
>>
>> <VirtualHost *:443 >
>>    ServerName s1.example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,wsz87BMMp2oMlSddl_CqoJGdX4XfnA4SBhZHzfihJZJUFFJolpRBPQ1tm6G08DwlDNVBTcY1p7ZsxfEAtdfJ59gsZRoDVQeNBtWtKHbD&typo=1>
>> ...
>> </VirtualHost>
>>
>> <VirtualHost *:443 >
>>    ServerName s2.example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,7pvCP6udZ3aZHoj-a0jz-AgOyf0BqRRLwQMOAtBCbrpGJX7So009M8zSgwIQRUxx3EB6zyyZKInj66oF7Td7UcJqi0h7gBdt_0zI0uL4PwM06AV6AQ,,&typo=1>
>> ...
>> </VirtualHost>
>>
>> where s1 and s2 are aliases on the same IP.  It has worked like that for
>> years.  330 vhosts on about 80 IPs.
>>
>> When I started to convert them to use the actual IP value rather than *
>>
>> <VirtualHost 1.1.1.1:443 >
>>    ServerName s1.example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,NvBi26pDh9IxdmyKgHLNK4p32Qv1cFQtyVXbIlC9HHOgiLAV95Pz_D8y_lWST789soOsTkxYjzJJJhMaqd4C8KT5RkVYHb73BPZZCPeWlhB7bt3Z6lPIEdWSe3Wd&typo=1>
>> ...
>> </VirtualHost>
>> <VirtualHost 1.1.1.1:443 >
>>    ServerName s2.example1.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,8X1MRWLchBd0jtI-FkYh2nb2lyg0LtCgOeCkKgkA16Wdz7Q11brpocrr15c9F9_OqRnWEqwExVy6LEiVykh8JwIhtyIlb2Madiz9yfOano0,&typo=1>
>> ...
>> </VirtualHost>
>>
>> This had nothing to do with the example2.com
>> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,ul_Sx0-1ZWGylDIVnZp9Xcqxf0r3cNY7JsJnUxT2ir53quY-0jVC5gTotkqGkJbvAzWE3tNI01fkJt3aoWuCI0MkdIM9ZPWyrJuBGzFiVA,,&typo=1>
>> I also want to put in there
>> but on a unique IP.  I did a few conversions from *:443, saved it and
>> restarted apache.
>> Then vhosts I had not touched yet were getting pages for other
>> vhosts.  It was random chaos and I reverted to the previous ssl.conf copy
>>
>>
>>

Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by Tom Browder <to...@gmail.com>.
On Fri, May 20, 2022 at 12:09 Yehuda Katz <ye...@ymkatz.net> wrote:

> That is not correct. That causes httpd to try to look up the matching IP
> address using DNS. Use only IP addresses or wildcards.
>

You should try the Apache Macro to see if it might help.

I have used for years  for over a dozen virtual hosts defined by SNI. See
the Apache section on my "config-scripts" module at github
(tbrowder/config-scripts).

Essentially, you use the macro (with args) to define a template for a host.
Then use it with one-line definitions for each host. Finally, undef the
macro.

-Tom

Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by Yehuda Katz <ye...@ymkatz.net>.
That is not correct. That causes httpd to try to look up the matching IP
address using DNS. Use only IP addresses or wildcards.

- Y

On Fri, May 20, 2022 at 1:06 PM Bender, Charles
<ch...@beachcamera.com.invalid> wrote:

> Your virtual host is defined wrong. Use the names not IP addresses
>
> <VirtualHost example2.com:443 <http://1.1.1.13:443/>>
> Servername example2.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
> SSLEngine on
> SSLCertificateFile /etc/http/certs/example2.crt
> ...
> </VirtualHost>
> ------------------------------
> *From:* frank picabia <fp...@gmail.com>
> *Sent:* Friday, May 20, 2022 12:55 PM
> *To:* users@httpd.apache.org <us...@httpd.apache.org>
> *Subject:* Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all
> need IPs?
>
> I'm trying hard to get the lay of the land logic here, and it isn't
> happening.  I'm bouncing between what I read here,
> and what apache actually does, and it doesn't add up.
>
> In my case we tried to introduce a new domain, let's call it example2.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,6W_vM4KZBARFuk6DDpPWoNW12LzjGIFV8FRTADGmecW5MGLigif3cCg9i_upqN6olj_Qr7kWBGqNJu2EXeP8QeUVkPmMk1TYwQ1pcBTxx32XgAlhuKEDKcpL&typo=1>
> It will have a different set of cert files.  I let it have an IP which
> nothing else shares.
> I'm keenly aware of this IP as I've set it up in DNS as well.
>
> <VirtualHost 1.1.1.13:443>
> Servername example2.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
> SSLEngine on
> SSLCertificateFile /etc/http/certs/example2.crt
> ...
> </VirtualHost>
>
> Every other vhost had a different servername, and they used the
> cert for example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,hWtAIAcngoqDN67tYYh-JBMRsDu0loXxcOnLFfiTh0kkC73FcXss_uAVRLOtoJLqXOCEN9jyzjXqVBcPyZW7t70FdDG9MVq19wuX_0SAFBLk7qkKRSlWDw,,&typo=1>
> .  They also had *:443
> Only for example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,0PHWaifn8IWmWbVOrikm7fz8IiJtabA_5-R1x0XKMlFFo3oBud94pi8En8RPBR3KLTR3QenHwFjS7HQgJNY1qG-nQe_UmNGE2X8vrXjghYl5KQ,,&typo=1>
> do we have multiple aliases on the same IP.
>
> When visiting the example2.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,QZFYnaarDKwbI4UIuis6AUVr6M_IY5nT64iVqhrFOfC1SFad9Dq-LeBk2Prq7-LyNrzbvo_FfMN1PezvDeICv0bWAkLH1rCsEqr9d-W4KMjU_tMJ5hg,&typo=1>
> site, the web site shows apache has served a certificate for example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,T_cQOb_HmAeeARzztUhUpYrFdC-M2k8aEzqZWhQryiy784g3BQNmtSe51GNCXcXQIbgEUbfPVEl5zdNv7G3-cgN_D5iSOe-t-0dOr8s9Ogm_ZwvXlaaXXQJDP78,&typo=1>
>
> I had believed this was because we had used *:443 rather than explicitly
> show the IP
> for all our vhosts.  It seemed the early conversation on SSL/TLS was
> matching a random
> vhost via this use of *:443 and that's how it got the cert for
> example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,Mz11UTCKtiWcGt6Y8IkJjBHQLSOD5JkAKituHpPrZu5-qa6kZmzAj0yKhiovnyiw6bX333zd9IKH73D6x3DQsfQOvC7ztgVXyiO7EUHWBXHjoys4q30,&typo=1>
> Since before this point all vhosts were on example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,8wXSzKIRaGVigrHUZoxWD8812IQ1_5RSU52jRZYKX7BQPnCQrAcHUwhw_BOV_E5zA1jMdtUHbqCd9jwXZ8HLFcDM7HcYG31scrYTMuAWMw,,&typo=1>
> the wildcard cert it
> found was always working while we had *:443 in use.
>
> What can we say about how multi-domain SSL works that we can rely on?
> I can find a dozen pages on google search from people who get the wrong
> certificate and they never get an answer.  Some good hard rules on what
> is required would probably help a lot of people over the years.
>
>
>
> On Fri, May 20, 2022 at 11:59 AM Frank Gingras <th...@apache.org> wrote:
>
> As mentioned, name-based vhosts will work with SNI and *:443 provided that
> you have the correct certificate assigned to each vhost.
>
> In rare cases, you can use IP:443 vhosts if you want specific handling
> based on the IP used to handle the request, such as https://IP1/ or
> https://IP2/. However, it is rarely needed by most servers.
>
> For now, you can use *:443, and run apachectl -S to make sure there is no
> overlap before restarting httpd.
>
> On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com> wrote:
>
>
> Sorry, that should not have said "top level domains".  I meant domains.
> Like example.com, example.net
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample.net&c=E,1,Lf7WCUECY7EjPemnM7RAgRqLA_RtcGdzOib3lOf7AW0vkHA8LZPhA_Cyx4vxm2UkTXZdaO6ax9tCWnAP4NJ8QbZC7d6pFPimkBkaFwrXGA,,&typo=1>
> .
>
>
> On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com> wrote:
>
>
> It looks like there are two requirements for multiple top level domains
> with SSL
> on the same apache.
>
> 1. IP values must be used inside VirtualHost, not *:443
> 2. All IP values must be unique, even on the same top level domain
>
> Is the above conjecture true?
>
> We have many setup like this example...
>
> <VirtualHost *:443 >
>    ServerName s1.example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,wsz87BMMp2oMlSddl_CqoJGdX4XfnA4SBhZHzfihJZJUFFJolpRBPQ1tm6G08DwlDNVBTcY1p7ZsxfEAtdfJ59gsZRoDVQeNBtWtKHbD&typo=1>
> ...
> </VirtualHost>
>
> <VirtualHost *:443 >
>    ServerName s2.example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,7pvCP6udZ3aZHoj-a0jz-AgOyf0BqRRLwQMOAtBCbrpGJX7So009M8zSgwIQRUxx3EB6zyyZKInj66oF7Td7UcJqi0h7gBdt_0zI0uL4PwM06AV6AQ,,&typo=1>
> ...
> </VirtualHost>
>
> where s1 and s2 are aliases on the same IP.  It has worked like that for
> years.  330 vhosts on about 80 IPs.
>
> When I started to convert them to use the actual IP value rather than *
>
> <VirtualHost 1.1.1.1:443 >
>    ServerName s1.example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,NvBi26pDh9IxdmyKgHLNK4p32Qv1cFQtyVXbIlC9HHOgiLAV95Pz_D8y_lWST789soOsTkxYjzJJJhMaqd4C8KT5RkVYHb73BPZZCPeWlhB7bt3Z6lPIEdWSe3Wd&typo=1>
> ...
> </VirtualHost>
> <VirtualHost 1.1.1.1:443 >
>    ServerName s2.example1.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,8X1MRWLchBd0jtI-FkYh2nb2lyg0LtCgOeCkKgkA16Wdz7Q11brpocrr15c9F9_OqRnWEqwExVy6LEiVykh8JwIhtyIlb2Madiz9yfOano0,&typo=1>
> ...
> </VirtualHost>
>
> This had nothing to do with the example2.com
> <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,ul_Sx0-1ZWGylDIVnZp9Xcqxf0r3cNY7JsJnUxT2ir53quY-0jVC5gTotkqGkJbvAzWE3tNI01fkJt3aoWuCI0MkdIM9ZPWyrJuBGzFiVA,,&typo=1>
> I also want to put in there
> but on a unique IP.  I did a few conversions from *:443, saved it and
> restarted apache.
> Then vhosts I had not touched yet were getting pages for other
> vhosts.  It was random chaos and I reverted to the previous ssl.conf copy
>
>
>

Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by "Bender, Charles" <ch...@beachcamera.com.INVALID>.
Your virtual host is defined wrong. Use the names not IP addresses

<VirtualHost example2.com:443<http://1.1.1.13:443/>>
Servername example2.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
SSLEngine on
SSLCertificateFile /etc/http/certs/example2.crt
...
</VirtualHost>
________________________________
From: frank picabia <fp...@gmail.com>
Sent: Friday, May 20, 2022 12:55 PM
To: users@httpd.apache.org <us...@httpd.apache.org>
Subject: Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

I'm trying hard to get the lay of the land logic here, and it isn't happening.  I'm bouncing between what I read here,
and what apache actually does, and it doesn't add up.

In my case we tried to introduce a new domain, let's call it example2.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,6W_vM4KZBARFuk6DDpPWoNW12LzjGIFV8FRTADGmecW5MGLigif3cCg9i_upqN6olj_Qr7kWBGqNJu2EXeP8QeUVkPmMk1TYwQ1pcBTxx32XgAlhuKEDKcpL&typo=1>
It will have a different set of cert files.  I let it have an IP which nothing else shares.
I'm keenly aware of this IP as I've set it up in DNS as well.

<VirtualHost 1.1.1.13:443<http://1.1.1.13:443>>
Servername example2.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,dcUCUjUb4LYF2QKtZR97YwwXQvScdoETUyYneNIzxrVPCY07TRsv343JxU2TC5RtNYHxyF97S7yA3AepHgKTSlaPMWipWynnIbri9ZFZlIJCfOISNr175hJJNl8,&typo=1>
SSLEngine on
SSLCertificateFile /etc/http/certs/example2.crt
...
</VirtualHost>

Every other vhost had a different servername, and they used the
cert for example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,hWtAIAcngoqDN67tYYh-JBMRsDu0loXxcOnLFfiTh0kkC73FcXss_uAVRLOtoJLqXOCEN9jyzjXqVBcPyZW7t70FdDG9MVq19wuX_0SAFBLk7qkKRSlWDw,,&typo=1> .  They also had *:443
Only for example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,0PHWaifn8IWmWbVOrikm7fz8IiJtabA_5-R1x0XKMlFFo3oBud94pi8En8RPBR3KLTR3QenHwFjS7HQgJNY1qG-nQe_UmNGE2X8vrXjghYl5KQ,,&typo=1> do we have multiple aliases on the same IP.

When visiting the example2.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,QZFYnaarDKwbI4UIuis6AUVr6M_IY5nT64iVqhrFOfC1SFad9Dq-LeBk2Prq7-LyNrzbvo_FfMN1PezvDeICv0bWAkLH1rCsEqr9d-W4KMjU_tMJ5hg,&typo=1> site, the web site shows apache has served a certificate for example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,T_cQOb_HmAeeARzztUhUpYrFdC-M2k8aEzqZWhQryiy784g3BQNmtSe51GNCXcXQIbgEUbfPVEl5zdNv7G3-cgN_D5iSOe-t-0dOr8s9Ogm_ZwvXlaaXXQJDP78,&typo=1>

I had believed this was because we had used *:443 rather than explicitly show the IP
for all our vhosts.  It seemed the early conversation on SSL/TLS was matching a random
vhost via this use of *:443 and that's how it got the cert for example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,Mz11UTCKtiWcGt6Y8IkJjBHQLSOD5JkAKituHpPrZu5-qa6kZmzAj0yKhiovnyiw6bX333zd9IKH73D6x3DQsfQOvC7ztgVXyiO7EUHWBXHjoys4q30,&typo=1>
Since before this point all vhosts were on example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample1.com&c=E,1,8wXSzKIRaGVigrHUZoxWD8812IQ1_5RSU52jRZYKX7BQPnCQrAcHUwhw_BOV_E5zA1jMdtUHbqCd9jwXZ8HLFcDM7HcYG31scrYTMuAWMw,,&typo=1> the wildcard cert it
found was always working while we had *:443 in use.

What can we say about how multi-domain SSL works that we can rely on?
I can find a dozen pages on google search from people who get the wrong
certificate and they never get an answer.  Some good hard rules on what
is required would probably help a lot of people over the years.



On Fri, May 20, 2022 at 11:59 AM Frank Gingras <th...@apache.org>> wrote:
As mentioned, name-based vhosts will work with SNI and *:443 provided that you have the correct certificate assigned to each vhost.

In rare cases, you can use IP:443 vhosts if you want specific handling based on the IP used to handle the request, such as https://IP1/ or https://IP2/. However, it is rarely needed by most servers.

For now, you can use *:443, and run apachectl -S to make sure there is no overlap before restarting httpd.

On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com>> wrote:

Sorry, that should not have said "top level domains".  I meant domains.  Like example.com<http://example.com>, example.net<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample.net&c=E,1,Lf7WCUECY7EjPemnM7RAgRqLA_RtcGdzOib3lOf7AW0vkHA8LZPhA_Cyx4vxm2UkTXZdaO6ax9tCWnAP4NJ8QbZC7d6pFPimkBkaFwrXGA,,&typo=1>.


On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com>> wrote:

It looks like there are two requirements for multiple top level domains with SSL
on the same apache.

1. IP values must be used inside VirtualHost, not *:443
2. All IP values must be unique, even on the same top level domain

Is the above conjecture true?

We have many setup like this example...

<VirtualHost *:443 >
   ServerName s1.example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,wsz87BMMp2oMlSddl_CqoJGdX4XfnA4SBhZHzfihJZJUFFJolpRBPQ1tm6G08DwlDNVBTcY1p7ZsxfEAtdfJ59gsZRoDVQeNBtWtKHbD&typo=1>
...
</VirtualHost>

<VirtualHost *:443 >
   ServerName s2.example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,7pvCP6udZ3aZHoj-a0jz-AgOyf0BqRRLwQMOAtBCbrpGJX7So009M8zSgwIQRUxx3EB6zyyZKInj66oF7Td7UcJqi0h7gBdt_0zI0uL4PwM06AV6AQ,,&typo=1>
...
</VirtualHost>

where s1 and s2 are aliases on the same IP.  It has worked like that for years.  330 vhosts on about 80 IPs.

When I started to convert them to use the actual IP value rather than *

<VirtualHost 1.1.1.1:443<http://1.1.1.1:443> >
   ServerName s1.example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs1.example1.com&c=E,1,NvBi26pDh9IxdmyKgHLNK4p32Qv1cFQtyVXbIlC9HHOgiLAV95Pz_D8y_lWST789soOsTkxYjzJJJhMaqd4C8KT5RkVYHb73BPZZCPeWlhB7bt3Z6lPIEdWSe3Wd&typo=1>
...
</VirtualHost>
<VirtualHost 1.1.1.1:443<http://1.1.1.1:443> >
   ServerName s2.example1.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fs2.example1.com&c=E,1,8X1MRWLchBd0jtI-FkYh2nb2lyg0LtCgOeCkKgkA16Wdz7Q11brpocrr15c9F9_OqRnWEqwExVy6LEiVykh8JwIhtyIlb2Madiz9yfOano0,&typo=1>
...
</VirtualHost>

This had nothing to do with the example2.com<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fexample2.com&c=E,1,ul_Sx0-1ZWGylDIVnZp9Xcqxf0r3cNY7JsJnUxT2ir53quY-0jVC5gTotkqGkJbvAzWE3tNI01fkJt3aoWuCI0MkdIM9ZPWyrJuBGzFiVA,,&typo=1> I also want to put in there
but on a unique IP.  I did a few conversions from *:443, saved it and restarted apache.
Then vhosts I had not touched yet were getting pages for other
vhosts.  It was random chaos and I reverted to the previous ssl.conf copy



Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by Yehuda Katz <ye...@ymkatz.net>.
>
> It will have a different set of cert files.  I let it have an IP which
> nothing else shares.

I'm keenly aware of this IP as I've set it up in DNS as well.

If you have <VirtualHost *:443>, it will use ALL IPs - if you want to
dedicate an IP for a site, you need to specify IPs for every other site too.

I am not sure how this matches what you see though - non-wildcard
VirtualHost declarations are supposed to have precedence over wildcards and
I have never seen this issue on any of my systems.

From the documentation (
https://httpd.apache.org/docs/2.4/mod/core.html#virtualhost):

> When a request is received, the server first maps it to the best matching
> <VirtualHost> based on the local IP address and port combination only.
> Non-wildcards have a higher precedence. If no match based on IP and port
> occurs at all, the "main" server configuration is used.

If multiple virtual hosts contain the best matching IP address and port,
> the server selects from these virtual hosts the best match based on the
> requested hostname. If no matching name-based virtual host is found, then
> the first listed virtual host that matched the IP address will be used. As
> a consequence, the first listed virtual host for a given IP address and
> port combination is the default virtual host for that IP and port
> combination.


Use `httpd -S` (or `apache2ctl -S`, depending on your distribution) to
verify the list of VirtualHosts being served.

- Y

On Fri, May 20, 2022 at 12:56 PM frank picabia <fp...@gmail.com> wrote:

> I'm trying hard to get the lay of the land logic here, and it isn't
> happening.  I'm bouncing between what I read here,
> and what apache actually does, and it doesn't add up.
>
> In my case we tried to introduce a new domain, let's call it example2.com
> It will have a different set of cert files.  I let it have an IP which
> nothing else shares.
> I'm keenly aware of this IP as I've set it up in DNS as well.
>
> <VirtualHost 1.1.1.13:443>
> Servername example2.com
> SSLEngine on
> SSLCertificateFile /etc/http/certs/example2.crt
> ...
> </VirtualHost>
>
> Every other vhost had a different servername, and they used the
> cert for example1.com .  They also had *:443
> Only for example1.com do we have multiple aliases on the same IP.
>
> When visiting the example2.com site, the web site shows apache has served
> a certificate for example1.com
>
> I had believed this was because we had used *:443 rather than explicitly
> show the IP
> for all our vhosts.  It seemed the early conversation on SSL/TLS was
> matching a random
> vhost via this use of *:443 and that's how it got the cert for
> example1.com
> Since before this point all vhosts were on example1.com the wildcard cert
> it
> found was always working while we had *:443 in use.
>
> What can we say about how multi-domain SSL works that we can rely on?
> I can find a dozen pages on google search from people who get the wrong
> certificate and they never get an answer.  Some good hard rules on what
> is required would probably help a lot of people over the years.
>
>
>
> On Fri, May 20, 2022 at 11:59 AM Frank Gingras <th...@apache.org> wrote:
>
>> As mentioned, name-based vhosts will work with SNI and *:443 provided
>> that you have the correct certificate assigned to each vhost.
>>
>> In rare cases, you can use IP:443 vhosts if you want specific handling
>> based on the IP used to handle the request, such as https://IP1/ or
>> https://IP2/. However, it is rarely needed by most servers.
>>
>> For now, you can use *:443, and run apachectl -S to make sure there is no
>> overlap before restarting httpd.
>>
>> On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com> wrote:
>>
>>>
>>> Sorry, that should not have said "top level domains".  I meant domains.
>>> Like example.com, example.net.
>>>
>>>
>>> On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com>
>>> wrote:
>>>
>>>>
>>>> It looks like there are two requirements for multiple top level domains
>>>> with SSL
>>>> on the same apache.
>>>>
>>>> 1. IP values must be used inside VirtualHost, not *:443
>>>> 2. All IP values must be unique, even on the same top level domain
>>>>
>>>> Is the above conjecture true?
>>>>
>>>> We have many setup like this example...
>>>>
>>>> <VirtualHost *:443 >
>>>>    ServerName s1.example1.com
>>>> ...
>>>> </VirtualHost>
>>>>
>>>> <VirtualHost *:443 >
>>>>    ServerName s2.example1.com
>>>> ...
>>>> </VirtualHost>
>>>>
>>>> where s1 and s2 are aliases on the same IP.  It has worked like that
>>>> for years.  330 vhosts on about 80 IPs.
>>>>
>>>> When I started to convert them to use the actual IP value rather than *
>>>>
>>>> <VirtualHost 1.1.1.1:443 >
>>>>    ServerName s1.example1.com
>>>> ...
>>>> </VirtualHost>
>>>> <VirtualHost 1.1.1.1:443 >
>>>>    ServerName s2.example1.com
>>>> ...
>>>> </VirtualHost>
>>>>
>>>> This had nothing to do with the example2.com I also want to put in
>>>> there
>>>> but on a unique IP.  I did a few conversions from *:443, saved it and
>>>> restarted apache.
>>>> Then vhosts I had not touched yet were getting pages for other
>>>> vhosts.  It was random chaos and I reverted to the previous ssl.conf
>>>> copy
>>>>
>>>>
>>>>

Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by frank picabia <fp...@gmail.com>.
I'm trying hard to get the lay of the land logic here, and it isn't
happening.  I'm bouncing between what I read here,
and what apache actually does, and it doesn't add up.

In my case we tried to introduce a new domain, let's call it example2.com
It will have a different set of cert files.  I let it have an IP which
nothing else shares.
I'm keenly aware of this IP as I've set it up in DNS as well.

<VirtualHost 1.1.1.13:443>
Servername example2.com
SSLEngine on
SSLCertificateFile /etc/http/certs/example2.crt
...
</VirtualHost>

Every other vhost had a different servername, and they used the
cert for example1.com .  They also had *:443
Only for example1.com do we have multiple aliases on the same IP.

When visiting the example2.com site, the web site shows apache has served a
certificate for example1.com

I had believed this was because we had used *:443 rather than explicitly
show the IP
for all our vhosts.  It seemed the early conversation on SSL/TLS was
matching a random
vhost via this use of *:443 and that's how it got the cert for example1.com
Since before this point all vhosts were on example1.com the wildcard cert it
found was always working while we had *:443 in use.

What can we say about how multi-domain SSL works that we can rely on?
I can find a dozen pages on google search from people who get the wrong
certificate and they never get an answer.  Some good hard rules on what
is required would probably help a lot of people over the years.



On Fri, May 20, 2022 at 11:59 AM Frank Gingras <th...@apache.org> wrote:

> As mentioned, name-based vhosts will work with SNI and *:443 provided that
> you have the correct certificate assigned to each vhost.
>
> In rare cases, you can use IP:443 vhosts if you want specific handling
> based on the IP used to handle the request, such as https://IP1/ or
> https://IP2/. However, it is rarely needed by most servers.
>
> For now, you can use *:443, and run apachectl -S to make sure there is no
> overlap before restarting httpd.
>
> On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com> wrote:
>
>>
>> Sorry, that should not have said "top level domains".  I meant domains.
>> Like example.com, example.net.
>>
>>
>> On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com> wrote:
>>
>>>
>>> It looks like there are two requirements for multiple top level domains
>>> with SSL
>>> on the same apache.
>>>
>>> 1. IP values must be used inside VirtualHost, not *:443
>>> 2. All IP values must be unique, even on the same top level domain
>>>
>>> Is the above conjecture true?
>>>
>>> We have many setup like this example...
>>>
>>> <VirtualHost *:443 >
>>>    ServerName s1.example1.com
>>> ...
>>> </VirtualHost>
>>>
>>> <VirtualHost *:443 >
>>>    ServerName s2.example1.com
>>> ...
>>> </VirtualHost>
>>>
>>> where s1 and s2 are aliases on the same IP.  It has worked like that for
>>> years.  330 vhosts on about 80 IPs.
>>>
>>> When I started to convert them to use the actual IP value rather than *
>>>
>>> <VirtualHost 1.1.1.1:443 >
>>>    ServerName s1.example1.com
>>> ...
>>> </VirtualHost>
>>> <VirtualHost 1.1.1.1:443 >
>>>    ServerName s2.example1.com
>>> ...
>>> </VirtualHost>
>>>
>>> This had nothing to do with the example2.com I also want to put in there
>>> but on a unique IP.  I did a few conversions from *:443, saved it and
>>> restarted apache.
>>> Then vhosts I had not touched yet were getting pages for other
>>> vhosts.  It was random chaos and I reverted to the previous ssl.conf copy
>>>
>>>
>>>

Re: [users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by Frank Gingras <th...@apache.org>.
As mentioned, name-based vhosts will work with SNI and *:443 provided that
you have the correct certificate assigned to each vhost.

In rare cases, you can use IP:443 vhosts if you want specific handling
based on the IP used to handle the request, such as https://IP1/ or
https://IP2/. However, it is rarely needed by most servers.

For now, you can use *:443, and run apachectl -S to make sure there is no
overlap before restarting httpd.

On Fri, 20 May 2022 at 07:04, frank picabia <fp...@gmail.com> wrote:

>
> Sorry, that should not have said "top level domains".  I meant domains.
> Like example.com, example.net.
>
>
> On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com> wrote:
>
>>
>> It looks like there are two requirements for multiple top level domains
>> with SSL
>> on the same apache.
>>
>> 1. IP values must be used inside VirtualHost, not *:443
>> 2. All IP values must be unique, even on the same top level domain
>>
>> Is the above conjecture true?
>>
>> We have many setup like this example...
>>
>> <VirtualHost *:443 >
>>    ServerName s1.example1.com
>> ...
>> </VirtualHost>
>>
>> <VirtualHost *:443 >
>>    ServerName s2.example1.com
>> ...
>> </VirtualHost>
>>
>> where s1 and s2 are aliases on the same IP.  It has worked like that for
>> years.  330 vhosts on about 80 IPs.
>>
>> When I started to convert them to use the actual IP value rather than *
>>
>> <VirtualHost 1.1.1.1:443 >
>>    ServerName s1.example1.com
>> ...
>> </VirtualHost>
>> <VirtualHost 1.1.1.1:443 >
>>    ServerName s2.example1.com
>> ...
>> </VirtualHost>
>>
>> This had nothing to do with the example2.com I also want to put in there
>> but on a unique IP.  I did a few conversions from *:443, saved it and
>> restarted apache.
>> Then vhosts I had not touched yet were getting pages for other
>> vhosts.  It was random chaos and I reverted to the previous ssl.conf copy
>>
>>
>>

[users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by frank picabia <fp...@gmail.com>.
Sorry, that should not have said "top level domains".  I meant domains.
Like example.com, example.net.


On Fri, May 20, 2022 at 7:05 AM frank picabia <fp...@gmail.com> wrote:

>
> It looks like there are two requirements for multiple top level domains
> with SSL
> on the same apache.
>
> 1. IP values must be used inside VirtualHost, not *:443
> 2. All IP values must be unique, even on the same top level domain
>
> Is the above conjecture true?
>
> We have many setup like this example...
>
> <VirtualHost *:443 >
>    ServerName s1.example1.com
> ...
> </VirtualHost>
>
> <VirtualHost *:443 >
>    ServerName s2.example1.com
> ...
> </VirtualHost>
>
> where s1 and s2 are aliases on the same IP.  It has worked like that for
> years.  330 vhosts on about 80 IPs.
>
> When I started to convert them to use the actual IP value rather than *
>
> <VirtualHost 1.1.1.1:443 >
>    ServerName s1.example1.com
> ...
> </VirtualHost>
> <VirtualHost 1.1.1.1:443 >
>    ServerName s2.example1.com
> ...
> </VirtualHost>
>
> This had nothing to do with the example2.com I also want to put in there
> but on a unique IP.  I did a few conversions from *:443, saved it and
> restarted apache.
> Then vhosts I had not touched yet were getting pages for other
> vhosts.  It was random chaos and I reverted to the previous ssl.conf copy
>
>
>

[users@httpd] Re: Multi-domain with SSL - Virtualhost all need IPs?

Posted by frank picabia <fp...@gmail.com>.
It looks like there are two requirements for multiple top level domains
with SSL
on the same apache.

1. IP values must be used inside VirtualHost, not *:443
2. All IP values must be unique, even on the same top level domain

Is the above conjecture true?

We have many setup like this example...

<VirtualHost *:443 >
   ServerName s1.example1.com
...
</VirtualHost>

<VirtualHost *:443 >
   ServerName s2.example1.com
...
</VirtualHost>

where s1 and s2 are aliases on the same IP.  It has worked like that for
years.  330 vhosts on about 80 IPs.

When I started to convert them to use the actual IP value rather than *

<VirtualHost 1.1.1.1:443 >
   ServerName s1.example1.com
...
</VirtualHost>
<VirtualHost 1.1.1.1:443 >
   ServerName s2.example1.com
...
</VirtualHost>

This had nothing to do with the example2.com I also want to put in there
but on a unique IP.  I did a few conversions from *:443, saved it and
restarted apache.
Then vhosts I had not touched yet were getting pages for other
vhosts.  It was random chaos and I reverted to the previous ssl.conf copy