Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not serve certificate content for Non-SSL routes #14621

Merged
merged 1 commit into from
Jun 16, 2017

Conversation

pecameron
Copy link
Contributor

@pecameron pecameron commented Jun 13, 2017

By default, when a host does not resolve to a route in a HTTPS or tls
sni request, the default cert is returned to the caller as part of the
503 response. This exposes the default cert and may pose security
concerns. Haproxy strict-sni option to bind suppresses use of the
default cert.

This adds a new environment variable to the router deployment controller,
ROUTER_STRICT_SNI, to control bind processing. When set to "true" or
"TRUE", "strict-sni" is added to the bind. Default is "false".

oc adm router --strict-sni sets ROUTER_STRICT_SNI="true"

bug 1369865
https://bugzilla.redhat.com/show_bug.cgi?id=1369865

@pecameron
Copy link
Contributor Author

@rajatchopra @knobunc First part, haproxy-template.conf change. PTAL

@pecameron
Copy link
Contributor Author

@knobunc @rajatchopra @JacobTanenbaum Added command option PTAL

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks great. Thanks.

@@ -204,7 +204,7 @@ backend be_sni

frontend fe_sni
# terminate ssl on edge
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
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3 {{ if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") -}} strict-sni {{ end }}{{ 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
Copy link
Contributor

@knobunc knobunc Jun 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks right to me, but I'd like to see some whitespace so I can follow what we are doing a little more clearly:

bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3 
  {{- if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") }} strict-sni {{ end }}
  {{- 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

@knobunc
Copy link
Contributor

knobunc commented Jun 14, 2017

@openshift/networking PTAL

@knobunc knobunc changed the title Donot serve certificate content for Non-SSL routes Do not serve certificate content for Non-SSL routes Jun 14, 2017
@pecameron
Copy link
Contributor Author

@knobunc PTAL

@@ -44,6 +44,8 @@ os::cmd::expect_failure_and_text 'oadm router --dry-run --host-network=false --h
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --max-connections=14583 -o yaml' '14583'
# ciphers
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --ciphers=modern -o yaml' 'modern'
# strict-sni
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --strict-sni -o yaml' 'ROUTER_STRICT_SNI'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check sufficient? You always set the variable, but to true or false as appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should check the value

@@ -204,7 +204,10 @@ backend be_sni

frontend fe_sni
# terminate ssl on edge
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
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3
{{- if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") }} strict-sni {{ end }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this end up putting 'strict-sni' on the same line as 'bind 127.0.0.1'? (Assuming {{-' only removes leading spaces)

Copy link
Contributor

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -204,7 +204,10 @@ backend be_sni

frontend fe_sni
# terminate ssl on edge
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
bind 127.0.0.1:{{env "ROUTER_SERVICE_SNI_PORT" "10444"}} ssl no-sslv3
{{- if matchPattern "true|TRUE" (env "ROUTER_STRICT_SNI" "") }} strict-sni {{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this collapse on the previous line? not sure how the white-space collapse works.
All else looks good.

@knobunc
Copy link
Contributor

knobunc commented Jun 14, 2017

[test]

@pravisankar
Copy link

@pecameron Can you split this change into 2 commits. One commit for the actual change and another commit for the auto generated stuff that way it will be cleaner.
I added one other comment, otherwise change looks good.

@knobunc
Copy link
Contributor

knobunc commented Jun 14, 2017

@pravisankar is that safe? Won't one commit fail tests because the autogen stuff isn't current? Thus it will break bisect? Or are you asking that we do it for the PR only and then squash before it is merged?

By default, when a host does not resolve to a route in a HTTPS or tls
sni request, the default cert is returned to the caller as part of the
503 response. This exposes the default cert and may pose security
concerns. Haproxy strict-sni option to bind suppresses use of the
default cert.

This adds a new environment variable to the router deployment controller,
ROUTER_STRICT_SNI, to control bind processing. When set to "true" or
"TRUE", "strict-sni" is added to the bind. Default is "false".

oc adm router --strict-sni sets ROUTER_STRICT_SNI="true"

bug 1369865
https://bugzilla.redhat.com/show_bug.cgi?id=1369865
Copy link
Contributor

@JacobTanenbaum JacobTanenbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we setting this on the cli and with an environment variable?

@@ -44,6 +44,8 @@ os::cmd::expect_failure_and_text 'oadm router --dry-run --host-network=false --h
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --max-connections=14583 -o yaml' '14583'
# ciphers
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --ciphers=modern -o yaml' 'modern'
# strict-sni
os::cmd::expect_success_and_text 'oadm router --dry-run --host-network=false --host-ports=false --strict-sni -o yaml' 'ROUTER_STRICT_SNI'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should check the value

@pravisankar
Copy link

pravisankar commented Jun 14, 2017 via email

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knobunc
Copy link
Contributor

knobunc commented Jun 14, 2017

[merge][severity: blocker]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to e8638ae

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2240/) (Base Commit: 0be6aee)

@pecameron
Copy link
Contributor Author

pecameron commented Jun 15, 2017 via email

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to e8638ae

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 16, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1017/) (Base Commit: 6d961d6) (PR Branch Commit: e8638ae) (Extended Tests: blocker) (Image: devenv-rhel7_6366)

pecameron added a commit to pecameron/openshift-docs that referenced this pull request Jun 16, 2017
Openshift 3.6

By default, when a host does not resolve to a route in a HTTPS or tls
sni request, the default cert is returned to the caller as part of the
503 response. This exposes the default cert and may pose security
concerns. Haproxy strict-sni option to bind suppresses use of the
default cert.

This adds a new environment variable to the router deployment
controller, ROUTER_STRICT_SNI, to control bind processing. When set
to "true" or "TRUE", "strict-sni" is added to the bind. Default
is "false".

oc adm router --strict-sni

sets ROUTER_STRICT_SNI="true"

origin PR 14621
openshift/origin#14621

bug 1369865
https://bugzilla.redhat.com/show_bug.cgi?id=1369865
@pecameron pecameron deleted the br1369865 branch July 27, 2017 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants