Skip to main content

Posts

Showing posts with the label WAF

Troubleshooting WAF, CDN, and Load balancer

 Troubleshooting issues involving a Web Application Firewall (WAF), Content Delivery Network (CDN), and Load Balancer (LB) can be complex. Here is a step-by-step guide, including testing methods and relevant commands to isolate problems at each level. ### Step 1: Check Basic Connectivity 1. **Ping the Website**:    ```sh    ping example.com    ``` 2. **Check DNS Resolution**:    ```sh    nslookup example.com    ``` ### Step 2: Verify Load Balancer 1. **Direct Access to Load Balancer**:    Modify `/etc/hosts` to bypass CDN and WAF, pointing directly to the load balancer’s IP.    ```sh    sudo nano /etc/hosts    ```    Add the line:    ```    LB_IP example.com    ```     2. **Test HTTP Response**:    ```sh    curl -I http://example.com    ```    Check headers and status code to verify the load balancer is responding correctly. 3. **Check Load Balancer Logs**:    Access logs on the load balancer to see if requests are hitting it and how they are being routed.    ```sh    tail -f /var/log/

Install ModSecurity with Apache on Debian

OS: Debian 12 Steps 1: Install Apache2  sudo apt update sudo apt install apache2 Step 2: Install ModSecurity with Apache on Debian/Ubuntu The ModSecurity module for Apache is included in the default Debian/Ubuntu repository. To install it, run sudo apt install libapache2-mod-security2 Then enable this module. sudo a2enmod security2 Restart Apache for the change to take effect. sudo systemctl restart apache2 Step 3: Configure ModSecurity Check  /etc/apache2/mods-enabled/security2.conf In the above configuration file, you can find the following line. Make sure its exists IncludeOptional /etc/modsecurity/*.conf And copy example configuration file into /etc/modsecurity/modsecurity.conf mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf Find the following configuration and then change like below: #SecRuleEngine DetectionOnly SecRuleEngine On Step 4: Enable the Latest Rule Set to be continued Ref: https://www.linuxbabe.com/security/modsecurity-apache-debian-ub

Tips menerapkan WAF di Production

Pasang WAF dalam mode monitoring/preview mode/alert mode/semacamnya ini perlu juga untuk melihat traffic mana saja yang legitimate mana saja yang ada potensi attack/malicious requests. Liat traffic spike. Lakukan pruning pada request untuk menghindari false positif.  Pruning pada permintaan (request pruning) adalah salah satu teknik yang dapat digunakan untuk mengurangi atau menghindari false positives dalam penggunaan Web Application Firewall (WAF). Tujuannya adalah untuk memastikan bahwa WAF Anda hanya memblokir atau memeriksa permintaan yang benar-benar mencurigakan atau berpotensi berbahaya, sehingga mengurangi risiko memblokir lalu lintas sah. Berikut adalah beberapa cara untuk melaksanakan pruning request: White-listing URL dan Parameter: Identifikasi URL dan parameter yang merupakan lalu lintas sah dan aman untuk aplikasi Anda. Pastikan untuk mengecualikan permintaan terhadap URL dan parameter ini dari pemeriksaan WAF. Rule Customization : Sesuaikan aturan WAF Anda agar lebih se