How can we help?

Asterisk PBX Security

As attacks become more sophisticated, it is always good to make sure that your Asterisk system is as secure as possible. The following article provides base information on locking down and securing your Asterisk PBX.

  1. To make brute-force attacks on your system more difficult by not revealing valid extensions on your system, add the following line to the appropriate *.conf file—for example, sip.conf or sip_general_custom.conf

    alwaysauthreject=yes 

  2. To bind your Asterisk phone system to communicate on a non-standard port, add the following line to the appropriate conf file—for example, sip.conf or sip_general_custom.conf. By implementing this, your system will no longer communicate on port 5060, and will instead use the value specified by ####, where #### is your SIP communication port: 

    bindport=#### 

  3. If you are using Outbound Allowed IPS and not using SIP credentials in the PBX, remove the username and password from your Flowroute peer details.
  4. Install and configure Fail2ban so that IPs attempting authentication with your Asterisk PBX system will be blocked from contacting your system.
  5. If possible, reduce the default RTP port range your Asterisk phone systems uses. If you are not using more than 100 concurrent connections, you can reduce the RTP range in /etc/asterisk/rtp.conf from 10000-20000 down to 19000-20000. This reduces the number of open ports on your system.
  6. Change the default ARI, AMP, and FOP passwords in the amportal.conf. It is ideal to lock-out the AMI port—the default is 5038 using IP Tables from anyone outside your network. 

    NOTE: This file only exists on systems which have the FreePBX installed.
  7. Ensure that your Asterisk phone system uses strong passwords and that no blank password is set as a default password. You can generate strong passwords from any of the following sites: 

  8. Use a Firewall to restrict traffic from and into your system. For example, this might be done using IP Tables. See IP Tables for information on using IP Tables.
  9. Review your system logs as well keep your system patched and up-to-date from application flaws.