HSTS annotations for routes dont seem to work
[provide a description of the issue] Annotating external route with hsts header does not result in the header being set.
Version
oc v3.9.0+ba7faec-1 kubernetes v1.9.1+a0ce1bc657 features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://XXX.XXX.XXX:8443 openshift v3.9.0+ba7faec-1 kubernetes v1.9.1+a0ce1bc657
Steps To Reproduce
- create an external route with edge termination
- annote the route with
oc annotate route nginx haproxy.router.openshift.io/hsts_header="max-age=15552000;includeSubDomains;" - Request a resource from this route and check for the presence of Strict-Transport-Security header
Current Result
No Strict-Transport-Security header is set on a reply
Expected Result
Replies from the external route have Strict-Transport-Security header set
Additional Information
I checked the generated haproxy config on one of the routers but Strict-Transport-Security header is nowhere to be found. The config template however does have the logic for adding this header
root@n1 ~ # oc rsh router-2-gd5m8
sh-4.2$ pwd
/var/lib/haproxy/conf
sh-4.2$ grep hsts haproxy-config.template
{{- /* hsts header in response: */}}
{{- $hstsOptionalTokenPattern := `(?:includeSubDomains|preload)` }}
{{- $hstsPattern := printf `(?:%[1]s[;])*max-age=(?:\d+|"\d+")(?:[;]%[1]s)*` $hstsOptionalTokenPattern -}}
{{- with $hsts := firstMatch $hstsPattern (index $cfg.Annotations "haproxy.router.openshift.io/hsts_header") }}
http-response set-header Strict-Transport-Security {{$hsts}}
{{- end }}{{/* hsts header */}}
sh-4.2$ grep hsts haproxy.config
sh-4.2$
Checking the router logs it seems to refresh its configuration upon route annotation however the resulting config file does not include Strict-Transport-Security header.
I also manually started a new router deployment after annotating the route however this also does not produce the expected results.
@openshift/sig-networking
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle rotten /remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.
/close
@openshift-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting
/reopen. Mark the issue as fresh by commenting/remove-lifecycle rotten. Exclude this issue from closing again by commenting/lifecycle frozen./close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.