klaubert / waf-fle

WAF-FLE, ModSecurity Console
http://waf-fle.org
GNU General Public License v2.0
139 stars 73 forks source link

fix(MySQL) update SQL to support MySQL 8. fixes #73 and #72 #76

Open joebordes opened 1 year ago

ghigomatto commented 6 months ago

Thereis a new fork of this project! 2024!

https://github.com/LucaRastrelli/waf-fle

hans-mayer commented 6 months ago

Thereis a new fork of this project! 2024! https://github.com/LucaRastrelli/waf-fle

These are really great news. For me it's now almost running on Debian 12.4 bookworm with php 8.2.7 and Apache 2.4.57 I have an issue with GeoIP. When I run setup it tells me: GeoIP Extension: missing. When I run phpinfo() I see mod_php is installed and configured. I also run: php composer.phar require geoip2/geoip2:~2.0 Simple test scripts from command line and on web server are showing the country. But waf-fle doesn't show the countries in the home tab. Any ideas how to get this small piece to run ?

hans-mayer commented 6 months ago

In the meantime I got it working. I installed geoip from https://github.com/rlerdorf/geoip.git and compiled it with phpize ; ./configure ; make ; make install A simple php test script with geoip_country_code_by_name() and geoip_isp_by_name() did work. But not so waf-fle. Looking at the code I see this part of coding is commented out. Be so kind and apply the following patch for further versions:

# git diff index.php
diff --git a/controller/index.php b/controller/index.php
index 0b70901..c5535ca 100644
--- a/controller/index.php
+++ b/controller/index.php
@@ -609,7 +609,7 @@ try {
     $insert_sth->bindParam(":PhaseADate", $PhaseA['Date']);
     $insert_sth->bindParam(":PhaseAUniqID", $PhaseA['UniqID']);
     $insert_sth->bindParam(":PhaseAClientIP", $PhaseA['ClientIP']);
-    /*
+    
     // Get Country Code of IP Address
     $ClientIPCC = geoip_country_code_by_name($PhaseA['ClientIP']);
     if (!$ClientIPCC) {
@@ -622,9 +622,11 @@ try {
     } elseif ( $ClientIPASN == "") {
        $ClientIPASN = '0';
     }
-    */
+    
+    /* 
     $ClientIPCC = '';
     $ClientIPASN = '0';
+    */
     $insert_sth->bindParam(":PhaseAClientIPCC", $ClientIPCC);
     $insert_sth->bindParam(":PhaseAClientIPASN", $ClientIPASN);
     $insert_sth->bindParam(":PhaseASourcePort", $PhaseA['SourcePort']);
LucaRastrelli commented 4 months ago

In the meantime I got it working. I installed geoip from https://github.com/rlerdorf/geoip.git and compiled it with phpize ; ./configure ; make ; make install A simple php test script with geoip_country_code_by_name() and geoip_isp_by_name() did work. But not so waf-fle. Looking at the code I see this part of coding is commented out. Be so kind and apply the following patch for further versions:

# git diff index.php
diff --git a/controller/index.php b/controller/index.php
index 0b70901..c5535ca 100644
--- a/controller/index.php
+++ b/controller/index.php
@@ -609,7 +609,7 @@ try {
     $insert_sth->bindParam(":PhaseADate", $PhaseA['Date']);
     $insert_sth->bindParam(":PhaseAUniqID", $PhaseA['UniqID']);
     $insert_sth->bindParam(":PhaseAClientIP", $PhaseA['ClientIP']);
-    /*
+    
     // Get Country Code of IP Address
     $ClientIPCC = geoip_country_code_by_name($PhaseA['ClientIP']);
     if (!$ClientIPCC) {
@@ -622,9 +622,11 @@ try {
     } elseif ( $ClientIPASN == "") {
        $ClientIPASN = '0';
     }
-    */
+    
+    /* 
     $ClientIPCC = '';
     $ClientIPASN = '0';
+    */
     $insert_sth->bindParam(":PhaseAClientIPCC", $ClientIPCC);
     $insert_sth->bindParam(":PhaseAClientIPASN", $ClientIPASN);
     $insert_sth->bindParam(":PhaseASourcePort", $PhaseA['SourcePort']);

Thank you for the contribution. I will try it on monday. If you have more ideas, please can you open an issue ticket on my fork? It was pure coincidence that i saw your comment ^^

ghigomatto commented 4 months ago

Thereis a new fork of this project! 2024! https://github.com/LucaRastrelli/waf-fle

These are really great news. For me it's now almost running on Debian 12.4 bookworm with php 8.2.7 and Apache 2.4.57 I have an issue with GeoIP. When I run setup it tells me: GeoIP Extension: missing. When I run phpinfo() I see mod_php is installed and configured. I also run: php composer.phar require geoip2/geoip2:~2.0 Simple test scripts from command line and on web server are showing the country. But waf-fle doesn't show the countries in the home tab. Any ideas how to get this small piece to run ?

I'll work on it soon and I'll let you know. At the moment the function is not yet available, but I think it can be solved.