Compare commits

...

34 Commits

Author SHA1 Message Date
Jenkins Server
78b2a3963e Recommit for updates in build 15 2026-09-07 16:17:25 +02:00
Jenkins Server
abac5926d4 Merge remote-tracking branch 'origin/master' into jenkins-build-15 2026-09-07 16:16:16 +02:00
6c1b999d4b OP#672 change check to verify only if 1 process or is running, so it alerts only if no process at all is running 2026-09-07 16:15:56 +02:00
Jenkins Server
67b1681012 Recommit for updates in build 14 2026-09-07 16:04:14 +02:00
Jenkins Server
8070426dd7 Merge remote-tracking branch 'origin/master' into jenkins-build-14 2026-09-07 16:03:11 +02:00
014c663e30 OP#672 update Readme 2026-09-07 16:02:54 +02:00
Jenkins Server
958caf7c66 Recommit for updates in build 13 2026-09-07 15:45:54 +02:00
Jenkins Server
fa9138acb9 Merge remote-tracking branch 'origin/master' into jenkins-build-13 2026-09-07 15:44:56 +02:00
541e3672b7 OP#672 add service target for haproxy 2026-09-07 15:44:39 +02:00
Jenkins Server
7cfeb74c91 Recommit for updates in build 12 2026-09-07 14:56:05 +02:00
Jenkins Server
c20f099570 Merge remote-tracking branch 'origin/master' into jenkins-build-12 2026-09-07 14:55:06 +02:00
ad2428456a OP#706 extend exec to run only if found off 2026-09-07 14:54:48 +02:00
Jenkins Server
9dcbd4dc96 Recommit for updates in build 11 2026-09-05 14:49:34 +02:00
Jenkins Server
1173a0f1ea Merge remote-tracking branch 'origin/master' into jenkins-build-11 2026-09-05 14:48:32 +02:00
7df6938b04 OP#669 add badges 2026-09-05 14:48:16 +02:00
Jenkins Server
7eca92f312 Recommit for updates in build 10 2026-09-05 14:43:48 +02:00
Jenkins Server
57aa6620ef Merge remote-tracking branch 'origin/master' into jenkins-build-10 2026-09-05 14:42:48 +02:00
6fef250c0d OP#669 update Readme 2026-09-05 14:42:31 +02:00
Jenkins Server
3ba353aef4 Recommit for updates in build 9 2026-09-05 13:32:27 +02:00
Jenkins Server
cfed955ac1 Merge remote-tracking branch 'origin/master' into jenkins-build-9 2026-09-05 13:31:23 +02:00
06dbd0fbd0 OP#669 update Readme 2026-09-05 13:31:04 +02:00
Jenkins Server
95feb25654 Recommit for updates in build 8 2026-09-05 13:11:10 +02:00
Jenkins Server
711d817cfb Merge remote-tracking branch 'origin/master' into jenkins-build-8 2026-09-05 13:10:12 +02:00
a399dde784 OP#669 set hy_selinux_allow_status to true by default 2026-09-05 13:09:55 +02:00
Jenkins Server
1467a2d6a3 Recommit for updates in build 7 2026-09-05 13:09:34 +02:00
Jenkins Server
9c72dfbff2 Merge remote-tracking branch 'origin/master' into jenkins-build-7 2026-09-05 13:08:32 +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
Jenkins Server
a05a469ea0 Merge remote-tracking branch 'origin/master' into jenkins-build-6 2026-09-05 13:01:57 +02:00
281ce92cd8 OP#669 fix head 2026-09-05 13:01:40 +02:00
Jenkins Server
aa92f1c5a5 Recommit for updates in build 5 2026-09-05 12:59:46 +02:00
Jenkins Server
b9997604a2 Merge remote-tracking branch 'origin/master' into jenkins-build-5 2026-09-05 12:58:47 +02:00
2e46d610cb OP#669 fix head 2026-09-05 12:58:28 +02:00
af0ddb9f36 OP#669 add fw rule for stats port 2026-09-05 12:56:23 +02:00
Jenkins Server
aab08293a7 Recommit for updates in build 4 2026-09-05 12:54:02 +02:00
16 changed files with 498 additions and 192 deletions

16
.vscode/settings.json vendored
View File

@@ -1,16 +0,0 @@
{
"cSpell.words": [
"dontlognull",
"dport",
"forwardfor",
"httplog",
"maxconn",
"nologin",
"pidfile",
"redispatch",
"sess",
"setsebool",
"tcplog",
"userlist"
]
}

127
Jenkinsfile vendored
View File

