### Manual BitNinja Installation for Ubuntu
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Steps for manually installing BitNinja on Ubuntu systems. This includes adding the repository, trusting the GPG key, updating package lists, installing the package, configuring the license key, and starting the service.
```bash
sudo su -c "echo deb http://apt.bitninja.io/debian/ bitninja non-free" >> /etc/apt/sources.list.d/bitninja.list
```
```bash
sudo su -c "apt-key adv --keyserver keyserver.ubuntu.com --recv-key 7F8B47DC"
```
```bash
sudo apt-get update
```
```bash
sudo apt-get install bitninja
```
```bash
sudo bitninja-config --set license_key=License_Key_here_1234
```
```bash
service bitninja start
```
--------------------------------
### Manual BitNinja Installation for Debian
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Steps for manually installing BitNinja on Debian systems. This involves configuring the repository, trusting the GPG key, updating package lists, installing the package, configuring the license key, and starting the service.
```bash
echo "deb http://apt.bitninja.io/debian/ bitninja non-free" >> /etc/apt/sources.list.d/bitninja.list
```
```bash
apt-key adv --keyserver keyserver.ubuntu.com --recv-key 7F8B47DC
```
```bash
apt-get update
```
```bash
apt-get install bitninja
```
```bash
bitninja-config --set license_key=License_Key_here_1234
```
```bash
service bitninja start
```
--------------------------------
### Manual BitNinja Installation for CentOS/CloudLinux
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Steps for manually installing BitNinja on CentOS or CloudLinux systems. This involves configuring the repository, installing the package, configuring the license key, and starting the service.
```bash
rpm -Uvh http://rpm.bitninja.io/1.0/noarch/bitninja-repo-1.0-1.noarch.rpm
```
```bash
yum install bitninja-dojo
```
```bash
yum install bitninja
```
```bash
bitninja-config --set license_key=License_Key_here_1234
```
```bash
service bitninja start
```
--------------------------------
### Test ipset Functionality
Source: https://docs.bitninja.io/docs/Installation/ipset_from_source
Run these commands to verify that ipset is installed correctly and functioning as expected. Successful execution without errors indicates a proper setup.
```bash
ipset --version
ipset -N test iphash
ipset -A test 1.2.3.4
ipset -L test
ipset -X test
```
--------------------------------
### Compile and Install ipset Binary
Source: https://docs.bitninja.io/docs/Installation/ipset_from_source
After installing the kernel module, compile and install the ipset binary. This ensures the ipset utility is available for managing sets.
```bash
make KERNEL_DIR=/usr/src/kernels/2.6.18-502.el5.lve0.8.85-x86_64/ binaries
make KERNEL_DIR=/usr/src/kernels/2.6.18-502.el5.lve0.8.85-x86_64/ binaries_install
```
--------------------------------
### Install BitNinja WHM Plugin with wget
Source: https://docs.bitninja.io/docs/Installation/whm
Use this command to download and install the BitNinja WHM plugin along with a full BitNinja installation. Replace '****your_license_key****' with your actual license key.
```bash
wget -q https://get.bitninja.io/bitninja-whm.tar.gz; \
mkdir bitninja-whm; \
tar -zxvf bitninja-whm.tar.gz -C ./bitninja-whm && \
./bitninja-whm/install --license_key=****your_license_key****
```
--------------------------------
### Install inotify-tools on Linux systems
Source: https://docs.bitninja.io/docs/Modules/malware-detection
Install the required inotify-tools package for file monitoring functionality.
```bash
apt-get update && apt-get install inotify-tools
```
```bash
yum --enablerepo=epel install inotify-tools
```
--------------------------------
### Compile and Install ipset Module
Source: https://docs.bitninja.io/docs/Installation/ipset_from_source
Follow these steps to compile and install the ipset kernel module if it's not available on your system. Ensure you have the correct kernel-devel package installed.
```bash
yum install kernel-devel
wget http://ipset.netfilter.org/ipset-4.5.tar.bz2
tar jxf ipset-4.5.tar.bz2
make KERNEL_DIR=/usr/src/kernels/2.6.18-502.el5.lve0.8.85-x86_64/
make KERNEL_DIR=/usr/src/kernels/2.6.18-502.el5.lve0.8.85-x86_64/ install
cp /lib/modules/[original_kernel_version]/kernel/extra/ip_set.ko /lib/modules/$(uname -r)/kernel/extra/
depmod
modprobe ip_set
```
--------------------------------
### Install BitNinja for ispmanager via wget
Source: https://docs.bitninja.io/docs/Installation/ispmanager
Use this command to download and install the plugin using wget. Ensure you replace the placeholder with your actual license key.
```bash
wget -qO- https://get.bitninja.io/ispmgr-plugin.tar.gz | tar -zx && ./ispmgr-plugin/install --license_key=****your_license_key******
```
--------------------------------
### Example Valid Output
Source: https://docs.bitninja.io/docs/Extra%20Features/Zabbix_integration
An example of the expected output when testing the `bitninja.metrics` parameter.
```text
bitninja.metrics [t|{"ipsetSizes":{"heimdall-greylist":755777,"heimdall-blacklist":53886,"heimdall-blacklist-net":0,"heimdall-essentiallist":14207,"heimdall-whitelist-net":10083904,"heimdall-user-blacklist":2,"heimdall-user-whitelist":26,"heimdall-user-blacklist-net":56320,"heimdall-user-whitelist-net":0,"bitninja-local-incident":2,"heimdall6-greylist":0,"heimdall6-blacklist":0,"heimdall6-blacklist-net":0,"heimdall6-essentiallist":0,"heimdall6-whitelist-net":0,"heimdall6-user-blacklist":0,"heimdall6-user-whitelist":0,"heimdall6-user-blacklist-net":0,"heimdall6-user-whitelist-net":0,"bitninja6-local-incident":0},"incidents":null,"quarantineDirSizeMbs":"1"}]
```
--------------------------------
### Start BitNinja Service on CentOS/Red Hat
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Starts the BitNinja service on CentOS or Red Hat systems. This command is used after installation and configuration.
```bash
service bitninja start
```
--------------------------------
### Install WHM BitNinja Plugin Only (wget)
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Installs only the WHM BitNinja plugin using wget, without installing the BitNinja agent. Use this if the agent is already installed. Requires the '--no_install_bitninja' flag.
```bash
wget -qO- https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --no_install_bitninja
```
--------------------------------
### Implement a post-detection script
Source: https://docs.bitninja.io/docs/Modules/malware-detection
Example script for post-detection actions. Place in /etc/bitninja/MalwareDetection/detection.conf.d/ with a pd_ prefix.
```bash
#!/bin/bash
# This post detection script just echoes out the path to the detected malware
echo "Malware found at path [$1] Malware name is [$2]" > /path_you_wish_to_save_outcome/malware.txt
```
--------------------------------
### Install BitNinja for ispmanager via curl
Source: https://docs.bitninja.io/docs/Installation/ispmanager
Use this alternative command if your system has curl installed instead of wget. Replace the placeholder with your actual license key.
```bash
curl https://get.bitninja.io/ispmgr-plugin.tar.gz | tar -zx && ./ispmgr-plugin/install --license_key=****your_license_key******
```
--------------------------------
### Install BitNinja with wget on ISPManager
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Use this command to download and run the BitNinja installer script via wget. Ensure you replace 'License_Key_here_1234' with your actual license key.
```bash
wget -qO- https://get.bitninja.io/ispmgr-plugin.tar.gz | tar -zx && ./ispmgr-plugin/install --license_key=License_Key_here_1234
```
--------------------------------
### Install WHM BitNinja Plugin Separately
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs only the WHM BitNinja plugin without installing the BitNinja agent. Use this if the agent is already installed. This command downloads, extracts, and runs the installer script.
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --no_install_bitninja
```
```bash
wget -qO- https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --no_install_bitninja
```
--------------------------------
### Install WHM BitNinja Plugin with Agent
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs both the BitNinja agent and the WHM plugin. This command downloads, extracts, and runs the installer script. Replace 'License_Key_here_1234' with your actual license key.
```bash
wget -qO- https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --license_key=License_Key_here_1234
```
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --license_key=License_Key_here_1234
```
--------------------------------
### Install and Run Siege for DoS Testing
Source: https://docs.bitninja.io/docs/Installation/testing
Commands to install the siege load testing tool and execute a simulated DoS attack against a target server.
```bash
apt-get install siege
```
```bash
siege c200 http://[your server]
```
--------------------------------
### Install BitNinja on Ubuntu
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs the BitNinja package on Ubuntu systems using apt-get. This command should be run after updating the package list.
```bash
sudo apt-get install bitninja
```
--------------------------------
### Show Server Information
Source: https://docs.bitninja.io/docs/command_line_interface
Shows detailed information about the server, BitNinja agent installation, and license status.
```bash
--serverinfo
```
--------------------------------
### Install WordPress Plugin with BitNinja CLI
Source: https://docs.bitninja.io/docs/Modules/siteprotection
Use this command to install the Website Security Dashboard WordPress plugin on a domain. Ensure the BitNinja Server protection agent is installed and replace 'mysite.com' with your actual domain.
```bash
bitninjacli --module=SiteProtection --install-wp-plugin --domain=mysite.com
```
--------------------------------
### Install WHM Plugin Only with wget
Source: https://docs.bitninja.io/docs/Installation/whm
Use this command if BitNinja is already installed and you only need to add the WHM plugin. This command skips the full BitNinja installation.
```bash
wget -q https://get.bitninja.io/bitninja-whm.tar.gz; \
mkdir bitninja-whm; \
tar -zxvf bitninja-whm.tar.gz -C ./bitninja-whm && \
./bitninja-whm/install --no_install_bitninja
```
--------------------------------
### Install mod_rpaf on Debian/Ubuntu
Source: https://docs.bitninja.io/docs/Modules/waf2
Install the mod_rpaf package using apt-get.
```bash
apt-get install libapache2-mod-rpaf
```
--------------------------------
### Install BitNinja-dojo on CentOS/Red Hat
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs the BitNinja-dojo package, which is part of the manual installation process for CentOS and Red Hat systems.
```bash
yum install bitninja-dojo
```
--------------------------------
### Universal One-Line BitNinja Installer
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Use this command to automatically detect your Linux distribution and install BitNinja. Ensure you replace 'License_Key_here_1234' with your actual license key.
```bash
curl https://get.bitninja.io/install.sh | sudo /bin/bash -s - --license_key=License_Key_here_1234
```
--------------------------------
### Install WHM BitNinja Plugin with Agent (wget)
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Installs the WHM BitNinja plugin alongside the BitNinja agent using wget. Replace 'License_Key_here_1234' with your actual license key.
```bash
wget -qO- https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --license_key=License_Key_here_1234
```
--------------------------------
### Install Nmap for Port Scanning
Source: https://docs.bitninja.io/docs/Installation/testing
Install the nmap utility on the attacker machine to simulate port scan attacks.
```bash
apt get install nmap
```
--------------------------------
### Access BitNinja CLI
Source: https://docs.bitninja.io/docs/command_line_interface
The standard command-line tool is available immediately after the BitNinja installation.
```bash
bitninjacli
```
--------------------------------
### Install BitNinja WHM Plugin with curl
Source: https://docs.bitninja.io/docs/Installation/whm
This command uses curl to download and install the BitNinja WHM plugin and BitNinja. Ensure you replace '****your_license_key****' with your valid license key.
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz --output bitninja-whm.tar.gz | \
mkdir bitninja-whm; \
tar -zxvf bitninja-whm.tar.gz -C ./bitninja-whm && \
./bitninja-whm/install --license_key=****your_license_key****
```
--------------------------------
### Install BitNinja on Debian
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs the BitNinja package on Debian systems using apt-get. This command is used after updating the package list.
```bash
apt-get install bitninja
```
--------------------------------
### Install WHM BitNinja Plugin with Agent (curl)
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Installs the WHM BitNinja plugin alongside the BitNinja agent using curl. Replace 'License_Key_here_1234' with your actual license key.
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --license_key=License_Key_here_1234
```
--------------------------------
### Get Version Information
Source: https://docs.bitninja.io/docs/command_line_interface
Retrieves the version information for the BitNinja agent.
```bash
--version
```
--------------------------------
### Prepare Test Directory for Process Analysis
Source: https://docs.bitninja.io/docs/installation/testing
Create a directory for the test script under the newly created user's home directory and navigate into it.
```bash
sudo -u bitninja_test mkdir -p /home/bitninja_test/test
cd /home/bitninja_test/test
```
--------------------------------
### Dump All Configurations
Source: https://docs.bitninja.io/docs/command_line_interface
Dumps all current BitNinja configurations.
```bash
--dump-all-configs
```
--------------------------------
### Uninstall BitNinja from ISPmanager
Source: https://docs.bitninja.io/docs/installation/stopping_and_uninstalling
Instructions to download, extract, and run the uninstaller script for BitNinja when installed as a plugin for ISPmanager. This involves using wget and tar to get the script and then executing it.
```bash
wget -qO- https://get.bitninja.io/ispmgr-plugin.tar.gz | tar -zx && ./ispmgr-plugin/uninstall
```
--------------------------------
### Uninstall BitNinja from WHM
Source: https://docs.bitninja.io/docs/installation/stopping_and_uninstalling
Instructions to download, extract, and run the uninstaller script for BitNinja when installed via WHM. This involves using wget and tar to get the script and then executing it.
```bash
wget -qO- https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/uninstall
```
--------------------------------
### Install WHM BitNinja Plugin Only (curl)
Source: https://docs.bitninja.io/docs/Installation/Install_BitNinja
Installs only the WHM BitNinja plugin using curl, without installing the BitNinja agent. Use this if the agent is already installed. Requires the '--no_install_bitninja' flag.
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz | tar -zx && ./bitninja-whm/install --no_install_bitninja
```
--------------------------------
### Create Test User for Process Analysis
Source: https://docs.bitninja.io/docs/Installation/testing
Set up a dedicated user account for testing the Process Analysis module.
```bash
sudo useradd -m bitninja_test
sudo passwd bitninja_test
```
--------------------------------
### Install curl on Debian/Ubuntu
Source: https://docs.bitninja.io/docs/Installation/Installation_FAQ
Use apt-get to install the curl package on Debian and Ubuntu systems. This is a dependency for the universal installer.
```bash
apt-get install curl
```
--------------------------------
### Create Test User for Process Analysis
Source: https://docs.bitninja.io/docs/installation/testing
Create a new user account on the Linux server. This user will be used to run the test PHP script for Process Analysis.
```bash
sudo useradd -m bitninja_test
sudo passwd bitninja_test
```
--------------------------------
### Install WHM Plugin Only with curl
Source: https://docs.bitninja.io/docs/Installation/whm
Use this command with curl to install only the WHM plugin, skipping the full BitNinja installation. This is useful if BitNinja is already set up on your server.
```bash
curl https://get.bitninja.io/bitninja-whm.tar.gz --output bitninja-whm.tar.gz | \
mkdir bitninja-whm; \
tar -zxvf bitninja-whm.tar.gz -C ./bitninja-whm && \
./bitninja-whm/install --no_install_bitninja
```
--------------------------------
### Install curl on CentOS/Cloud Linux/Red Hat
Source: https://docs.bitninja.io/docs/Installation/Installation_FAQ
Use yum to install the curl package on CentOS, Cloud Linux, and Red Hat systems. This is a dependency for the universal installer.
```bash
yum install curl
```
--------------------------------
### Prepare Test Directory
Source: https://docs.bitninja.io/docs/Installation/testing
Create a directory for the test script owned by the test user.
```bash
sudo -u bitninja_test mkdir -p /home/bitninja_test/test
cd /home/bitninja_test/test
```
--------------------------------
### Sync Configuration and Restart Service
Source: https://docs.bitninja.io/docs/Modules/dosdetection
Apply configuration changes by syncing settings to the cloud and restarting the BitNinja service.
```bash
bitninjacli --syncconfigs
```
```bash
service bitninja restart
```
--------------------------------
### Install Unattended Upgrades Dependencies
Source: https://docs.bitninja.io/docs/Installation/autoupdates
Update the package list and install the unattended-upgrades package.
```bash
sudo apt-get update
```
```bash
sudo apt-get install unattended-upgrades
```
--------------------------------
### Sample mod_rpaf Configuration
Source: https://docs.bitninja.io/docs/modules/waf2
This is a sample configuration for mod_rpaf. It enables the module, sets the hostname based on X-Host header, and defines the IP addresses of your frontend proxies.
```apache
LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
# When enabled, take the incoming X-Host header and
# update the virtualhost settings accordingly:
RPAFsethostname On
# Define which IP's are your frontend proxies that sends
# the correct X-Forwarded-For headers:
RPAFproxy_ips 127.0.0.1 xx.xx.xx.xx
# Change the header name to parse from the default
# X-Forwarded-For to something of your choice:
# RPAFheader X-Real-IP
```
--------------------------------
### Enable StartTLS for CaptchaSmtp
Source: https://docs.bitninja.io/docs/modules/captchasmtp
Add these lines to the CaptchaSmtp configuration to enable StartTLS support.
```ini
[ssl]
certPath="path to cert"
;should we use encryption by default?
defaultTls=false
```
--------------------------------
### Module Installation Path
Source: https://docs.bitninja.io/docs/installation/whmcs
This indicates the expected directory structure after successfully installing the BitNinja module in WHMCS.
```bash
~/modules/servers/bitninja
```
--------------------------------
### Manually Start SandboxScanner Scan
Source: https://docs.bitninja.io/docs/command_line_interface
Manually starts a SandboxScanner scan on a specific directory. Includes a dryrun option.
```bash
--module=SandboxScanner --scan= --dryrun
```
--------------------------------
### Start Process Analysis Test
Source: https://docs.bitninja.io/docs/installation/testing
Execute the PHP script as the test user. This process will run for one hour, simulating a potentially suspicious activity for BitNinja to analyze.
```bash
sudo -u bitninja_test php /home/bitninja_test/test/ProcessAnalysisTest.php
```
--------------------------------
### Install ipset-service on CentOS 7
Source: https://docs.bitninja.io/docs/Installation/compatibility
Install the ipset-service package on CentOS 7 if you need to save iptables rules manually.
```bash
yum install ipset-service
```
--------------------------------
### Configure BitNinja Repository on Debian
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Adds the BitNinja APT repository to your sources list on Debian systems. This is the initial step for manual installation on Debian.
```bash
echo "deb http://apt.bitninja.io/debian/ bitninja non-free" >> /etc/apt/sources.list.d/bitninja.list
```
--------------------------------
### Install BitNinja on CentOS/Red Hat
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Installs the main BitNinja package using yum on CentOS or Red Hat systems after the repository has been configured.
```bash
yum install bitninja
```
--------------------------------
### DefenseRobot Configuration File Example
Source: https://docs.bitninja.io/docs/modules/defenserobot
This INI file configures the DefenseRobot module, including the time window for log analysis and the actions to be performed. Ensure to sync configurations after changes.
```ini
[core]
time_window = 30
[actionManager]
actions[] = 'SendToShogun'
actions[] = 'LogToFile'
;actions[] = 'GreyList'
;actions[] = 'SaveUnFilteredLoglines'
;actions[] = 'CollectUnWatchedLogs'
;
; Change Control Panel/FTP user password
; Not Implemented yet
;
;actions[] = 'ChangePassword'
;
; Automatically WAF Honeypotify abused domain/uri
; Not Implemented yet
;
;actions[] = 'WAFHoneypotify'
```
--------------------------------
### Configure BitNinja Repository on Ubuntu
Source: https://docs.bitninja.io/docs/installation/install_bitninja
Adds the BitNinja APT repository to your sources list on Ubuntu systems. This is the first step in manual installation for Debian-based systems.
```bash
sudo su -c "echo deb http://apt.bitninja.io/debian/ bitninja non-free" >> /etc/apt/sources.list.d/bitninja.list
```
--------------------------------
### Enable StartTLS for CaptchaSmtp
Source: https://docs.bitninja.io/docs/Modules/captchasmtp
Enable StartTLS encryption for CaptchaSmtp by adding SSL configuration to the `config.ini` file. This requires specifying the certificate path and can be set to default to true or false.
```ini
[ssl]
certPath="path to cert"
;should we use encryption by default?
defaultTls=false
```
--------------------------------
### Launch Interactive CLI
Source: https://docs.bitninja.io/docs/command_line_interface
Executes the interactive command-line interface for BitNinja.
```bash
bitninjacli-interactive
```
--------------------------------
### Install WordPress Plugin via CLI
Source: https://docs.bitninja.io/docs/modules/siteprotection
Use this command to install the Website Security Dashboard WordPress plugin on a specific domain. Requires root privileges on the server.
```bash
bitninjacli --module=SiteProtection --install-wp-plugin --domain=mysite.com
```