Skip to content

Commit a68db68

Browse files
author
OpenShift Bot
authored
Merge pull request #14621 from pecameron/br1369865
Merged by openshift-bot
2 parents 6d961d6 + e8638ae commit a68db68

File tree

11 files changed

+37
-1
lines changed

11 files changed

+37
-1
lines changed

contrib/completions/bash/oadm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4914,6 +4914,8 @@ _oadm_router()
49144914
local_nonpersistent_flags+=("--stats-port=")
49154915
flags+=("--stats-user=")
49164916
local_nonpersistent_flags+=("--stats-user=")
4917+
flags+=("--strict-sni")
4918+
local_nonpersistent_flags+=("--strict-sni")
49174919
flags+=("--subdomain=")
49184920
local_nonpersistent_flags+=("--subdomain=")
49194921
flags+=("--type=")

contrib/completions/bash/oc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4913,6 +4913,8 @@ _oc_adm_router()
49134913
local_nonpersistent_flags+=("--stats-port=")
49144914
flags+=("--stats-user=")
49154915
local_nonpersistent_flags+=("--stats-user=")
4916+
flags+=("--strict-sni")
4917+
local_nonpersistent_flags+=("--strict-sni")
49164918
flags+=("--subdomain=")
49174919
local_nonpersistent_flags+=("--subdomain=")
49184920
flags+=("--type=")

contrib/completions/bash/openshift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4914,6 +4914,8 @@ _openshift_admin_router()
49144914
local_nonpersistent_flags+=("--stats-port=")
49154915
flags+=("--stats-user=")
49164916
local_nonpersistent_flags+=("--stats-user=")
4917+
flags+=("--strict-sni")
4918+
local_nonpersistent_flags+=("--strict-sni")
49174919
flags+=("--subdomain=")
49184920
local_nonpersistent_flags+=("--subdomain=")
49194921
flags+=("--type=")
@@ -10151,6 +10153,8 @@ _openshift_cli_adm_router()
1015110153
local_nonpersistent_flags+=("--stats-port=")
1015210154
flags+=("--stats-user=")
1015310155
local_nonpersistent_flags+=("--stats-user=")
10156+
flags+=("--strict-sni")
10157+
local_nonpersistent_flags+=("--strict-sni")
1015410158
flags+=("--subdomain=")
1015510159
local_nonpersistent_flags+=("--subdomain=")
1015610160
flags+=("--type=")
@@ -23496,6 +23500,8 @@ _openshift_infra_router()
2349623500
local_nonpersistent_flags+=("--stats-port=")
2349723501
flags+=("--stats-user=")
2349823502
local_nonpersistent_flags+=("--stats-user=")
23503+
flags+=("--strict-sni")
23504+
local_nonpersistent_flags+=("--strict-sni")
2349923505
flags+=("--template=")
2350023506
local_nonpersistent_flags+=("--template=")
2350123507
flags+=("--token=")

contrib/completions/zsh/oadm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5063,6 +5063,8 @@ _oadm_router()
50635063
local_nonpersistent_flags+=("--stats-port=")
50645064
flags+=("--stats-user=")
50655065
local_nonpersistent_flags+=("--stats-user=")
5066+
flags+=("--strict-sni")
5067+
local_nonpersistent_flags+=("--strict-sni")
50665068
flags+=("--subdomain=")
50675069
local_nonpersistent_flags+=("--subdomain=")
50685070
flags+=("--type=")

contrib/completions/zsh/oc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5062,6 +5062,8 @@ _oc_adm_router()
50625062
local_nonpersistent_flags+=("--stats-port=")
50635063
flags+=("--stats-user=")
50645064
local_nonpersistent_flags+=("--stats-user=")
5065+
flags+=("--strict-sni")
5066+
local_nonpersistent_flags+=("--strict-sni")
50655067
flags+=("--subdomain=")
50665068
local_nonpersistent_flags+=("--subdomain=")
50675069
flags+=("--type=")