@@ -1,127 +0,0 @@
pipeline {
agent {
label 'puppet'
}
post {
always {
deleteDir() /* clean up our workspace */
}
success {
updateGitlabCommitStatus state: 'success'
}
failure {
updateGitlabCommitStatus state: 'failed'
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true])
}
}
options {
gitLabConnection('gitlab.confdroid.com')
}
stages {
stage('pull master') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''
git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
# Ensure we're on the development branch (triggered by push)
git checkout development
# Create jenkins branch from development
git checkout -b jenkins-build-$BUILD_NUMBER
# Optionally merge master into jenkins to ensure compatibility
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
'''
}
}
}
stage('puppet parser') {
steps {
sh '''for file in $(find . -iname \'*.pp\'); do
/opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
done;'''
}
}
stage('check templates') {
steps{
sh '''for file in $(find . -iname \'*.erb\');
do erb -P -x -T "-" $file | ruby -c || exit 1;
done;'''
}
}
stage('puppet-lint') {
steps {
sh '''/usr/local/bin/puppet-lint . \\
--no-variable_scope-check \\
|| { echo "Puppet lint failed"; exit 1; }
'''
}
}
stage('SonarScan') {
steps {
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
sh '''
/opt/sonar-scanner/bin/sonar-scanner \
-Dsonar.projectKey=confdroid_haproxy \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarqube.confdroid.com \
-Dsonar.token=$SONAR_TOKEN
'''
}
}
}
stage('create Puppet documentation') {
steps {
sh '/opt/puppetlabs/bin/puppet strings'
}
}
stage('update repo') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''
git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
git rm -r --cached .vscode || echo "No .vscode to remove from git"
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
git push origin HEAD:master
'''
}
}
}
stage('Mirror to Gitea') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
withCredentials([usernamePassword(
credentialsId: 'Jenkins-gitea',
usernameVariable: 'GITEA_USER',
passwordVariable: 'GITEA_TOKEN')]) {
script {
// Checkout from GitLab (already done implicitly)
sh '''
git checkout master
git pull origin master
git branch -D development
git branch -D jenkins-build-$BUILD_NUMBER
git rm -f Jenkinsfile
git rm -r --cached .vscode || echo "No .vscode to remove from git"
git commit --amend --no-edit --allow-empty
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_haproxy.git
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --mirror
'''
}
}
}
}
}
}
}

View File

