updated haproxy state

This commit is contained in:
Paul 2023-06-23 08:47:25 +02:00
parent ee05a512bc
commit 8b0aa2cced
5 changed files with 16 additions and 13 deletions

View File

@ -1,10 +1,10 @@
--- ---
{%- from "haproxy/map.jinja" import haproxy with context %} {%- from "haproxy/map.jinja" import haproxy with context %}
{% for filename in haproxy.maps %} {% for map in haproxy.maps %}
haproxy-maps-{{ filename }}: haproxy-maps-{{ map }}:
file.managed: file.managed:
- name: {{ haproxy.config.dir }}/maps/{{ filename }} - name: {{ haproxy.config.dir }}/maps/{{ map }}
- source: salt://haproxy/templates/maps/{{ filename }}.j2 - source: salt://haproxy/templates/maps/{{ map }}.j2
- user: {{ haproxy.config.user }} - user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }} - group: {{ haproxy.config.group }}
- mode: "0600" - mode: "0600"

View File

@ -106,12 +106,16 @@ haproxy:
- application/json - application/json
- application/octet-stream - application/octet-stream
cache: cache:
size: 50000 total: 128
size: 8
age: 86400
file_types: file_types:
- .css - .css
- .ico
- .jpeg
- .jpg
- .js - .js
- .png - .png
- .jpg
- .svg - .svg
- .webp - .webp
ddos: ddos:

View File

@ -24,7 +24,7 @@ core.register_action("collector", { "http-req" }, function(txn)
info["path"] = reqpath info["path"] = reqpath
local infojson = json.encode(info) local infojson = json.encode(info)
-- httpclient is a haproxy 2.5 class -- httpclient is a haproxy 2.5+ class
local req = httpclient:post{url="https://ipbl.paulbsd.com", body=infojson} local req = httpclient:post{url="https://ipbl.paulbsd.com", body=infojson}
txn.Info(txn, infojson) txn.Info(txn, infojson)

View File

@ -1,4 +1,3 @@
--local socket = require("socket")
local sleep_secs=15 local sleep_secs=15
local args = table.pack(...) local args = table.pack(...)

View File

@ -109,16 +109,16 @@ peers paulbsd
# Cache # Cache
cache static cache static
total-max-size 64 total-max-size {{ haproxy.config.cache.total|default(64) }}
max-object-size {{ haproxy.config.cache.size|default(5000) }} max-object-size {{ (haproxy.config.cache.size|default(8))*1024*1024 }}
max-age 120 max-age {{ haproxy.config.cache.age|default(3600) }}
# Per IP rates stick table # Per IP rates stick table
backend per_ip_rates from {{ haproxy.config.namespace }} backend per_ip_rates from {{ haproxy.config.namespace }}
stick-table type string size {{ haproxy.config.ddos.size|default("1m") }} expire {{ haproxy.config.ddos.timeperiod|default("10s") }} store http_req_rate({{ haproxy.config.ddos.timeperiod|default("10s")}}) {{ "peers paulbsd" if haproxy.config.peers.hosts }} stick-table type string size {{ haproxy.config.ddos.size|default("1m") }} expire {{ haproxy.config.ddos.timeperiod|default("10s") }} store http_req_rate({{ haproxy.config.ddos.timeperiod|default("10s")}}) {{ "peers paulbsd" if haproxy.config.peers.hosts }}
# Default HTTP frontend # Default HTTP frontend
frontend http from {{ haproxy.config.namespace }} frontend fe_http from {{ haproxy.config.namespace }}
bind *:{{ haproxy.config.http_port }},:::{{ haproxy.config.http_port }} v4v6 name http bind *:{{ haproxy.config.http_port }},:::{{ haproxy.config.http_port }} v4v6 name http
mode http mode http
{% for name, service in haproxy.config.spoe.items() %} {% for name, service in haproxy.config.spoe.items() %}
@ -143,7 +143,7 @@ frontend http from {{ haproxy.config.namespace }}
http-request redirect scheme https if http http-request redirect scheme https if http
# Default HTTPS frontend # Default HTTPS frontend
frontend https from {{ haproxy.config.namespace }} frontend fe_https from {{ haproxy.config.namespace }}
.if feature(QUIC) .if feature(QUIC)
bind quic4@*:{{ haproxy.config.https_port }},quic6@:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h3,h2,http/1.1{% endif %} name https bind quic4@*:{{ haproxy.config.https_port }},quic6@:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h3,h2,http/1.1{% endif %} name https
.else .else