contrib/completions/zsh/openshift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5063,6 +5063,8 @@ _openshift_admin_router()
50635063
local_nonpersistent_flags+=("--stats-port=")
50645064
flags+=("--stats-user=")
50655065
local_nonpersistent_flags+=("--stats-user=")
5066+
flags+=("--strict-sni")
5067+
local_nonpersistent_flags+=("--strict-sni")
50665068
flags+=("--subdomain=")
50675069
local_nonpersistent_flags+=("--subdomain=")
50685070
flags+=("--type=")
@@ -10300,6 +10302,8 @@ _openshift_cli_adm_router()
1030010302
local_nonpersistent_flags+=("--stats-port=")
1030110303
flags+=("--stats-user=")
1030210304
local_nonpersistent_flags+=("--stats-user=")
10305+
flags+=("--strict-sni")
10306+
local_nonpersistent_flags+=("--strict-sni")
1030310307
flags+=("--subdomain=")
1030410308
local_nonpersistent_flags+=("--subdomain=")
1030510309
flags+=("--type=")
@@ -23645,6 +23649,8 @@ _openshift_infra_router()
2364523649
local_nonpersistent_flags+=("--stats-port=")
2364623650
flags+=("--stats-user=")
2364723651
local_nonpersistent_flags+=("--stats-user=")
23652+
flags+=("--strict-sni")
23653+
local_nonpersistent_flags+=("--strict-sni")
2364823654
flags+=("--template=")
2364923655
local_nonpersistent_flags+=("--template=")
2365023656
flags+=("--token=")

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ backend be_sni
218218