@@ -1,6 +1,8 @@
# Readme # Readme
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&style=plastic)](https://jenkins.confdroid.com/job/confdroid_haproxy/) [![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&style=plastic)](https://jenkins.confdroid.com/job/confdroid_haproxy/)
[![Security Hotspots](https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_haproxy&metric=security_hotspots&token=sqb_0205ee61c907f77ebdc1c717b8f4ff568c3724cf)](https://sonarqube.confdroid.com/dashboard?id=confdroid_haproxy)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/grizzlycoda/puppet_collection)
- [Readme](#readme) - [Readme](#readme)
- [Synopsis](#synopsis) - [Synopsis](#synopsis)
@@ -10,6 +12,7 @@
- [Deployment](#deployment) - [Deployment](#deployment)
- [Parameters](#parameters) - [Parameters](#parameters)
- [Proxy Configuration](#proxy-configuration) - [Proxy Configuration](#proxy-configuration)
- [TLS](#tls)
- [SELINUX](#selinux) - [SELINUX](#selinux)
- [Known Problems](#known-problems) - [Known Problems](#known-problems)
- [Support](#support) - [Support](#support)
@@ -42,18 +45,20 @@ CONFIGURATION
- front-end options - front-end options
- back-end options - back-end options
- ACL 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)
- manage nagios integration (optional, requires `confdroid-nagios` module)
SERVICE SERVICE
- manage haproxy service - manage haproxy service
- restart service after changes in the configuration - 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 ## Dependencies
All dependencies must be included in the catalogue. 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 - [concat](https://github.com/puppetlabs/puppetlabs-concat) for managing file fragments
## Deployment ## Deployment
@@ -83,6 +88,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. 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: In order to create proxy instances, you will need an external class, which addresses the define, like so:
ACL rule:
```bash ```bash
confdroid_haproxy::server::proxy { 'testing': confdroid_haproxy::server::proxy { 'testing':
haproxy_fqdn => 'node.example.net', haproxy_fqdn => 'node.example.net',
@@ -94,14 +101,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. 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. `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. 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 ## SELINUX
All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored. 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 ## Known Problems

View File

@@ -108,6 +108,11 @@
</li> </li>
<li>
<span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_haproxy::monitoring::target (puppet_class)">confdroid_haproxy::monitoring::target</a></span>
</li>
<li> <li>
<span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aparams.html" title="puppet_classes::confdroid_haproxy::params (puppet_class)">confdroid_haproxy::params</a></span> <span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aparams.html" title="puppet_classes::confdroid_haproxy::params (puppet_class)">confdroid_haproxy::params</a></span>

View File

@@ -60,7 +60,7 @@
<div id="content"><div id='filecontents'> <div id="content"><div id='filecontents'>
<h1 id="label-Readme">Readme</h1> <h1 id="label-Readme">Readme</h1>
<p><a href="https://jenkins.confdroid.com/job/confdroid_haproxy/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&amp;style=plastic"></a></p> <p><a href="https://jenkins.confdroid.com/job/confdroid_haproxy/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&amp;style=plastic"></a> <a href="https://sonarqube.confdroid.com/dashboard?id=confdroid_haproxy"><img src="https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_haproxy&amp;metric=security_hotspots&amp;token=sqb_0205ee61c907f77ebdc1c717b8f4ff568c3724cf"></a> <a href="https://deepwiki.com/grizzlycoda/puppet_collection"><img src="https://deepwiki.com/badge.svg"></a></p>
<ul><li> <ul><li>
<p><a href="#readme">Readme</a></p> <p><a href="#readme">Readme</a></p>
</li><li> </li><li>
@@ -78,6 +78,8 @@
</li><li> </li><li>
<p><a href="#proxy-configuration">Proxy Configuration</a></p> <p><a href="#proxy-configuration">Proxy Configuration</a></p>
</li><li> </li><li>
<p><a href="#tls">TLS</a></p>
</li><li>
<p><a href="#selinux">SELINUX</a></p> <p><a href="#selinux">SELINUX</a></p>
</li><li> </li><li>
<p><a href="#known-problems">Known Problems</a></p> <p><a href="#known-problems">Known Problems</a></p>
@@ -126,7 +128,11 @@
</li><li> </li><li>
<p>ACL options</p> <p>ACL options</p>
</li><li> </li><li>
<p>manage fail2ban integration (optional, requires fail2ban_cd module)</p> <p>adds haproxy logs to rsyslog for remote logging where used</p>
</li><li>
<p>manage fail2ban integration (optional, requires <code>confdroid_fail2ban</code> module)</p>
</li><li>
<p>manage nagios integration (optional, requires <code>confdroid-nagios</code> module)</p>
</li></ul> </li></ul>
<p>SERVICE</p> <p>SERVICE</p>
@@ -134,14 +140,14 @@
<p>manage haproxy service</p> <p>manage haproxy service</p>
</li><li> </li><li>
<p>restart service after changes in the configuration</p> <p>restart service after changes in the configuration</p>
</li><li>
<p>stats are enabled on port 8404 with uri /haproxy?stats and strict private mode, set <code>hy_stats_auth</code> to something meaningful.</p>
</li></ul> </li></ul>
<h2 id="label-Dependencies">Dependencies</h2> <h2 id="label-Dependencies">Dependencies</h2>
<p>All dependencies must be included in the catalogue.</p> <p>All dependencies must be included in the catalogue.</p>
<ul><li> <ul><li>
<p><a href="https://gitlab.confdroid.com/puppet/cd_resources">cd_resources</a> for managing yum base repos</p>
</li><li>
<p><a href="https://github.com/puppetlabs/puppetlabs-concat">concat</a> for managing file fragments</p> <p><a href="https://github.com/puppetlabs/puppetlabs-concat">concat</a> for managing file fragments</p>
</li></ul> </li></ul>
@@ -172,6 +178,8 @@
<p>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:</p> <p>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:</p>
<p>ACL rule:</p>
<pre class="code ruby"><code class="ruby">confdroid_haproxy::server::proxy { &#39;testing&#39;: <pre class="code ruby"><code class="ruby">confdroid_haproxy::server::proxy { &#39;testing&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;, haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;test01-frontend&#39;, frontend_name =&gt; &#39;test01-frontend&#39;,
@@ -182,11 +190,37 @@
} }
</code></pre> </code></pre>
<p>real Proxy for https:</p>
<pre class="code ruby"><code class="ruby">haproxy_cd::server::proxy { &#39;https-in&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;https-in&#39;,
frontend_mode =&gt; &#39;http&#39;,
fe_bind_mode =&gt; &#39;*:443 ssl crt /etc/haproxy/certs/&#39;,
fe_option =&gt; &#39;forwardfor&#39;,
fe_http_request =&gt; &#39;add-header X-Forwarded-Proto https&#39;,
acl_rule_front =&gt; &#39;host_grafana hdr(host) -i grafana.example.net&#39;,
fe_use_backend =&gt; &#39;grafana_backend if host_grafana&#39;,
backend_configs =&gt; [
{
&#39;backend_name&#39; =&gt; &#39;grafana_backend&#39;,
&#39;be_mode&#39; =&gt; &#39;http&#39;,
&#39;be_balance&#39; =&gt; &#39;roundrobin&#39;,
&#39;be_server_name_array&#39; =&gt; [&#39;node1 10.0.1.1:8080 check&#39;],
}
]
default_backend =&gt; &#39;error_backend&#39;,
</code></pre>
<p>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. <code>haproxy_fqdn</code> <strong>must</strong>- contain the fqdn of the haproxy <strong>server</strong>- 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.</p> <p>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. <code>haproxy_fqdn</code> <strong>must</strong>- contain the fqdn of the haproxy <strong>server</strong>- 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.</p>
<h2 id="label-TLS">TLS</h2>
<p>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. <strong>This module is NOT managing certificates</strong>, as there are many ways to manage this, including Kubernetes cert-manager, Let’s encrypt or other ways.</p>
<h2 id="label-SELINUX">SELINUX</h2> <h2 id="label-SELINUX">SELINUX</h2>
<p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.</p> <p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored. If selinux is set to <code>enforce</code> (not controlled within this module), the parameter <code>hy_selinux_allow_stats</code> must also be set to <code>true</code>, else the haproxy service will not start as selinux will not allow it. This is the default setting.</p>
<h2 id="label-Known+Problems">Known Problems</h2> <h2 id="label-Known+Problems">Known Problems</h2>

View File

@@ -60,7 +60,7 @@
<div id="content"><div id='filecontents'> <div id="content"><div id='filecontents'>
<h1 id="label-Readme">Readme</h1> <h1 id="label-Readme">Readme</h1>
<p><a href="https://jenkins.confdroid.com/job/confdroid_haproxy/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&amp;style=plastic"></a></p> <p><a href="https://jenkins.confdroid.com/job/confdroid_haproxy/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_haproxy&amp;style=plastic"></a> <a href="https://sonarqube.confdroid.com/dashboard?id=confdroid_haproxy"><img src="https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_haproxy&amp;metric=security_hotspots&amp;token=sqb_0205ee61c907f77ebdc1c717b8f4ff568c3724cf"></a> <a href="https://deepwiki.com/grizzlycoda/puppet_collection"><img src="https://deepwiki.com/badge.svg"></a></p>
<ul><li> <ul><li>
<p><a href="#readme">Readme</a></p> <p><a href="#readme">Readme</a></p>
</li><li> </li><li>
@@ -78,6 +78,8 @@
</li><li> </li><li>
<p><a href="#proxy-configuration">Proxy Configuration</a></p> <p><a href="#proxy-configuration">Proxy Configuration</a></p>
</li><li> </li><li>
<p><a href="#tls">TLS</a></p>
</li><li>
<p><a href="#selinux">SELINUX</a></p> <p><a href="#selinux">SELINUX</a></p>
</li><li> </li><li>
<p><a href="#known-problems">Known Problems</a></p> <p><a href="#known-problems">Known Problems</a></p>
@@ -126,7 +128,11 @@
</li><li> </li><li>
<p>ACL options</p> <p>ACL options</p>
</li><li> </li><li>
<p>manage fail2ban integration (optional, requires fail2ban_cd module)</p> <p>adds haproxy logs to rsyslog for remote logging where used</p>
</li><li>
<p>manage fail2ban integration (optional, requires <code>confdroid_fail2ban</code> module)</p>
</li><li>
<p>manage nagios integration (optional, requires <code>confdroid-nagios</code> module)</p>
</li></ul> </li></ul>
<p>SERVICE</p> <p>SERVICE</p>
@@ -134,14 +140,14 @@
<p>manage haproxy service</p> <p>manage haproxy service</p>
</li><li> </li><li>
<p>restart service after changes in the configuration</p> <p>restart service after changes in the configuration</p>
</li><li>
<p>stats are enabled on port 8404 with uri /haproxy?stats and strict private mode, set <code>hy_stats_auth</code> to something meaningful.</p>
</li></ul> </li></ul>
<h2 id="label-Dependencies">Dependencies</h2> <h2 id="label-Dependencies">Dependencies</h2>
<p>All dependencies must be included in the catalogue.</p> <p>All dependencies must be included in the catalogue.</p>
<ul><li> <ul><li>
<p><a href="https://gitlab.confdroid.com/puppet/cd_resources">cd_resources</a> for managing yum base repos</p>
</li><li>
<p><a href="https://github.com/puppetlabs/puppetlabs-concat">concat</a> for managing file fragments</p> <p><a href="https://github.com/puppetlabs/puppetlabs-concat">concat</a> for managing file fragments</p>
</li></ul> </li></ul>
@@ -172,6 +178,8 @@
<p>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:</p> <p>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:</p>
<p>ACL rule:</p>
<pre class="code ruby"><code class="ruby">confdroid_haproxy::server::proxy { &#39;testing&#39;: <pre class="code ruby"><code class="ruby">confdroid_haproxy::server::proxy { &#39;testing&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;, haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;test01-frontend&#39;, frontend_name =&gt; &#39;test01-frontend&#39;,
@@ -182,11 +190,37 @@
} }
</code></pre> </code></pre>
<p>real Proxy for https:</p>
<pre class="code ruby"><code class="ruby">haproxy_cd::server::proxy { &#39;https-in&#39;:
haproxy_fqdn =&gt; &#39;node.example.net&#39;,
frontend_name =&gt; &#39;https-in&#39;,
frontend_mode =&gt; &#39;http&#39;,
fe_bind_mode =&gt; &#39;*:443 ssl crt /etc/haproxy/certs/&#39;,
fe_option =&gt; &#39;forwardfor&#39;,
fe_http_request =&gt; &#39;add-header X-Forwarded-Proto https&#39;,
acl_rule_front =&gt; &#39;host_grafana hdr(host) -i grafana.example.net&#39;,
fe_use_backend =&gt; &#39;grafana_backend if host_grafana&#39;,
backend_configs =&gt; [
{
&#39;backend_name&#39; =&gt; &#39;grafana_backend&#39;,
&#39;be_mode&#39; =&gt; &#39;http&#39;,
&#39;be_balance&#39; =&gt; &#39;roundrobin&#39;,
&#39;be_server_name_array&#39; =&gt; [&#39;node1 10.0.1.1:8080 check&#39;],
}
]
default_backend =&gt; &#39;error_backend&#39;,
</code></pre>
<p>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. <code>haproxy_fqdn</code> <strong>must</strong>- contain the fqdn of the haproxy <strong>server</strong>- 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.</p> <p>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. <code>haproxy_fqdn</code> <strong>must</strong>- contain the fqdn of the haproxy <strong>server</strong>- 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.</p>
<h2 id="label-TLS">TLS</h2>
<p>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. <strong>This module is NOT managing certificates</strong>, as there are many ways to manage this, including Kubernetes cert-manager, Let’s encrypt or other ways.</p>
<h2 id="label-SELINUX">SELINUX</h2> <h2 id="label-SELINUX">SELINUX</h2>
<p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.</p> <p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored. If selinux is set to <code>enforce</code> (not controlled within this module), the parameter <code>hy_selinux_allow_stats</code> must also be set to <code>true</code>, else the haproxy service will not start as selinux will not allow it. This is the default setting.</p>
<h2 id="label-Known+Problems">Known Problems</h2> <h2 id="label-Known+Problems">Known Problems</h2>

View File

@@ -96,14 +96,21 @@
</li> </li>
<li id="object_puppet_classes::confdroid_haproxy::params" class="odd"> <li id="object_puppet_classes::confdroid_haproxy::monitoring::target" class="odd">
<div class="item">
<span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_haproxy::monitoring::target (puppet_class)">confdroid_haproxy::monitoring::target</a></span>
</div>
</li>
<li id="object_puppet_classes::confdroid_haproxy::params" class="even">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aparams.html" title="puppet_classes::confdroid_haproxy::params (puppet_class)">confdroid_haproxy::params</a></span> <span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aparams.html" title="puppet_classes::confdroid_haproxy::params (puppet_class)">confdroid_haproxy::params</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::confdroid_haproxy::server::service" class="even"> <li id="object_puppet_classes::confdroid_haproxy::server::service" class="odd">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aserver_3A_3Aservice.html" title="puppet_classes::confdroid_haproxy::server::service (puppet_class)">confdroid_haproxy::server::service</a></span> <span class='object_link'><a href="puppet_classes/confdroid_haproxy_3A_3Aserver_3A_3Aservice.html" title="puppet_classes::confdroid_haproxy::server::service (puppet_class)">confdroid_haproxy::server::service</a></span>
</div> </div>

View File

@@ -117,7 +117,13 @@
19 19
20 20
21 21
22</pre> 22
23
24
25
26
27
28</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/firewall/iptables.pp', line 6</span> <pre class="code"><span class="info file"># File 'manifests/firewall/iptables.pp', line 6</span>
@@ -137,6 +143,12 @@ class confdroid_haproxy::firewall::iptables (
dport =&gt; $hy_https_port, dport =&gt; $hy_https_port,
jump =&gt; &#39;accept&#39;, jump =&gt; &#39;accept&#39;,
} }
firewall { &quot;${hy_fw_order_no}${hy_stats_port} tcp port ${hy_stats_port}&quot;:
proto =&gt; &#39;tcp&#39;,
dport =&gt; $hy_stats_port,
jump =&gt; &#39;accept&#39;,
}
} }
}</pre> }</pre>
</td> </td>

View File

@@ -109,7 +109,18 @@
11 11
12 12
13 13
14</pre> 14
15
16
17
18
19
20
21
22
23
24
25</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/main/config.pp', line 6</span> <pre class="code"><span class="info file"># File 'manifests/main/config.pp', line 6</span>
@@ -122,6 +133,17 @@ class confdroid_haproxy::main::config (
if $hy_manage_fail2ban == true { if $hy_manage_fail2ban == true {
include confdroid_haproxy::monitoring::fail2ban include confdroid_haproxy::monitoring::fail2ban
} }
if $hy_manage_nagios == true {
include confdroid_haproxy::monitoring::target
}
if $hy_selinux_allow_stats == true {
exec { &#39;setsebool haproxy_connect_any on&#39;:
path =&gt; [&#39;/bin&#39;, &#39;/usr/bin&#39;, &#39;/sbin&#39;, &#39;/usr/sbin&#39;],
onlyif =&gt; &#39;/usr/sbin/getsebool haproxy_connect_any | /usr/bin/grep -q &quot; --&gt; off$&quot;&#39;,
}
}
}</pre> }</pre>
</td> </td>
</tr> </tr>

View File

@@ -0,0 +1,156 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Puppet Class: confdroid_haproxy::monitoring::target
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "puppet_classes::confdroid_haproxy::monitoring::target";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../puppet_class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (c)</a> &raquo;
<span class='title'><span class='object_link'>Puppet Classes</span></span>
&raquo;
<span class="title">confdroid_haproxy::monitoring::target</span>
</div>
<div id="search">
<a class="full_list_link" id="puppet_class_list_link"
href="../puppet_class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Puppet Class: confdroid_haproxy::monitoring::target</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd><span class='object_link'><a href="confdroid_haproxy_3A_3Aparams.html" title="puppet_classes::confdroid_haproxy::params (puppet_class)">confdroid_haproxy::params</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>
manifests/monitoring/target.pp
</dd>
</dl>
</div>
<h2>Summary</h2>
class manages exports for nagios monitoring
<h2>Overview</h2>
<div class="docstring">
<div class="discussion">
<p>confdroid_haproxy::monitoring::target.pp Module name: confdroid_haproxy Author: 12ww1160 (12ww1160@puppetsoft.com)</p>
</div>
</div>
<div class="tags">
</div><div class="method_details_list">
<table class="source_code">
<tr>
<td>
<pre class="lines">
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'manifests/monitoring/target.pp', line 6</span>
class confdroid_haproxy::monitoring::target (
) inherits confdroid_haproxy::params {
if $hy_manage_nagios == true {
@@nagios_service { &quot;check_haproxy_${fqdn}&quot;:
check_command =&gt; &quot;check_nrpe!check_haproxy!${hy_procs_allowed}!haproxy&quot;,
use =&gt; &#39;generic-service&#39;,
host_name =&gt; $fqdn,
notification_period =&gt; &#39;24x7&#39;,
service_description =&gt; &quot;${fqdn}_check_haproxy&quot;,
target =&gt; $hy_target_service,
owner =&gt; &#39;nagios&#39;,
group =&gt; &#39;nagios&#39;,
mode =&gt; &#39;0640&#39;,
contacts =&gt; $hy_target_contacts,
}
}
}</pre>
</td>
</tr>
</table>
</div>
</div>
<div id="footer">
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
</div>
</div>
</body>
</html>

View File

@@ -81,6 +81,8 @@
<span class='object_link'><a href="confdroid_haproxy_3A_3Afirewall_3A_3Aiptables.html" title="puppet_classes::confdroid_haproxy::firewall::iptables (puppet_class)">confdroid_haproxy::firewall::iptables</a></span><br/> <span class='object_link'><a href="confdroid_haproxy_3A_3Afirewall_3A_3Aiptables.html" title="puppet_classes::confdroid_haproxy::firewall::iptables (puppet_class)">confdroid_haproxy::firewall::iptables</a></span><br/>
<span class='object_link'><a href="confdroid_haproxy_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_haproxy::monitoring::target (puppet_class)">confdroid_haproxy::monitoring::target</a></span><br/>
<span class='object_link'><a href="confdroid_haproxy_3A_3Amonitoring_3A_3Afail2ban.html" title="puppet_classes::confdroid_haproxy::monitoring::fail2ban (puppet_class)">confdroid_haproxy::monitoring::fail2ban</a></span><br/> <span class='object_link'><a href="confdroid_haproxy_3A_3Amonitoring_3A_3Afail2ban.html" title="puppet_classes::confdroid_haproxy::monitoring::fail2ban (puppet_class)">confdroid_haproxy::monitoring::fail2ban</a></span><br/>
</dd> </dd>
@@ -397,24 +399,6 @@
</li> </li>
<li>
<span class='name'>hy_show_stats</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>false</tt>)</em>
&mdash;
<div class='inline'>
<p>whether we want to display the statistics page</p>
</div>
</li>
<li> <li>
<span class='name'>hy_stats_socket</span> <span class='name'>hy_stats_socket</span>
@@ -865,6 +849,109 @@
</li> </li>
<li>
<span class='name'>hy_selinux_allow_stats</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>true</tt>)</em>
&mdash;
<div class='inline'>
<p>whether to allow stats in selinux</p>
</div>
</li>
<li>
<span class='name'>hy_stats_port</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;8404&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the port to use for stats. used in firewall settings</p>
</div>
</li>
<li>
<span class='name'>hy_manage_nagios</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>false</tt>)</em>
&mdash;
<div class='inline'>
<p>whether to manage nagios service checks</p>
</div>
</li>
<li>
<span class='name'>hy_target_service</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;/etc/nagios/conf.d/haproxy_service.cfg&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the path to the nagios service check file</p>
</div>
</li>
<li>
<span class='name'>hy_target_contacts</span>
<span class='type'>(<tt>Array</tt>)</span>
<em class="default">(defaults to: <tt>[&#39;nagiosadmin&#39;]</tt>)</em>
&mdash;
<div class='inline'>
<p>the contacts to use for nagios service checks</p>
</div>
</li>
<li>
<span class='name'>hy_procs_allowed</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;1:&#39;</tt>)</em>
</li>
</ul> </ul>
@@ -876,10 +963,6 @@
<pre class="lines"> <pre class="lines">
58
59
60
61
62 62
63 63
64 64
@@ -964,10 +1047,23 @@
143 143
144 144
145 145
146</pre> 146
147
148
149
150
151
152
153
154
155
156
157
158
159</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 58</span> <pre class="code"><span class="info file"># File 'manifests/params.pp', line 62</span>
class confdroid_haproxy::params ( class confdroid_haproxy::params (
@@ -983,13 +1079,16 @@ class confdroid_haproxy::params (
# fail2ban # fail2ban
Boolean $hy_manage_fail2ban = false, Boolean $hy_manage_fail2ban = false,
# selinux
Boolean $hy_selinux_allow_stats = true,
# main config # main config
String $hy_http_port = &#39;80&#39;, String $hy_http_port = &#39;80&#39;,
String $hy_https_port = &#39;443&#39;, String $hy_https_port = &#39;443&#39;,
String $hy_stats_port = &#39;8404&#39;,
String $hy_chroot = &#39;/var/lib/haproxy&#39;, String $hy_chroot = &#39;/var/lib/haproxy&#39;,
String $hy_pid = &#39;/var/run/haproxy.pid&#39;, String $hy_pid = &#39;/var/run/haproxy.pid&#39;,
String $hy_maxconn = &#39;4000&#39;, String $hy_maxconn = &#39;4000&#39;,
Boolean $hy_show_stats = false,
String $hy_stats_socket = &#39;/var/lib/haproxy/stats&#39;, String $hy_stats_socket = &#39;/var/lib/haproxy/stats&#39;,
String $hy_default_mode = &#39;tcp&#39;, String $hy_default_mode = &#39;tcp&#39;,
Boolean $hy_use_http_server_close = false, Boolean $hy_use_http_server_close = false,
@@ -1025,6 +1124,12 @@ class confdroid_haproxy::params (
Boolean $hy_manage_be_users = false, Boolean $hy_manage_be_users = false,
String $hy_be_userlist = &#39;####&#39;, String $hy_be_userlist = &#39;####&#39;,
# nagios
Boolean $hy_manage_nagios = false,
String $hy_target_service = &#39;/etc/nagios/conf.d/haproxy_service.cfg&#39;,
Array $hy_target_contacts = [&#39;nagiosadmin&#39;],
String $hy_procs_allowed = &#39;1:&#39;
) { ) {
$fqdn = $facts[&#39;networking&#39;][&#39;fqdn&#39;] $fqdn = $facts[&#39;networking&#39;][&#39;fqdn&#39;]

View File

@@ -18,5 +18,11 @@ class confdroid_haproxy::firewall::iptables (
dport => $hy_https_port, dport => $hy_https_port,
jump => 'accept', jump => 'accept',
} }
firewall { "${hy_fw_order_no}${hy_stats_port} tcp port ${hy_stats_port}":
proto => 'tcp',
dport => $hy_stats_port,
jump => 'accept',
}
} }
} }

View File

@@ -12,9 +12,14 @@ class confdroid_haproxy::main::config (
include confdroid_haproxy::monitoring::fail2ban include confdroid_haproxy::monitoring::fail2ban
} }
if $hy_manage_nagios == true {
include confdroid_haproxy::monitoring::target
}
if $hy_selinux_allow_stats == true { if $hy_selinux_allow_stats == true {
exec { 'setsebool haproxy_connect_any on': exec { 'setsebool haproxy_connect_any on':
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'], path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
onlyif => '/usr/sbin/getsebool haproxy_connect_any | /usr/bin/grep -q " --> off$"',
} }
} }
} }

View File

@@ -0,0 +1,23 @@
## confdroid_haproxy::monitoring::target.pp
# Module name: confdroid_haproxy
# Author: 12ww1160 (12ww1160@puppetsoft.com)
# @summary class manages exports for nagios monitoring
##############################################################################
class confdroid_haproxy::monitoring::target (
) inherits confdroid_haproxy::params {
if $hy_manage_nagios == true {
@@nagios_service { "check_haproxy_${fqdn}":
check_command => "check_nrpe!check_haproxy!${hy_procs_allowed}!haproxy",
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',
service_description => "${fqdn}_check_haproxy",
target => $hy_target_service,
owner => 'nagios',
group => 'nagios',
mode => '0640',
contacts => $hy_target_contacts,
}
}
}

View File

@@ -23,7 +23,6 @@
# @param [String] hy_chroot where the chroot should be # @param [String] hy_chroot where the chroot should be
# @param [String] hy_pid the pid file to use. # @param [String] hy_pid the pid file to use.
# @param [String] hy_maxconn how many connections should we max allow. # @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_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_default_mode which mode to use in the defaults block
# @param [String] hy_log_default should be used when the instance's logging # @param [String] hy_log_default should be used when the instance's logging
@@ -55,6 +54,10 @@
# @param [String] hy_be_userlist backend userlist comment # @param [String] hy_be_userlist backend userlist comment
# @param [Boolean] hy_manage_be_users whether to manage backend users # @param [Boolean] hy_manage_be_users whether to manage backend users
# @param [Boolean] hy_selinux_allow_stats whether to allow stats in selinux # @param [Boolean] hy_selinux_allow_stats whether to allow stats in selinux
# @param [String] hy_stats_port the port to use for stats. used in firewall settings
# @param [Boolean] hy_manage_nagios whether to manage nagios service checks
# @param [String] hy_target_service the path to the nagios service check file
# @param [Array] hy_target_contacts the contacts to use for nagios service checks
############################################################################### ###############################################################################
class confdroid_haproxy::params ( class confdroid_haproxy::params (
@@ -71,15 +74,15 @@ class confdroid_haproxy::params (
Boolean $hy_manage_fail2ban = false, Boolean $hy_manage_fail2ban = false,
# selinux # selinux
Boolean $hy_selinux_allow_stats = false, Boolean $hy_selinux_allow_stats = true,
# main config # main config
String $hy_http_port = '80', String $hy_http_port = '80',
String $hy_https_port = '443', String $hy_https_port = '443',
String $hy_stats_port = '8404',
String $hy_chroot = '/var/lib/haproxy', String $hy_chroot = '/var/lib/haproxy',
String $hy_pid = '/var/run/haproxy.pid', String $hy_pid = '/var/run/haproxy.pid',
String $hy_maxconn = '4000', String $hy_maxconn = '4000',
Boolean $hy_show_stats = false,
String $hy_stats_socket = '/var/lib/haproxy/stats', String $hy_stats_socket = '/var/lib/haproxy/stats',
String $hy_default_mode = 'tcp', String $hy_default_mode = 'tcp',
Boolean $hy_use_http_server_close = false, Boolean $hy_use_http_server_close = false,
@@ -115,6 +118,12 @@ class confdroid_haproxy::params (
Boolean $hy_manage_be_users = false, Boolean $hy_manage_be_users = false,
String $hy_be_userlist = '####', String $hy_be_userlist = '####',
# nagios
Boolean $hy_manage_nagios = false,
String $hy_target_service = '/etc/nagios/conf.d/haproxy_service.cfg',
Array $hy_target_contacts = ['nagiosadmin'],
String $hy_procs_allowed = '1:'
) { ) {
$fqdn = $facts['networking']['fqdn'] $fqdn = $facts['networking']['fqdn']

View File

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