Compare commits

...

5 Commits

Author SHA1 Message Date
6fef250c0d OP#669 update Readme 2026-09-05 14:42:31 +02:00
06dbd0fbd0 OP#669 update Readme 2026-09-05 13:31:04 +02:00
a399dde784 OP#669 set hy_selinux_allow_status to true by default 2026-09-05 13:09:55 +02:00
cb54dad12a OP#669 get rid of hy_show_stats as it does not make sense 2026-09-05 13:08:12 +02:00
281ce92cd8 OP#669 fix head 2026-09-05 13:01:40 +02:00
5 changed files with 42 additions and 14 deletions

View File

@@ -1,13 +1,16 @@
{
"cSpell.words": [
"allowdupe",
"dontlognull",
"dport",
"forwardfor",
"httplog",
"managehome",
"maxconn",
"nologin",
"pidfile",
"redispatch",
"roundrobin",
"sess",
"setsebool",
"tcplog",

View File

@@ -10,6 +10,7 @@
- [Deployment](#deployment)
- [Parameters](#parameters)
- [Proxy Configuration](#proxy-configuration)
- [TLS](#tls)
- [SELINUX](#selinux)
- [Known Problems](#known-problems)
- [Support](#support)
@@ -42,18 +43,19 @@ CONFIGURATION
- front-end options
- back-end options
- ACL options
- manage fail2ban integration (optional, requires fail2ban_cd module)
- adds haproxy logs to rsyslog for remote logging where used
- manage fail2ban integration (optional, requires `confdroid_fail2ban` module)
SERVICE
- manage haproxy service
- restart service after changes in the configuration
- stats are enabled on port 8404 with uri /haproxy?stats and strict private mode, set `hy_stats_auth` to something meaningful.
## Dependencies
All dependencies must be included in the catalogue.
- [cd_resources](https://gitlab.confdroid.com/puppet/cd_resources) for managing yum base repos
- [concat](https://github.com/puppetlabs/puppetlabs-concat) for managing file fragments
## Deployment
@@ -83,6 +85,8 @@ The parameters are documented via puppet strings and [listed here](/docs/index.h
The proxy instances are configured in /etc/haproxy/haproxy.cfg, which is concatenated from various templates through a define in this puppet module.
In order to create proxy instances, you will need an external class, which addresses the define, like so:
ACL rule:
```bash
confdroid_haproxy::server::proxy { 'testing':
haproxy_fqdn => 'node.example.net',
@@ -94,14 +98,41 @@ In order to create proxy instances, you will need an external class, which addre
}
```
real Proxy for https:
```bash
haproxy_cd::server::proxy { 'https-in':
haproxy_fqdn => 'node.example.net',
frontend_name => 'https-in',
frontend_mode => 'http',
fe_bind_mode => '*:443 ssl crt /etc/haproxy/certs/',
fe_option => 'forwardfor',
fe_http_request => 'add-header X-Forwarded-Proto https',
acl_rule_front => 'host_grafana hdr(host) -i grafana.example.net',
fe_use_backend => 'grafana_backend if host_grafana',
backend_configs => [
{
'backend_name' => 'grafana_backend',
'be_mode' => 'http',
'be_balance' => 'roundrobin',
'be_server_name_array' => ['node1 10.0.1.1:8080 check'],
}
]
default_backend => 'error_backend',
```
This allows the puppet module to create the sections in the configuration file as required. The haproxy service will be restarted after the changes in the configuration file are made.
`haproxy_fqdn` **must**- contain the fqdn of the haproxy **server**- where this should be configured, otherwise the templates are not being populated.
Multiple ACLs need to be added as array, and will create one line each.
## TLS
Haproxy can manage all sorts of proxies including http and https. It also can terminate https requests and send the requests within a private network unencrypted, which is quite common. **This module is NOT managing certificates**, as there are many ways to manage this, including Kubernetes cert-manager, Let's encrypt or other ways.
## SELINUX
All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.
If selinux is set to `enforce` (not controlled within this module) and `hy_show_stats`is set to `true`, the parameter `hy_selinux_allow_stats` must also be set to `true`, else the haproxy service will not start as selinux will not allow it.
If selinux is set to `enforce` (not controlled within this module), the parameter `hy_selinux_allow_stats` must also be set to `true`, else the haproxy service will not start as selinux will not allow it. This is the default setting.
## Known Problems

View File

@@ -19,7 +19,6 @@ class confdroid_haproxy::firewall::iptables (
jump => 'accept',
}
if $hy_show_stats == true {
firewall { "${hy_fw_order_no}${hy_stats_port} tcp port ${hy_stats_port}":
proto => 'tcp',
dport => $hy_stats_port,
@@ -27,4 +26,3 @@ class confdroid_haproxy::firewall::iptables (
}
}
}
}

View File

@@ -23,7 +23,6 @@
# @param [String] hy_chroot where the chroot should be
# @param [String] hy_pid the pid file to use.
# @param [String] hy_maxconn how many connections should we max allow.
# @param [Boolean] hy_show_stats whether we want to display the statistics page
# @param [String] hy_stats_socket name and path of the stats socket
# @param [String] hy_default_mode which mode to use in the defaults block
# @param [String] hy_log_default should be used when the instance's logging
@@ -72,7 +71,7 @@ class confdroid_haproxy::params (
Boolean $hy_manage_fail2ban = false,
# selinux
Boolean $hy_selinux_allow_stats = false,
Boolean $hy_selinux_allow_stats = true,
# main config
String $hy_http_port = '80',
@@ -81,7 +80,6 @@ class confdroid_haproxy::params (
String $hy_chroot = '/var/lib/haproxy',
String $hy_pid = '/var/run/haproxy.pid',
String $hy_maxconn = '4000',
Boolean $hy_show_stats = false,
String $hy_stats_socket = '/var/lib/haproxy/stats',
String $hy_default_mode = 'tcp',
Boolean $hy_use_http_server_close = false,

View File

@@ -50,7 +50,6 @@ defaults
timeout check <%= @hy_timeout_check %>
maxconn <%= @hy_maxconn %>
<% if @hy_show_stats == true -%>
listen stats
bind *:8404
mode http
@@ -60,7 +59,6 @@ listen stats
stats auth <%= @hy_stats_auth %>
stats refresh 30s
stats admin if TRUE # Allow admin actions if logged in
<% end -%>
<% if @hy_manage_be_users == true -%>
<%= @hy_be_userlist %>