Skip to content

Commit bdf48b1

Browse files
Merge pull request #11498 from openshift/revert-11201-wildcard-domain
Revert "Add router support for wildcard domains (*.foo.com)"
2 parents 2016d68 + 7d6d0ff commit bdf48b1

File tree

18 files changed

+15
-1088
lines changed

18 files changed

+15
-1088
lines changed

contrib/completions/bash/openshift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19753,10 +19753,6 @@ _openshift_infra_f5-router()
1975319753
flags_with_completion=()
1975419754
flags_completion=()
1975519755

19756-
flags+=("--allow-wildcard-routes")
19757-
local_nonpersistent_flags+=("--allow-wildcard-routes")
19758-
flags+=("--allowed-domains=")
19759-
local_nonpersistent_flags+=("--allowed-domains=")
1976019756
flags+=("--as=")
1976119757
local_nonpersistent_flags+=("--as=")
1976219758
flags+=("--certificate-authority=")
@@ -19779,8 +19775,6 @@ _openshift_infra_f5-router()
1977919775
local_nonpersistent_flags+=("--config=")
1978019776
flags+=("--context=")
1978119777
local_nonpersistent_flags+=("--context=")
19782-
flags+=("--denied-domains=")
19783-
local_nonpersistent_flags+=("--denied-domains=")
1978419778
flags+=("--f5-host=")
1978519779
local_nonpersistent_flags+=("--f5-host=")
1978619780
flags+=("--f5-http-vserver=")
@@ -19896,10 +19890,6 @@ _openshift_infra_router()
1989619890
flags_with_completion=()
1989719891
flags_completion=()
1989819892

19899-
flags+=("--allow-wildcard-routes")
19900-
local_nonpersistent_flags+=("--allow-wildcard-routes")
19901-
flags+=("--allowed-domains=")
19902-
local_nonpersistent_flags+=("--allowed-domains=")
1990319893
flags+=("--as=")
1990419894
local_nonpersistent_flags+=("--as=")
1990519895
flags+=("--certificate-authority=")
@@ -19928,8 +19918,6 @@ _openshift_infra_router()
1992819918
local_nonpersistent_flags+=("--default-certificate-dir=")
1992919919
flags+=("--default-certificate-path=")
1993019920
local_nonpersistent_flags+=("--default-certificate-path=")
19931-
flags+=("--denied-domains=")
19932-
local_nonpersistent_flags+=("--denied-domains=")
1993319921
flags+=("--extended-validation")
1993419922
local_nonpersistent_flags+=("--extended-validation")
1993519923
flags+=("--fields=")

contrib/completions/zsh/openshift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19914,10 +19914,6 @@ _openshift_infra_f5-router()
1991419914
flags_with_completion=()
1991519915
flags_completion=()
1991619916

19917-
flags+=("--allow-wildcard-routes")
19918-
local_nonpersistent_flags+=("--allow-wildcard-routes")
19919-
flags+=("--allowed-domains=")
19920-
local_nonpersistent_flags+=("--allowed-domains=")
1992119917
flags+=("--as=")
1992219918
local_nonpersistent_flags+=("--as=")
1992319919
flags+=("--certificate-authority=")
@@ -19940,8 +19936,6 @@ _openshift_infra_f5-router()
1994019936
local_nonpersistent_flags+=("--config=")
1994119937
flags+=("--context=")
1994219938
local_nonpersistent_flags+=("--context=")
19943-
flags+=("--denied-domains=")
19944-
local_nonpersistent_flags+=("--denied-domains=")
1994519939
flags+=("--f5-host=")
1994619940
local_nonpersistent_flags+=("--f5-host=")
1994719941
flags+=("--f5-http-vserver=")
@@ -20057,10 +20051,6 @@ _openshift_infra_router()
2005720051
flags_with_completion=()
2005820052
flags_completion=()
2005920053

20060-
flags+=("--allow-wildcard-routes")
20061-
local_nonpersistent_flags+=("--allow-wildcard-routes")
20062-
flags+=("--allowed-domains=")
20063-
local_nonpersistent_flags+=("--allowed-domains=")
2006420054
flags+=("--as=")
2006520055
local_nonpersistent_flags+=("--as=")
2006620056
flags+=("--certificate-authority=")
@@ -20089,8 +20079,6 @@ _openshift_infra_router()
2008920079
local_nonpersistent_flags+=("--default-certificate-dir=")
2009020080
flags+=("--default-certificate-path=")
2009120081
local_nonpersistent_flags+=("--default-certificate-path=")
20092-
flags+=("--denied-domains=")
20093-
local_nonpersistent_flags+=("--denied-domains=")
2009420082
flags+=("--extended-validation")
2009520083
local_nonpersistent_flags+=("--extended-validation")
2009620084
flags+=("--fields=")

docs/man/man1/openshift-infra-f5-router.1

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ You may restrict the set of routes exposed to a single project (with \-\-namespa
2323

2424

2525
.SH OPTIONS
26-
.PP
27-
\fB\-\-allow\-wildcard\-routes\fP=false
28-
Allow wildcard host names for routes
29-
30-
.PP
31-
\fB\-\-allowed\-domains\fP=[]
32-
List of comma separated domains to allow in routes. If specified, only the domains in this list will be allowed routes. Note that domains in the denied list take precedence over the ones in the allowed list
33-
3426
.PP
3527
\fB\-\-api\-version\fP=""
3628
DEPRECATED: The API version to use when talking to the server
@@ -63,10 +55,6 @@ You may restrict the set of routes exposed to a single project (with \-\-namespa
6355
\fB\-\-context\fP=""
6456
The name of the kubeconfig context to use
6557

66-
.PP
67-
\fB\-\-denied\-domains\fP=[]
68-
List of comma separated domains to deny in routes
69-
7058
.PP
7159
\fB\-\-f5\-host\fP=""
7260
The host of F5 BIG\-IP's management interface

docs/man/man1/openshift-infra-router.1

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ You may restrict the set of routes exposed to a single project (with \-\-namespa
2929

3030

3131
.SH OPTIONS
32-
.PP
33-
\fB\-\-allow\-wildcard\-routes\fP=false
34-
Allow wildcard host names for routes
35-
36-
.PP
37-
\fB\-\-allowed\-domains\fP=[]
38-
List of comma separated domains to allow in routes. If specified, only the domains in this list will be allowed routes. Note that domains in the denied list take precedence over the ones in the allowed list
39-
4032
.PP
4133
\fB\-\-api\-version\fP=""
4234
DEPRECATED: The API version to use when talking to the server
@@ -81,10 +73,6 @@ You may restrict the set of routes exposed to a single project (with \-\-namespa
8173
\fB\-\-default\-certificate\-path\fP=""
8274
A path to default certificate to use for routes that don't expose a TLS server cert; in PEM format
8375

84-
.PP
85-
\fB\-\-denied\-domains\fP=[]
86-
List of comma separated domains to deny in routes
87-
8876
.PP
8977
\fB\-\-extended\-validation\fP=true
9078
If set, then an additional extended validation step is performed on all routes admitted in by this router. Defaults to true and enables the extended validation checks.

images/router/haproxy/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN INSTALL_PKGS="haproxy" && \
1616
yum clean all && \
1717
mkdir -p /var/lib/haproxy/router/{certs,cacerts} && \
1818
mkdir -p /var/lib/haproxy/{conf,run,bin,log} && \
19-
touch /var/lib/haproxy/conf/{{os_http_be,os_edge_http_be,os_tcp_be,os_sni_passthrough,os_reencrypt,os_edge_http_expose,os_edge_http_redirect,cert_config,os_wildcard_domain}.map,haproxy.config} && \
19+
touch /var/lib/haproxy/conf/{{os_http_be,os_edge_http_be,os_tcp_be,os_sni_passthrough,os_reencrypt,os_edge_http_expose,os_edge_http_redirect,cert_config}.map,haproxy.config} && \
2020
chmod -R 777 /var && \
2121
setcap 'cap_net_bind_service=ep' /usr/sbin/haproxy
2222

images/router/haproxy/conf/haproxy-config.template

Lines changed: 5 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -109,36 +109,15 @@ frontend public
109109
acl secure_redirect base,map_beg(/var/lib/haproxy/conf/os_edge_http_redirect.map) -m found
110110
redirect scheme https if secure_redirect
111111

112-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
113-
# Check for wildcard domains with redirected http routes.
114-
acl wildcard_domain hdr(host),map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
115-
116-
acl wildcard_secure_redirect base,map_reg(/var/lib/haproxy/conf/os_edge_http_redirect.map) -m found
117-
redirect scheme https if wildcard_domain wildcard_secure_redirect
118-
119-
{{ end }}
120-
121112
# Check if it is an edge route exposed insecurely.
122113
acl edge_http_expose base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map) -m found
123114
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map)] if edge_http_expose
124115

125-
# map to http backend
126-
# Search from most specific to general path (host case).
127-
acl http_backend base,map_beg(/var/lib/haproxy/conf/os_http_be.map) -m found
128-
use_backend be_http_%[base,map_beg(/var/lib/haproxy/conf/os_http_be.map)] if http_backend
129-
130-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
131-
# Check for wildcard domains with exposed http routes.
132-
acl wildcard_edge_http_expose base,map_reg(/var/lib/haproxy/conf/os_edge_http_expose.map) -m found
133-
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map)] if wildcard_domain wildcard_edge_http_expose
134-
135116
# map to http backend
136117
# Search from most specific to general path (host case).
137118
# Note: If no match, haproxy uses the default_backend, no other
138119
# use_backend directives below this will be processed.
139-
use_backend be_http_%[base,map_reg(/var/lib/haproxy/conf/os_http_be.map)] if wildcard_domain
140-
141-
{{ end }}
120+
use_backend be_http_%[base,map_beg(/var/lib/haproxy/conf/os_http_be.map)]
142121

