The Call Manager Script does the following:
- Downloads Asterisk and required dependencies that need to be built from source.
- Installs dependencies that don’t need to be compiled.
- Uses pwgen to create secure passwords for the mail_user, drupal_user, MySQL root password, the Drupal admin password. Save the passwords to files readable only by the root user
- It creates self-signed certificates
- Creates the Email-to-SMS database and imports the data.
- Unpackages Asterisk and its dependencies, DHADI, LibPRI, Jansson, Iksemel, PJProject, and FreePBX.
- Then moves the unpacked files to the correct location.
- It then compiles and installs Iksemel.
- It then does the same to DHADI, then LibPRI, then Jansson.
- It then executes an Expect script to install and configure Asterisk’s prerequisites.
- Then it edits the PJProject to allow compilation on the Raspberry Pi.
- It then compiles the PJProject, compiles Asterisk.
- Configures asterisk install options, and installs PJProject and Asterisk.
- It configures log rotation for asterisk.
- It configures the system rc files.
- it prepares to install FreePBX,
- adding a system user named “asterisk” and disables login and disables the password.
- It changes the owner of the /var/run/asterisk directory to asterisk.
- It Recursively changes the owner of the /etc/asterisk, /var/lib/asterisk, /var/log/asterisk, /var/spool/asterisk, and /usr/lib/asterisk directories and their contents to the asterisk user.
- It removes the /var/www/html folder. It is not needed.
- It configures Apache2;
- It enables Apache’s SSL and rewrite modules and enables the HTTPS virtual host.
- For security, it creates a HTTP to HTTPS rewrite for secure web access.
- Configures Apache to use the certificates that were created earlier.
- It changes the max-upload size to 20 Mb to allow larger Music-on-Hold files.
- It backups the original Apache configuration file.
- Then it allows the asterisk user to be the user that apache uses.
- It then configures database access via ODBC.
- It then prevents asterisk from starting at boot, and it ensures asterisk is running.
- It then installs FreePBX and sets up the database installs necessary modules and some other helpful modules.
- It then fixes permissions and corrects owners, reloads configuration and enables FreePBX to start Asterisk, and enables FreePBX to start at boot.
- It configures xinetd as a TFTP server to give the client the option of using IP-phones.
- It then removes any leftover archives.
- It then configures chains in iptables to chains to log dropped packets in the filter and mangle tables. Rules are created to allow only necessary ports and services, limit ICMP, prevent most basic DDoS attacks, allow communication via the internal interface to the mail server, drop invalid packets, drop suspicious packets, limit connections and NEW connections, etc.
- It configures persistent iptables
- It installs fail2ban and Configures Fail2Ban to ban an IP address for 20 minutes after 3 after 6 failed login attempts within 30 minutes by default. Configures email notifications. Configures jails to monitor SSH logins, xinetd, Apache, Apache Overflows, Apache nohome, Asterisk TCP, Asterisk UDP,
- Installs and configures PSAD to monitor iptables logs to detect scan or attack attempts, sets autoban actions, configures logging, updates PSAD signatures, sets ban times, configures danger levels, configures notifications, enables auto-IDS, sets minimum Danger Level for Auto-IDS activation,
- Runs MySQL secure installation script.
The Web/Email Server Script does the following: