Skip to main content

Posts

Showing posts from July, 2021

Deals You Can't Miss

1 Year Subscription

Apache 2 Webserver Throttling with mod_evasive Module

After installing mod_evasive , you can verify whether the mod_evasive module is enabled by running the following command: The default configuration file of mod_evasive is located at /etc/apache2/mods-enabled/evasive.conf , which you will need to configure per your requirements. Below is minimal workable configuration:  DOSHashTableSize: mod_evasive uses this option to control the hash table size. It is recommended to increase this if you have a busy web server. DOSPageCount: This option specifies the threshold limit for the number of requests allowed to the same URI per second. Once the threshold limit has been exceeded, the client’s IP address will be blacklisted. DOSSiteCount: This option specifies the limit on the total number of requests allowed to the same IP address. DOSPageInterval: This option specifies the page count interval. DOSSiteInterval: This option specifies the site count interval. DOSBlockingPeriod: This option defines the amount of time in seconds that a c

Blacklisting IP Addresses in Apache 2 Web Server

Operating System : Ubuntu Web Server : Apache 2.4.48 Objective : Blacklist IP Addresses to block it accessing the web application Steps To Finish Line:   Step 1: Enable rewrite apache module by executing ` a2enmod rewrite ` in your bash terminal. Read a2enmod command as " A pache 2 En able Mod ule". Its complementary command to disable an apache module is a2dismod . Putting it here, just in case you want to rollback your changes for whatever reason it be. Step 2:  Edit the Apache configuration file for the default website by executing ` vi /etc/apache2/sites-enabled/000-default.conf ` in your bash terminal to add the lines below: so that the configuration file looks like below: Step 3:  Now create a file to hold black listed IP Addresses by executing command ` vi /etc/apache2/blacklist ` in your bash terminal and add your IP Addresses to be black listed like below in the file opened for editing in the previous step: Step 4:  You may have to change the blackli

Configuring Google Ops Agent for Monitoring Apache 2 Web Server in Ubuntu VM

Google Cloud released Ops Agent as GA in Jan 2021. The Ops Agent collects logs and metrics on Compute Engine instances, sending your logs to Cloud Logging and your metrics to Cloud Monitoring. I performed the following steps to get this working in the Ubuntu VM in my Google Cloud account. Step 1 :  Install the latest version of the agent per the docs .  Step 2 : Create and edit ` /etc/google-cloud-ops-agent/config.yaml ` which is a user-specified configuration that will over-ride built-in configuration for same keys and merge with built-in configuration for different keys. This config file should have the content below: Step 3 : Restart the agent for the custom configuration to above to take effect. You can restart the agent by executing ` sudo service google-cloud-ops-agent restart ` in your bash terminal. You can list the available versions of the agent with ` sudo apt-cache madison google-cloud-ops-agent `. Step 4 :  To ensure that the agent is ingesting the custom log path,