143122
default_backend openshift_default
144123

@@ -155,15 +134,6 @@ frontend public_ssl
155134
acl sni_passthrough req.ssl_sni,map(/var/lib/haproxy/conf/os_sni_passthrough.map) -m found
156135
use_backend be_tcp_%[req.ssl_sni,map(/var/lib/haproxy/conf/os_tcp_be.map)] if sni sni_passthrough
157136

158-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
159-
# Check for wildcard domains with passthrough.
160-
acl sni_wildcard_domain req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
161-
162-
acl sni_wildcard_passthrough req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_sni_passthrough.map) -m found
163-
use_backend be_tcp_%[req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_tcp_be.map)] if sni sni_wildcard_domain sni_wildcard_passthrough
164-
165-
{{ end }}
166-
167137
# if the route is SNI and NOT passthrough enter the termination flow
168138
use_backend be_sni if sni
169139

@@ -199,25 +169,11 @@ frontend fe_sni
199169
# Search from most specific to general path (host case).
200170
use_backend be_secure_%[base,map_beg(/var/lib/haproxy/conf/os_reencrypt.map)] if reencrypt
201171

202-
# map to http backend
203-
# Search from most specific to general path (host case).
204-
acl http_backend base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map) -m found
205-
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)] if http_backend
206-
207-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
208-
# Check for wildcard domains with redirected or exposed http routes.
209-
acl sni_wildcard_domain hdr(host),map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
210-
211-
acl wildcard_reencrypt base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map) -m found
212-
use_backend be_secure_%[base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map)] if sni_wildcard_domain wildcard_reencrypt
213-
214172
# map to http backend
215173
# Search from most specific to general path (host case).
216174
# Note: If no match, haproxy uses the default_backend, no other
217175
# use_backend directives below this will be processed.
218-
use_backend be_edge_http_%[base,map_reg(/var/lib/haproxy/conf/os_edge_http_be.map)] if sni_wildcard_domain
219-
220-
{{ end }}
176+
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)]
221177

