How To Install libcgi-application-plugin-ratelimit-perl on Ubuntu 18.04
Introduction
In this tutorial we learn how to install libcgi-application-plugin-ratelimit-perl
on Ubuntu 18.04.
What is libcgi-application-plugin-ratelimit-perl
libcgi-application-plugin-ratelimit-perl is:
CGI::Application::Plugin::RateLimit provides protection against a user calling a runmode too frequently. A typical use-case might be a contact form that sends email. You’d like to allow your users to send you messages, but thousands of messages from a single user would be a problem.
This module works by maintaining a database of hits to protected runmodes. It then checks this database to determine if a new hit should be allowed based on past activity by the user. The user’s identity is, by default, tied to login (via REMOTE_USER) or IP address (via REMOTE_IP) if login info is not available. You may provide your own identity function via the identity_callback() method.
To use this module you must create a table in your database with the following schema (using MySQL-syntax, although other DBs may work as well with minor alterations):
CREATE TABLE rate_limit_hits ( user_id VARCHAR(255) NOT NULL, action VARCHAR(255) NOT NULL, timestamp UNSIGNED INTEGER NOT NULL, INDEX (user_id, action, timestamp) );
You may feel free to vary the storage-type and size of user_id and action to match your usage. For example, if your identity_callback() always returns an integer you could make user_id an integer column.
This table should be periodically cleared of old data. Anything older than the maximum timeframe being used can be safely deleted.
IMPORTANT NOTE: The protection offered by this module is not perfect. Identifying a user on the internet is very hard and a sophisticated attacker can work around these checks, by switching IPs or automating login creation.
There are three methods to install libcgi-application-plugin-ratelimit-perl
on Ubuntu 18.04. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install libcgi-application-plugin-ratelimit-perl Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install libcgi-application-plugin-ratelimit-perl
using apt-get
by running the following command:
sudo apt-get -y install libcgi-application-plugin-ratelimit-perl
Install libcgi-application-plugin-ratelimit-perl Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install libcgi-application-plugin-ratelimit-perl
using apt
by running the following command:
sudo apt -y install libcgi-application-plugin-ratelimit-perl
Install libcgi-application-plugin-ratelimit-perl Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install libcgi-application-plugin-ratelimit-perl
using aptitude
by running the following command:
sudo aptitude -y install libcgi-application-plugin-ratelimit-perl
How To Uninstall libcgi-application-plugin-ratelimit-perl on Ubuntu 18.04
To uninstall only the libcgi-application-plugin-ratelimit-perl
package we can use the following command:
sudo apt-get remove libcgi-application-plugin-ratelimit-perl
Uninstall libcgi-application-plugin-ratelimit-perl And Its Dependencies
To uninstall libcgi-application-plugin-ratelimit-perl
and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:
sudo apt-get -y autoremove libcgi-application-plugin-ratelimit-perl
Remove libcgi-application-plugin-ratelimit-perl Configurations and Data
To remove libcgi-application-plugin-ratelimit-perl
configuration and data from Ubuntu 18.04 we can use the following command:
sudo apt-get -y purge libcgi-application-plugin-ratelimit-perl
Remove libcgi-application-plugin-ratelimit-perl configuration, data, and all of its dependencies
We can use the following command to remove libcgi-application-plugin-ratelimit-perl
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge libcgi-application-plugin-ratelimit-perl
References
- libcgi-application-plugin-ratelimit-perl website
- libcgi-application-plugin-ratelimit-perl on packages.ubuntu.com
Summary
In this tutorial we learn how to install libcgi-application-plugin-ratelimit-perl
package on Ubuntu 18.04 using different package management tools: apt
, apt-get
and aptitude
.