Compare commits
5 Commits
ba588d6889
...
19df6fdca0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19df6fdca0 | ||
|
|
2004d2b7e7 | ||
| 5b20bf27ac | |||
| 04e35b6d1d | |||
|
|
2ebe772103 |
13
.vscode/settings.json
vendored
13
.vscode/settings.json
vendored
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.words": [
|
|
||||||
"dontlognull",
|
|
||||||
"dport",
|
|
||||||
"httplog",
|
|
||||||
"maxconn",
|
|
||||||
"nologin",
|
|
||||||
"redispatch",
|
|
||||||
"sess",
|
|
||||||
"tcplog",
|
|
||||||
"userlist"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
127
Jenkinsfile
vendored
127
Jenkinsfile
vendored
@@ -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
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -101,6 +101,7 @@ Multiple ACLs need to be added as array, and will create one line each.
|
|||||||
## 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.
|
||||||
|
|
||||||
## Known Problems
|
## Known Problems
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
|
|
||||||
<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) and <code>hy_show_stats</code>is set to <code>true</code>, 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.</p>
|
||||||
|
|
||||||
<h2 id="label-Known+Problems">Known Problems</h2>
|
<h2 id="label-Known+Problems">Known Problems</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
|
|
||||||
<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) and <code>hy_show_stats</code>is set to <code>true</code>, 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.</p>
|
||||||
|
|
||||||
<h2 id="label-Known+Problems">Known Problems</h2>
|
<h2 id="label-Known+Problems">Known Problems</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -117,13 +117,7 @@
|
|||||||
19
|
19
|
||||||
20
|
20
|
||||||
21
|
21
|
||||||
22
|
22</pre>
|
||||||
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>
|
||||||
@@ -143,12 +137,6 @@ class confdroid_haproxy::firewall::iptables (
|
|||||||
dport => $hy_https_port,
|
dport => $hy_https_port,
|
||||||
jump => 'accept',
|
jump => 'accept',
|
||||||
}
|
}
|
||||||
|
|
||||||
firewall { "${hy_fw_order_no}9000 tcp port minio-api":
|
|
||||||
proto => 'tcp',
|
|
||||||
dport => '9000',
|
|
||||||
jump => 'accept',
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -109,7 +109,13 @@
|
|||||||
11
|
11
|
||||||
12
|
12
|
||||||
13
|
13
|
||||||
14</pre>
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20</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 +128,12 @@ 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_selinux_allow_stats == true {
|
||||||
|
exec { 'setsebool haproxy_connect_any on':
|
||||||
|
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
|
||||||
|
}
|
||||||
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -861,6 +861,24 @@
|
|||||||
—
|
—
|
||||||
<div class='inline'>
|
<div class='inline'>
|
||||||
<p>whether to manage backend users</p>
|
<p>whether to manage backend users</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>hy_selinux_allow_stats</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>whether to allow stats in selinux</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
@@ -876,7 +894,6 @@
|
|||||||
<pre class="lines">
|
<pre class="lines">
|
||||||
|
|
||||||
|
|
||||||
58
|
|
||||||
59
|
59
|
||||||
60
|
60
|
||||||
61
|
61
|
||||||
@@ -964,10 +981,14 @@
|
|||||||
143
|
143
|
||||||
144
|
144
|
||||||
145
|
145
|
||||||
146</pre>
|
146
|
||||||
|
147
|
||||||
|
148
|
||||||
|
149
|
||||||
|
150</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 59</span>
|
||||||
|
|
||||||
class confdroid_haproxy::params (
|
class confdroid_haproxy::params (
|
||||||
|
|
||||||
@@ -983,6 +1004,9 @@ class confdroid_haproxy::params (
|
|||||||
# fail2ban
|
# fail2ban
|
||||||
Boolean $hy_manage_fail2ban = false,
|
Boolean $hy_manage_fail2ban = false,
|
||||||
|
|
||||||
|
# selinux
|
||||||
|
Boolean $hy_selinux_allow_stats = false,
|
||||||
|
|
||||||
# main config
|
# main config
|
||||||
String $hy_http_port = '80',
|
String $hy_http_port = '80',
|
||||||
String $hy_https_port = '443',
|
String $hy_https_port = '443',
|
||||||
|
|||||||
@@ -11,4 +11,10 @@ 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_selinux_allow_stats == true {
|
||||||
|
exec { 'setsebool haproxy_connect_any on':
|
||||||
|
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
# @param [Boolean] hy_use_dontlognull whether to use dontlognull as default
|
# @param [Boolean] hy_use_dontlognull whether to use dontlognull as default
|
||||||
# @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
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class confdroid_haproxy::params (
|
class confdroid_haproxy::params (
|
||||||
|
|
||||||
@@ -69,6 +70,9 @@ class confdroid_haproxy::params (
|
|||||||
# fail2ban
|
# fail2ban
|
||||||
Boolean $hy_manage_fail2ban = false,
|
Boolean $hy_manage_fail2ban = false,
|
||||||
|
|
||||||
|
# selinux
|
||||||
|
Boolean $hy_selinux_allow_stats = false,
|
||||||
|
|
||||||
# main config
|
# main config
|
||||||
String $hy_http_port = '80',
|
String $hy_http_port = '80',
|
||||||
String $hy_https_port = '443',
|
String $hy_https_port = '443',
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ global
|
|||||||
log <%= @hy_log_local1 %>
|
log <%= @hy_log_local1 %>
|
||||||
<% if @hy_hard_stop == true -%>
|
<% if @hy_hard_stop == true -%>
|
||||||
hard-stop-after <%= @hy_hard_stop_value %>
|
hard-stop-after <%= @hy_hard_stop_value %>
|
||||||
<% end -%>
|
|
||||||
<% if @hy_show_stats == true -%>
|
|
||||||
stats socket /var/lib/haproxy/stats
|
|
||||||
stats timeout 30s
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
chroot <%= @hy_chroot %>
|
chroot <%= @hy_chroot %>
|
||||||
pidfile <%= @hy_pid %>
|
pidfile <%= @hy_pid %>
|
||||||
@@ -54,8 +50,9 @@ 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 127.0.0.1:8404 # Bind to localhost if only local access is needed #
|
bind *:8404
|
||||||
mode http
|
mode http
|
||||||
stats enable
|
stats enable
|
||||||
stats uri /haproxy?stats
|
stats uri /haproxy?stats
|
||||||
@@ -63,6 +60,8 @@ 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 %>
|
||||||
|
|||||||
Reference in New Issue
Block a user