219219
frontend fe_sni
220220
# terminate ssl on edge
221-
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3 {{ if gt (len .DefaultCertificate) 0 }}crt {{.DefaultCertificate}}{{ else }}crt /var/lib/haproxy/conf/default_pub_keys.pem{{ end }} crt-list /var/lib/haproxy/conf/cert_config.map accept-proxy
221+
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3
222+
{{- if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") }} strict-sni {{ end }}
223+
{{- if gt (len .DefaultCertificate) 0 }} crt {{.DefaultCertificate}}{{ else }} crt /var/lib/haproxy/conf/default_pub_keys.pem{{ end }}
224+
{{- ""}} crt-list /var/lib/haproxy/conf/cert_config.map accept-proxy
222225
mode http
223226

224227
# check re-encrypt backends first - from most specific to general path.

pkg/cmd/admin/router/router.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ type RouterConfig struct {
230230
// Ciphers is the set of ciphers to use with bind
231231
// modern | intermediate | old | set of cihers
232232
Ciphers string
233+
234+
// Strict SNI (do not use default cert)
235+
StrictSNI bool
233236
}
234237

235238
const (
@@ -310,6 +313,7 @@ func NewCmdRouter(f *clientcmd.Factory, parentName, name string, out, errout io.
310313
cmd.Flags().BoolVar(&cfg.DisableNamespaceOwnershipCheck, "disable-namespace-ownership-check", cfg.DisableNamespaceOwnershipCheck, "Disables the namespace ownership check and allows different namespaces to claim either different paths to a route host or overlapping host names in case of a wildcard route. The default behavior (false) to restrict claims to the oldest namespace that has claimed either the host or the subdomain. Please be aware that if namespace ownership checks are disabled, routes in a different namespace can use this mechanism to 'steal' sub-paths for existing domains. This is only safe if route creation privileges are restricted, or if all the users can be trusted.")
311314
cmd.Flags().StringVar(&cfg.MaxConnections, "max-connections", cfg.MaxConnections, "Specifies the maximum number of concurrent connections. Not supported for F5.")
312315
cmd.Flags().StringVar(&cfg.Ciphers, "ciphers", cfg.Ciphers, "Specifies the cipher suites to use. You can choose a predefined cipher set ('modern', 'intermediate', or 'old') or specify exact cipher suites by passing a : separated list. Not supported for F5.")
316+
cmd.Flags().BoolVar(&cfg.StrictSNI, "strict-sni", cfg.StrictSNI, "Use strict-sni bind processing (do not use default cert). Not supported for F5.")
313317

314318
cfg.Action.BindForOutput(cmd.Flags())
315319
cmd.Flags().String("output-version", "", "The preferred API versions of the output objects")
@@ -664,6 +668,9 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
664668
if cfg.DisableNamespaceOwnershipCheck {
665669
env["ROUTER_DISABLE_NAMESPACE_OWNERSHIP_CHECK"] = "true"
666670
}
671+
if cfg.StrictSNI {
672+
env["ROUTER_STRICT_SNI"] = "true"
673+
}
667674
if len(cfg.RouterCanonicalHostname) > 0 {
668675
if errs := validation.IsDNS1123Subdomain(cfg.RouterCanonicalHostname); len(errs) != 0 {
669676
return fmt.Errorf("invalid canonical hostname (RFC 1123): %s", cfg.RouterCanonicalHostname)

pkg/cmd/infra/router/template.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ type TemplateRouter struct {
7272
BindPortsAfterSync bool
7373
MaxConnections string
7474
Ciphers string
75+
StrictSNI bool
7576
MetricsType string
7677
}
7778

@@ -102,6 +103,7 @@ func (o *TemplateRouter) Bind(flag *pflag.FlagSet) {
102103
flag.BoolVar(&o.BindPortsAfterSync, "bind-ports-after-sync", util.Env("ROUTER_BIND_PORTS_AFTER_SYNC", "") == "true", "Bind ports only after route state has been synchronized")
103104
flag.StringVar(&o.MaxConnections, "max-connections", util.Env("ROUTER_MAX_CONNECTIONS", ""), "Specifies the maximum number of concurrent connections.")
104105
flag.StringVar(&o.Ciphers, "ciphers", util.Env("ROUTER_CIPHERS", ""), "Specifies the cipher suites to use. You can choose a predefined cipher set ('modern', 'intermediate', or 'old') or specify exact cipher suites by passing a : separated list.")
106+
flag.BoolVar(&o.StrictSNI, "strict-sni", util.Env("ROUTER_STRICT_SNI", "") == "true", "Use strict-sni bind processing (do not use default cert).")
105107
flag.StringVar(&o.MetricsType, "metrics-type", util.Env("ROUTER_METRICS_TYPE", ""), "Specifies the type of metrics to gather. Supports 'haproxy'.")
106108
}
107109

@@ -302,6 +304,7 @@ func (o *TemplateRouterOptions) Run() error {
302304
AllowWildcardRoutes: o.RouterSelection.AllowWildcardRoutes,
303305
MaxConnections: o.MaxConnections,
304306
Ciphers: o.Ciphers,
307+
StrictSNI: o.StrictSNI,
305308
}
306309

307310
oc, kc, err := o.Config.Clients()

pkg/router/template/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type TemplatePluginConfig struct {
5555
BindPortsAfterSync bool
5656
MaxConnections string
5757
Ciphers string
58+
StrictSNI bool
5859
}
5960

6061
// routerInterface controls the interaction of the plugin with the underlying router implementation

test/cmd/router.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ os::cmd::expect_failure_and_text 'oadm router --dry-run --host-network=false --h
4444
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --max-connections=14583 -o yaml' '14583'
4545
# ciphers
4646
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --ciphers=modern -o yaml' 'modern'
47+
# strict-sni
48+
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --strict-sni -o yaml' 'ROUTER_STRICT_SNI'
4749

4850
# mount tls crt as secret
4951
os::cmd::expect_success_and_not_text 'oadm router --dry-run --host-network=false --host-ports=false -o yaml' 'value: /etc/pki/tls/private/tls.crt'

0 commit comments

Comments
 (0)