Book Image

Elastix Unified Communications Server Cookbook

Book Image

Elastix Unified Communications Server Cookbook

Overview of this book

Table of Contents (24 chapters)
Elastix Unified Communications Server Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Description and Use of the Most Well-known FreePBX Modules
Addon Market Module
Asterisk Essential Commands
Asterisk Gateway Interface Programming
Helpful Linux Commands
Index

Installing Fail2ban


Fail2ban is a program that examines specific system logs in order to ban suspicious activity from IP addresses, which could potentially lead to a failure or attack. It searches for regular expressions declared in the *.conf files under the /etc/fail2ban/filter.d/ folder. If a condition is matched, it will add the suspicious IP address to the Linux kernel's firewall (iptables) and block it after a certain number of retries and for a certain period of time, sending an e-mail address to the administrator. These actions are defined in the jail.conf file, which is situated in the /etc/fail2ban/ folder. Fail2ban and iptables come installed in Elastix by default. In case it is not installed, we can simply do it by typing yum -y install fail2ban.

How to do it…

  1. Create a file called asterisk.conf under the /etc/fail2ban/filter.d/ folder. This file will contain the regular expressions that we will want to trace whenever any user tries to log in or use Asterisk's services. The file...