222178
default_backend openshift_default
223179

@@ -250,24 +206,11 @@ frontend fe_no_sni
250206
# Search from most specific to general path (host case).
251207
use_backend be_secure_%[base,map_beg(/var/lib/haproxy/conf/os_reencrypt.map)] if reencrypt
252208

253-
# map to http backend
254-
# Search from most specific to general path (host case).
255-
acl edge_http_backend base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map) -m found
256-
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)] if edge_http_backend
257-
258-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
259-
acl host_wildcard_domain req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
260-
261-
acl host_reencrypt base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map) -m found
262-
use_backend be_secure_%[base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map)] if host_wildcard_domain host_reencrypt
263-
264209
# map to http backend
265210
# Search from most specific to general path (host case).
266211
# Note: If no match, haproxy uses the default_backend, no other
267212
# use_backend directives below this will be processed.
268-
use_backend be_edge_http_%[base,map_reg(/var/lib/haproxy/conf/os_edge_http_be.map)] if host_wildcard_domain
269-
270-
{{ end }}
213+
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)]
271214

272215
default_backend openshift_default
273216

@@ -387,8 +330,8 @@ backend be_edge_http_{{$cfgIdx}}
387330
{{ end }}{{/* end iterate over services */}}
388331
{{ end }}{{/* end if tls==edge/none */}}
389332

390-
{{ if eq $cfg.TLSTermination "passthrough" }}
391333
# Secure backend, pass through
334+
{{ if eq $cfg.TLSTermination "passthrough" }}
392335
backend be_tcp_{{$cfgIdx}}
393336
{{ if ne (env "ROUTER_SYSLOG_ADDRESS" "") ""}}
394337
option tcplog
@@ -451,8 +394,8 @@ backend be_tcp_{{$cfgIdx}}
451394
{{ end }}{{/* end iterate over services*/}}
452395
{{ end }}{{/*end tls==passthrough*/}}
453396

454-
{{ if eq $cfg.TLSTermination "reencrypt" }}
455397
# Secure backend which requires re-encryption
398+
{{ if eq $cfg.TLSTermination "reencrypt" }}
456399
backend be_secure_{{$cfgIdx}}
457400
mode http
458401
option redispatch
@@ -528,35 +471,14 @@ backend be_secure_{{$cfgIdx}}
528471
{{ end }}{{/* end haproxy config template */}}
529472

