Pavel Loginov 2022-01-03 17:02:44 +03:00
parent 831fbf4df9
commit eba8b14420
4 changed files with 11 additions and 47 deletions

View File

@ -1,12 +0,0 @@
---
- name: Install git
package:
name: git
state: present
- name: Git clone spoa-modsecurity
command: chdir=/tmp/ git clone https://github.com/haproxy/spoa-modsecurity.git
- name: Set ModSec foleder
set_fact:
mod_sec_dir: /tmp/spoa-modsecurity

View File

@ -1,27 +0,0 @@
---
- name: Download HAProxy tarball
get_url:
url: "http://www.haproxy.org/download/{{ VERSION_MAJ }}/src/haproxy-{{ VERSION }}.tar.gz"
dest: "/tmp/haproxy-{{ VERSION }}.tar.gz"
- name: Create HAProxy directory
file:
path: "/tmp/haproxy-{{ VERSION }}"
state: directory
- name: Untar HAProxy tarball
become: true
become_user: root
unarchive:
src: "/tmp/haproxy-{{ VERSION }}.tar.gz"
dest: "/tmp/haproxy-{{ VERSION }}"
remote_src: true
- name: Copy HAProxy files
synchronize:
src: "/tmp/haproxy-{{ VERSION }}/haproxy-{{ VERSION }}/"
dest: "/tmp/haproxy-{{ VERSION }}"
- name: Set ModSec foleder
set_fact:
mod_sec_dir: "/tmp/haproxy-{{ VERSION }}/contrib/modsecurity"

View File

@ -82,7 +82,6 @@
- name: Download Modsec tarball - name: Download Modsec tarball
become: false become: false
get_url: get_url:
# url: https://www.modsecurity.org/tarball/2.9.5/modsecurity-2.9.5.tar.gz
url: "https://github.com/SpiderLabs/ModSecurity/releases/download/v{{ modsec_ver }}/modsecurity-{{ modsec_ver }}.tar.gz" url: "https://github.com/SpiderLabs/ModSecurity/releases/download/v{{ modsec_ver }}/modsecurity-{{ modsec_ver }}.tar.gz"
dest: /tmp/modsecurity.tar.gz dest: /tmp/modsecurity.tar.gz
owner: "{{ ansible_user }}" owner: "{{ ansible_user }}"
@ -149,13 +148,17 @@
dest: /tmp/modsecurity/INSTALL/include/ dest: /tmp/modsecurity/INSTALL/include/
remote_src: yes remote_src: yes
- name: Include task for HAProxy <= 2.3.16 - name: Install git
include: haproxy_under_2.4.0.yml package:
when: VERSION is version('2.3.16', '<=') name: git
state: present
- name: Include task for HAProxy >= 2.4.0 - name: Git clone spoa-modsecurity
include: haproxy_above_2.4.0.yml command: chdir=/tmp/ git clone https://github.com/haproxy/spoa-modsecurity.git
when: VERSION is version('2.4.0', '>=')
- name: Set ModSec foleder
set_fact:
mod_sec_dir: /tmp/spoa-modsecurity
- name: Make APT Modsecurity module for HAProxy - name: Make APT Modsecurity module for HAProxy
command: "chdir={{ mod_sec_dir }} make MODSEC_INC=/tmp/modsecurity/INSTALL/include MODSEC_LIB=/tmp/modsecurity/INSTALL/include APACHE2_INC=/usr/include/apache2/ APR_INC=/usr/include/apr-1.0" command: "chdir={{ mod_sec_dir }} make MODSEC_INC=/tmp/modsecurity/INSTALL/include MODSEC_LIB=/tmp/modsecurity/INSTALL/include APACHE2_INC=/usr/include/apache2/ APR_INC=/usr/include/apr-1.0"

View File

@ -65,7 +65,7 @@ function installWaf(ip1) {
type: "POST", type: "POST",
success: function( data ) { success: function( data ) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') { if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1' || data.indexOf('fatal') != '-1') {
toastr.error(data); toastr.error(data);
} else if (data.indexOf('Info') != '-1' ){ } else if (data.indexOf('Info') != '-1' ){
toastr.clear(); toastr.clear();