blob: 8c2554efea867d09ed35aa48c026e1d50cf36e81 [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002# Copyright © 2018 Amdocs, Bell Canada, AT&T
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010015*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010016global
17 log /dev/log local0
18 stats socket /usr/local/etc/haproxy/haproxy.socket mode 660 level admin
19 stats timeout 30s
leila8bd5bf32022-11-16 19:42:09 -050020 # it is required else pod will not come up
21 maxconn 50000
Niharika Sharma22a994c2022-11-25 11:32:27 -050022 user haproxy
23 group haproxy
Sylvain Desbureaux70070412020-11-09 21:58:48 +010024 daemon
25 #################################
26 # Default SSL material locations#
27 #################################
28 ca-base /etc/ssl/certs
29 crt-base /etc/ssl/private
30
31 # Default ciphers to use on SSL-enabled listening sockets.
32 # For more information, see ciphers(1SSL). This list is from:
33 # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
34 # An alternative list with additional directives can be obtained from
35 # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
36 tune.ssl.default-dh-param 2048
37
38defaults
39 log global
40 mode http
41 option httplog
osk1146127fd7d82021-06-18 00:51:17 +020042{{- if ( include "common.needTLS" .) }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010043 option ssl-hello-chk
osk1146127fd7d82021-06-18 00:51:17 +020044{{- end }}
leila8bd5bf32022-11-16 19:42:09 -050045 option httpchk
46 http-check send meth GET uri /aai/util/echo ver HTTP/1.1 hdr Host aai hdr X-TransactionId haproxy-0111 hdr X-FromAppId haproxy hdr Accept application/json hdr Authorization 'Basic QUFJOkFBSQ=='
Sylvain Desbureaux70070412020-11-09 21:58:48 +010047 default-server init-addr none
48# option dontlognull
49# errorfile 400 /etc/haproxy/errors/400.http
50# errorfile 403 /etc/haproxy/errors/403.http
51# errorfile 408 /etc/haproxy/errors/408.http
52# errorfile 500 /etc/haproxy/errors/500.http
53# errorfile 502 /etc/haproxy/errors/502.http
54# errorfile 503 /etc/haproxy/errors/503.http
55# errorfile 504 /etc/haproxy/errors/504.http
56
57 option http-server-close
58 option forwardfor except 127.0.0.1
59 retries 6
60 option redispatch
61 maxconn 50000
62 timeout connect 50000
63 timeout client 480000
64 timeout server 480000
65 timeout http-keep-alive 30000
66
leila8bd5bf32022-11-16 19:42:09 -050067frontend stats
68 bind *:8448
69 http-request use-service prometheus-exporter if { path /metrics }
70 stats enable
71 stats uri /stats
72 stats refresh 10s
Sylvain Desbureaux70070412020-11-09 21:58:48 +010073
osk1146127fd7d82021-06-18 00:51:17 +020074frontend IST_8080
75 mode http
76 bind 0.0.0.0:8080
77 log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \ %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
78 option httplog
79 log global
80 option logasap
81 option forwardfor
82 capture request header Host len 100
83 capture response header Host len 100
84 option log-separate-errors
85 option forwardfor
86 http-request set-header X-Forwarded-Proto http
leila8bd5bf32022-11-16 19:42:09 -050087 http-request set-header X-Forwarded-Proto http
88 http-request add-header X-Forwarded-Port 8080
osk1146127fd7d82021-06-18 00:51:17 +020089
90#######################
91#ACLS FOR PORT 8446####
92#######################
93
94 acl is_Port_8446_generic path_reg -i ^/aai/v[0-9]+/search/generic-query$
95 acl is_Port_8446_nodes path_reg -i ^/aai/v[0-9]+/search/nodes-query$
96 acl is_Port_8446_version path_reg -i ^/aai/v[0-9]+/query$
97 acl is_dsl path_reg -i ^/aai/v[0-9]+/dsl$
98 acl is_named-query path_beg -i /aai/search/named-query
99 acl is_search-model path_beg -i /aai/search/model
100 use_backend IST_AAI_8446 if is_Port_8446_generic or is_Port_8446_nodes or is_Port_8446_version or is_named-query or is_search-model or is_dsl
101
102 default_backend IST_Default_8447
103
104{{- if ( include "common.needTLS" .) }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105frontend IST_8443
106 mode http
Sylvain Desbureaux87f49af2020-12-15 11:56:51 +0100107 bind 0.0.0.0:8443 name https ssl crt /opt/app/osaaf/local/certs/fullchain.pem
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100108# log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ {%[ssl_c_verify],%{+Q}[ssl_c_s_dn],%{+Q}[ssl_c_i_dn]}\ %{+Q}r
109 log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \ %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
110 option httplog
111 log global
112 option logasap
113 option forwardfor
114 capture request header Host len 100
115 capture response header Host len 100
116 option log-separate-errors
117 option forwardfor
leila8bd5bf32022-11-16 19:42:09 -0500118
119 http-request set-header X-Forwarded-Proto https
120 http-request add-header X-Forwarded-Port 8443
121
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100122 http-request set-header X-Forwarded-Proto https if { ssl_fc }
123 http-request set-header X-AAI-Client-SSL TRUE if { ssl_c_used }
124 http-request set-header X-AAI-SSL %[ssl_fc]
125 http-request set-header X-AAI-SSL-Client-Verify %[ssl_c_verify]
126 http-request set-header X-AAI-SSL-Client-DN %{+Q}[ssl_c_s_dn]
127 http-request set-header X-AAI-SSL-Client-CN %{+Q}[ssl_c_s_dn(cn)]
128 http-request set-header X-AAI-SSL-Issuer %{+Q}[ssl_c_i_dn]
129 http-request set-header X-AAI-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore]
130 http-request set-header X-AAI-SSL-Client-NotAfter %{+Q}[ssl_c_notafter]
131 http-request set-header X-AAI-SSL-ClientCert-Base64 %{+Q}[ssl_c_der,base64]
132 http-request set-header X-AAI-SSL-Client-OU %{+Q}[ssl_c_s_dn(OU)]
133 http-request set-header X-AAI-SSL-Client-L %{+Q}[ssl_c_s_dn(L)]
134 http-request set-header X-AAI-SSL-Client-ST %{+Q}[ssl_c_s_dn(ST)]
135 http-request set-header X-AAI-SSL-Client-C %{+Q}[ssl_c_s_dn(C)]
136 http-request set-header X-AAI-SSL-Client-O %{+Q}[ssl_c_s_dn(O)]
Suresh Charanc1aa7582022-01-31 06:25:37 -0500137#######################################
138## Request blocking configuration ###
139#######################################
140 {{- if eq $.Values.haproxy.requestBlocking.enabled true }}
141 {{- range $custom_config := $.Values.haproxy.requestBlocking.customConfigs }}
142 {{ $custom_config }}
143 {{- end }}
144 {{- end }}
145
osk1146127fd7d82021-06-18 00:51:17 +0200146{{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100147
148#######################
149#ACLS FOR PORT 8446####
150#######################
151
152 acl is_Port_8446_generic path_reg -i ^/aai/v[0-9]+/search/generic-query$
153 acl is_Port_8446_nodes path_reg -i ^/aai/v[0-9]+/search/nodes-query$
154 acl is_Port_8446_version path_reg -i ^/aai/v[0-9]+/query$
155 acl is_dsl path_reg -i ^/aai/v[0-9]+/dsl$
156 acl is_named-query path_beg -i /aai/search/named-query
157 acl is_search-model path_beg -i /aai/search/model
158 use_backend IST_AAI_8446 if is_Port_8446_generic or is_Port_8446_nodes or is_Port_8446_version or is_named-query or is_search-model or is_dsl
159
160 default_backend IST_Default_8447
161
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100162#######################
osk1146127fd7d82021-06-18 00:51:17 +0200163#DEFAULT BACKEND 8447##
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100164#######################
165
166backend IST_Default_8447
167 balance roundrobin
leila8bd5bf32022-11-16 19:42:09 -0500168 stick-table type string len 100 size 200k expire 2m
169 stick on path
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100170 http-request set-header X-Forwarded-Port %[src_port]
171 http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload;
osk1146127fd7d82021-06-18 00:51:17 +0200172{{- if ( include "common.needTLS" .) }}
leila8bd5bf32022-11-16 19:42:09 -0500173 server-template aai-resources.{{.Release.Namespace}} {{$.Values.haproxy.replicas.aaiResources}} aai-resources.{{.Release.Namespace}}.svc.cluster.local:8447 resolvers kubernetes check check-ssl port 8447 ssl verify none
osk1146127fd7d82021-06-18 00:51:17 +0200174{{- else }}
leila8bd5bf32022-11-16 19:42:09 -0500175 server-template aai-resources.{{.Release.Namespace}} {{$.Values.haproxy.replicas.aaiResources}} aai-resources.{{.Release.Namespace}}.svc.cluster.local:8447 resolvers kubernetes check port 8447
osk1146127fd7d82021-06-18 00:51:17 +0200176{{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100177
178#######################
179# BACKEND 8446#########
180#######################
181
182backend IST_AAI_8446
183 balance roundrobin
leila8bd5bf32022-11-16 19:42:09 -0500184 stick-table type string len 100 size 200k expire 2m
185 stick on path
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100186 http-request set-header X-Forwarded-Port %[src_port]
187 http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload;
osk1146127fd7d82021-06-18 00:51:17 +0200188{{- if ( include "common.needTLS" .) }}
leila8bd5bf32022-11-16 19:42:09 -0500189 server-template aai-traversal.{{.Release.Namespace}} {{$.Values.haproxy.replicas.aaiTraversal}} aai-traversal.{{.Release.Namespace}}.svc.cluster.local:8446 resolvers kubernetes check check-ssl port 8446 ssl verify none
osk1146127fd7d82021-06-18 00:51:17 +0200190{{- else }}
leila8bd5bf32022-11-16 19:42:09 -0500191 server-template aai-traversal.{{.Release.Namespace}} {{$.Values.haproxy.replicas.aaiTraversal}} aai-traversal.{{.Release.Namespace}}.svc.cluster.local:8446 resolvers kubernetes check port 8446
osk1146127fd7d82021-06-18 00:51:17 +0200192{{- end }}