530473
{{/*--------------------------------- END OF HAPROXY CONFIG, BELOW ARE MAPPING FILES ------------------------*/}}
531-
{{/*
532-
os_wildcard_domain.map: contains a mapping of wildcard hosts for a
533-
[sub]domain regexps. This map is used to check if
534-
a host matches a [sub]domain with has wildcard support.
535-
*/}}
536-
{{ define "/var/lib/haproxy/conf/os_wildcard_domain.map" }}
537-
{{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
538-
{{ range $idx, $cfg := .State }}
539-
{{ if ne $cfg.Host ""}}
540-
{{ if $cfg.IsWildcard }}
541-
{{genDomainWildcardRegexp $cfg.Host "" true}} 1
542-
{{ end }}
543-
{{ end }}
544-
{{ end }}
545-
{{ end }}{{/* end if router allows wildcard routes */}}
546-
{{ end }}{{/* end wildcard domain map template */}}
547-
548474
{{/*
549475
os_http_be.map: contains a mapping of www.example.com -> <service name>. This map is used to discover the correct backend
550476
by attaching a prefix (be_http_) by use_backend statements if acls are matched.
551477
*/}}
552478
{{ define "/var/lib/haproxy/conf/os_http_be.map" }}
553479
{{ range $idx, $cfg := .State }}
554480
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "")}}
555-
{{ if $cfg.IsWildcard }}
556-
{{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
557-
{{ else }}
558481
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
559-
{{ end }}
560482
{{ end }}
561483
{{ end }}
562484
{{ end }}{{/* end http host map template */}}
@@ -568,11 +490,7 @@ backend be_secure_{{$cfgIdx}}
568490
{{ define "/var/lib/haproxy/conf/os_edge_http_be.map" }}
569491
{{ range $idx, $cfg := .State }}
570492
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "edge")}}
571-
{{ if $cfg.IsWildcard }}
572-
{{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
573-
{{ else }}
574493
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
575-
{{ end }}
576494
{{ end }}
577495
{{ end }}
578496
{{ end }}{{/* end edge http host map template */}}
@@ -585,11 +503,7 @@ backend be_secure_{{$cfgIdx}}
585503
{{ define "/var/lib/haproxy/conf/os_edge_http_expose.map" }}
586504
{{ range $idx, $cfg := .State }}
587505
{{ if and (ne $cfg.Host "") (and (eq $cfg.TLSTermination "edge") (eq $cfg.InsecureEdgeTerminationPolicy "Allow"))}}
588-
{{ if $cfg.IsWildcard }}
589-
{{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
590-
{{ else }}
591506
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
592-
{{ end }}
593507
{{ end }}
594508
{{ end }}
595509
{{ end }}{{/* end edge insecure expose http host map template */}}
@@ -602,11 +516,7 @@ backend be_secure_{{$cfgIdx}}
602516
{{ define "/var/lib/haproxy/conf/os_edge_http_redirect.map" }}
603517
{{ range $idx, $cfg := .State }}
604518
{{ if and (ne $cfg.Host "") (and (eq $cfg.TLSTermination "edge") (eq $cfg.InsecureEdgeTerminationPolicy "Redirect"))}}
605-
{{ if $cfg.IsWildcard }}
606-
{{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
607-
{{ else }}
608519
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
609-
{{ end }}
610520
{{ end }}
611521
{{ end }}
612522
{{ end }}{{/* end edge insecure redirect http host map template */}}
@@ -619,11 +529,7 @@ backend be_secure_{{$cfgIdx}}
619529
{{ define "/var/lib/haproxy/conf/os_tcp_be.map" }}
620530
{{ range $idx, $cfg := .State }}
621531
{{ if and (eq $cfg.Path "") (and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "passthrough") (eq $cfg.TLSTermination "reencrypt"))) }}
622-
{{ if $cfg.IsWildcard }}
623-
{{genDomainWildcardRegexp $cfg.Host "" true}} {{$idx}}
624-
{{ else }}
625532
{{$cfg.Host}} {{$idx}}
626-
{{ end }}
627533
{{ end }}
628534
{{ end }}
629535
{{ end }}{{/* end tcp host map template */}}
@@ -635,11 +541,7 @@ backend be_secure_{{$cfgIdx}}
635541
{{ define "/var/lib/haproxy/conf/os_sni_passthrough.map" }}
636542
{{ range $idx, $cfg := .State }}
637543
{{ if and (eq $cfg.Path "") (eq $cfg.TLSTermination "passthrough") }}
638-
{{ if $cfg.IsWildcard }}
639-
{{genDomainWildcardRegexp $cfg.Host "" true}} {{$idx}}
640-
{{ else }}
641544
{{$cfg.Host}} 1
642-
{{ end }}
643545
{{ end }}
644546
{{ end }}
645547
{{ end }}{{/* end sni passthrough map template */}}
@@ -652,11 +554,7 @@ backend be_secure_{{$cfgIdx}}
652554
{{ define "/var/lib/haproxy/conf/os_reencrypt.map" }}
653555
{{ range $idx, $cfg := .State }}
654556
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "reencrypt") }}
655-
{{ if $cfg.IsWildcard }}
656-
{{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
657-
{{ else }}
658557
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
659-
{{ end }}
660558
{{ end }}
661559
{{ end }}
662560
{{ end }}{{/* end reencrypt map template */}}

0 commit comments

Comments
 (0)