Command-line Interface (CLI)

Description

Imunify360 command-line interface (CLI) makes working with Imunify360 basics and features from your terminal even simpler.

Usage

For access to Imunify360 agent features from command-line interface (CLI), use the following command:

imunify360-agent

Basic usage:

imunify360-agent [command] [--option1] [--option2]...

Options

The following options are available for all commands.

--console-log-level [ERROR,WARNING,INFO,DEBUG] Level of logging input to the console
-h, --help Returns the help message
--json Returns data in JSON format
-v, --verbose Allows to return data in good-looking view if the--json option is used.

Examples

  1. This command returns help message for the 3rdparty command:

    imunify360-agent 3rdparty -h
    
  2. This command returns data in JSON format in a good-looking view for the get command:

    imunify360-agent get --period 1h --by-country-code UA --by-list black --json --verbose
    

Available commands:

3rdparty Make Imunify360 the primary IDS
backup-systems Allows to manage CloudLinux Backup
blacklist Return/Edit IP blacklist
blocked-port Return/Edit list of blocked ports
blocked-port-ip Allows to change the list of IPs that are excluded (allowed) for a certain blocked port
checkdb Check database integrity
check-domains Send domain list check
check modsec directives Allows to check whether the global ModSecurity
directives have values recommended by Imunify360
clean Clean the incidents
config Allows to update and show configuration file via CLI
doctor Collect info about system and send it to the Imunify support team
eula Allows to show and accept the end-user license agreement to automate installation
features Manage available features for Imunify360
feature-management Manage Imunify360 features available for users
fix modsec directives Fixes the non-recommended values (sets them to ones
recommended by Imunify360)
get Returns list of incidents
graylist Return/Edit IP Gray List
hooks Hooks-related commands
import Import data
infected-domains Returns infected domain list
login Allows to get a token which can be used for authentication in stand-alone Imunify UI.
malware Allows to manage malware options
notifications-config Allows to show and update notifications in the configuration file via CLI
proactive Allows to manage Proactive Defense feature
register Agent registration
reload-lists Allows to use external files with the list of Black/White-listed IPs. More details.
remote-proxy Allows to add an additional proxy subnet
rstatus Query the server to check if the license is valid
rules Allows user to manage disabled rules
submit false-positive/false-negative Allows to submit a file as false positive/false negative
unregister Unregister the agent
vendors Command for manipulating Imunify360 vendors
version Show version
whitelist Return/Edit operator for IP and domain white list
whitelisted-crawlers Allows do operate with search engine domains

Optional arguments for the commands:

--by-country-code [country_code] Filters output by country code.
Requires valid country code as argument.
Find valid country codes here in column ISO ALPHA-2 CODE.
--by-ip [ip_address] Filters output by abuser's IP or by subnet in CIDR notation.
Example: --by-ip 1.2.3.0/24.
--by-list Can be:
  • any
  • gray (Gray List)
  • white (White List)
  • black (Black List)
Filters output based on the list type.
Example: --by-list black.
--by-comment Filters output by comment.
--limit limits the output with specified number of incidents.
Must be a number greater than zero. By default, equals 100.
--offset Offset for pagination. By default, equals 0.
--to Allows to set the end of the period for filter.
Format is a timestamp.
--manual Show only items that have been added manually.
--order-by List of fields to sort the results by.

3rdparty

Command for disabling 3rd party IDS (currently they are cPHulk and fail2ban) and make Imunify360 agent the primary IDS.

Usage:

imunify360-agent 3rdparty

command is a positional argument and can be:

conflicts Show conflicts with other software
list List other IDS that might be running concurrently with Imunify360

Examples:

  1. The following command shows if there are any conflicts with other software:
imunify360-agent 3rdparty conflicts
  1. The following command lists other IDS that might be running concurrently with Imunify360:
imunify360-agent 3rdparty list

Backup systems

Allows to manage backup systems integrated to Imunify360.

Usage:

imunify360-agent backup-systems [command] <value>

command is a positional argument and can be:

list List of all available backup systems.
status Returns backup system status including a current backup system and enabling status.
extended-status Returns extended status including log file path, error on executing, current backup system, enabling status, current state, and current backup progress bar.
init <value> must be in the list of available backup systems. Initializes <value> backup system.
disable Disables backup system.
check Returns licenses info.

The status command returns {'<key>': <value>} (JSON formatted):

Key Value
backup_system Str with the name of the currently enabled backup system.
enabled If backups are enabled — True, else — False.

The extended-status command returns {'<key>': <value>} (JSON formatted):

Key Value
log_path Str with the path to the log file.
error Str with a human-friendly error message.
backup_system Str with the name of the currently enabled backup system.
enabled If backups are enabled — True, else — False.
state Str with the current running condition. Statuses: not_running, init, backup, done, unpaid.
progress This key is optional. It represents the progress of backup if it is running.

The check command returns {'<key>': <value>} (JSON formatted):

Key Value
status Str with the license status. Statuses: paid, unpaid.
size Int, which represents a paid size of backups in GB. E.g. 'size': 10 means that you paid for 10GB.

Examples:

  1. The following command prints a list of all available backup systems:
$ imunify360-agent backup-systems list
acronis 
r1soft 
cloudlinux
  1. The following command initializes CloudLinux backup system:
$ imunify360-agent backup-systems init cloudlinux
Backup initialization process is in progress
  1. The following command checks if the CloudLinux backup system is connected:
$ imunify360-agent backup-systems check cloudlinux
{'url': 'https://cln.cloudlinux.com/clweb/cb/buy.html?id=YourServerIdHere', 'status': 'unpaid'}

At first, it shows that it isn't, so you should open the URL from the JSON response in the browser to activate the backup. Once this is done, it shows in the CLN.

Run the check again and now it returns the size and that the backup has been paid for.

$ imunify360-agent backup-systems check cloudlinux
{'size': 10, 'status': 'paid'}

The above commands create a new cloudlinuxbackup.com account and link that account to this server after following the link and confirming the payment of $0.00 for free 10GB.

Blacklist

This command allows you to view or edit actual IPs in the Black List.

Usage:

imunify360-agent blacklist [subject] [command] <value> [--option]

subject is a positional argument and can be:

country Allows to manipulate with countries in the Black List
ip Allows to manipulate with IPs in the Black List

command is a second positional argument and can be:

add add item(-s) to Black List
delete remove item(-s) from Black List
move move item(-s) to Black List
edit edit comment on item in the Black List
list list items(-s) in Black List

Please note that by default list command outputs only first 100 items in the list as if it was run as blacklist ip list --limit 100. To check whether specific IP address is in the list, you can run the following command:

blacklist ip list --by-ip 12.34.56.78

where 12.34.56.78 is that specific IP address.

value is an item to manipulate with. It can be IP itself or a country code (find necessary country codes here in CIDR notation in the column ISO ALPHA-2 CODE).

option can be one or few of the optional arguments specified above and one more:

--comment allows to add comment to the item
--expiration allows specifying expiration time for the blacklisted IP (in seconds since epoch)
--scope allows to set the scope to Global/Local. Accepts two values: local (a default value, means "add IP on this server only") and group (means "add IP for the whole group in which this server is").

Examples:

  • The following command adds IP 1.2.3.4 to the Black List with a comment “one bad IP”:
imunify360-agent blacklist ip add 1.2.3.4 --comment “one bad ip”
  • The following command returns a list of IPs in the Black List which are from Bolivia:
imunify360-agent blacklist --by-country-code BO
  • The following command adds an IP 1.2.3.4 to the Black List and sets the scope to group:
imunify360-agent blacklist ip add 1.2.3.4 --scope group

Warning

For now, ipset supports only IPv6/64 networks

Blocked ports

This command allows to view or edit ports, IPs, and protocols in the list of blocked ports.

Note

Imunify360 can block particular ports using the blocked-port command, yet it doesn't support a paradigm to "block everything but the selected ports". That could be achieved via legacy Linux iptables.

Usage:

imunify360-agent blocked-port [command] <value> [--option]

command is a first positional argument and can be:

add add item(-s) to blocked ports
delete remove item(-s) from blocked ports
edit edit comment on item in the blocked ports
list list items(-s) in blocked ports

value is an item to manipulate with. value is : separated pair of port number and protocol: 5432:tcp, 28:udp

option can be one or few of the optional arguments specified above and some more:

--comment allows to add comment to the item
--ips block port for all IP addresses except the specified

Example:

The following command blocks port 5555 for tcp connections with a comment “Some comment”:

imunify360-agent blocked-port add 5555:tcp --comment “Some comment”

Blocked Port IP

This command allows to change the list of IPs that are excluded (allowed) for a certain blocked port.

Usage:

imunify360-agent blocked-port-ip [command] <value> [--option]

command is a first positional argument and can be:

add add IPs to blocked port
delete remove IPs from blocked port
edit edit comment on item in the blocked ports

value is an IP address and blocked port.

option can be one or few of the optional arguments for all commands specified above and one more:

--comment allows to add comment to the IP

Example:

The following command adds IP address 12.34.56.78 to the blocked port 5555 for tcp connections with a comment “Some comment”:

imunify360-agent blocked-port-ip add 12.34.56.78 5555:tcp --comment “Some comment”

Checkdb

Checks database integrity. In case database is corrupt, then this command saves backup copy of the database at the /var/imunify360 and tries to restore integrity of the original database. Note that if this command cannot restore database integrity, then it will destroy the original broken database.

Usage:

imunify360-agent checkdb

Example:

The following command checks the database integrity:

imunify360-agent checkdb

Check-domains

Allows to send domains list for a check to the Imunify360 central server. After domains checked, the results is available via command infected-domains.

Note

check-domains command may take a few minutes to complete.

Usage:

imunify360-agent check-domains [--optional arguments]

Example:

The following command sends the domains list for a check to the Imunify360 central server:

imunify360-agent check-domains

Check modsec directives

Allows to check whether the global ModSecurity directives have values recommended by Imunify360.

Usage:

imunify360-agent check modsec directives [--optional arguments]

Example:

The following command checks whether the global ModSecurity directives have values recommended by Imunify360.

imunify360-agent check modsec directives

Clean

Clean the incident list.

Usage:

imunify360-agent clean [--optional arguments]

Optional arguments:

--days cleanups incidents from database, if there are more than specified days quantity
Example: --days 5.
this option will cause deletion of all incidents that are older than 5 days from today
--limit leaves only limited number of the incidents in the database and deletes the others
Example: --limit 5000.
this option will leave only 5000 new incidents and delete the others

Example:

The following command deletes all incidents that are older than 5 days from today and leave only 5000 new incidents:

imunify360-agent clean --days 5 --limit 5000

Config

Allows to update and show configuration file via CLI.

Usage:

imunify360-agent config [command] [configuration options]

command can be:

show show configuration file
update update configuration file

You can find all configuration options here and instructions on how to apply configuration changes from CLI here.

Example:

Set MALWARE_SCAN_INTENSITY.cpu = 5 configuration option from a command line:

imunify360-agent config update ‘{"MALWARE_SCAN_INTENSITY": {"cpu": 5}}’

Doctor

Collecting information about Imunify360 state, generating the report and sending it to Imunify360 Support Team. This command can be used in case of any troubles or issues with Imunify360. This command will generate a key to be sent to Imunify360 Support Team. With that key Imunify360 Support Team can help with any problem as fast as possible.

Usage:

imunify360-agent doctor

Eula

Allows to show and accept the end-user license agreement to automate installation.

Usage:

imunify360-agent eula [command]

command can be one of the following:

accept accept end-user license agreement
show show end-user license agreement

Example:

Show the end-user license agreement:

imunify360-agent eula show

Features

Allows to enable or disable additional CloudLinux software included in Imunify360 for free. The following software is available:

  • KernelCare – use kernelcare feature name
  • HardenedPHP – use hardened-php feature name
  • Invisible Captcha – use invisible-captcha feature name

Note

You cannot install arbitrary 3rd party components or anything besides the features listed above. Please, use legacy linux package installation process for that

Usage:

imunify360-agent features [command] <feature name>

command is a positional arguments and can be :

install allows to enable software
remove allows to disable software
status allows to check the status of the software
list allows to list all available software

Examples:

  1. The following command checks if KernelCare is installed:
imunify360-agent features status kernelcare
  1. The following command installs KernelCare:
imunify360-agent features install kernelcare
  1. The following command uninstalls KernelCare:
imunify360-agent features remove kernelcare

Feature-management

Allows to manage Imunify360 features available for users.

Usage:

imunify360-agent feature-management [command] [--optional argument]...

Command can be one of the following:

defaults show the default value for each feature that is applied for newly created user
disable disable a feature for some or all users
enable enable a feature for some or all users
get obtains the status of all available features for a USER
list list all available features
native allows to enable/disable the Native Features Management using WHM/cPanel package extensions
show allows to show enabled features

Optional argument for the enable/disable commands can be one of the following:

[--feature av] enable/disable Malware Cleanup
[--feature proactive] enable/disable Proactive Defense
[--users [USERS [USERS ...]]] specifies the list of users which will be affected, otherwise the default value will be changed

The mandatory argument for the get command:

[--user USER] specifies a user name to obtain the status of features for

The mandatory argument for the native command:

disable disable the Native Features Management using WHM/cPanel package extensions and return the original Imunify360 Features Management back
enable enable the Native Features Management using WHM/cPanel package extensions

Example:

  1. The following command enables Malware Cleanup feature for the user1:
imunify360-agent feature-management enable --feature av --users user1
  1. The following command disables the Native Features Management
imunify360-agent feature-management native disable

Once the command executed:

  • The Native Features Management will be deactivated
  • The Imunify360 Package Extensions will be removed from all packages
  • The original Imunify360 Features Management will be activated

Note

Imunify360 will keep applying users Features Management settings stored in their data bases after switching to the original Imunify360 Features Management.

Warning

feature-management enable/disable --feature av and feature-management enable/disable --feature proactive commands will start functioning.

  1. The following command enables the Native Features Management
imunify360-agent feature-management native enable

Once the command executed, the following default Imunify360 Package Extension settings will be applied to all Packages:

  • Malware Scanner - View Reports Only
  • Proactive Defense - Available

Imunify360 Package Extensions will be auto-enabled for all packages disregarding the fact they have Imunify360 plugin enabled or not.

All existing Features Management settings will be overridden with the Imunify360 Package Extensions ones for all users.

Note

Features Management tab will be hidden on the User Interface.

Warning

feature-management enable/disable --feature av and feature-management enable/disable --feature proactive commands will stop functioning.

Fix modsec directives

Fixes the non-recommended values (sets them to ones recommended by Imunify360)

Usage:

imunify360-agent fix modsec directives [--optional arguments]

Example:

The following command sets the ModSecurity directives values to ones recommended by Imunify360:

imunify360-agent fix modsec directives 

Get

The command returns the lists of incidents.

Usage:

imunify360-agent get [--required argument] [--optional argument]...

Option can be one or few of the optional arguments listed above and one more.

--order-by [ORDER_BY [ORDER_BY ...]] Sorting order.
--limit Limits the output with specified number of IPs.
Must be a number greater than zero. By default, equals 50.
--by-country-code [country_code] Filters output by country code.
Requires valid country code as argument.
Find valid country codes
in CIDR notation in column ISO ALPHA-2 CODE.
--period [period] Timeframe.
Allows to specify the amount of time starting from the current day.
Should be greater than (or equal to) 1 minute.
Can be specified in format:
  • <int>m – minutes, example --period 30m
  • <int>h – hours, example --period 4h
  • <int>d – days, example --period 7d
  • today – for today, example --period today
  • yesterday – for yesterday, example --period yesterday
For example, --period 5d will return a list of incidents for 5 days.
--since [timestamp] allows to set start time to filter the list of incidents by period
--to [timestamp] allows to set finish time to filter the list of incidents by period
--severity allows to set severity to filter the list of incidents
--offset OFFSET offset for pagination. By default, equals 0
--by-abuser-ip [BY_ABUSER_IP] selection based on abuser IP address
--json return data in JSON format
--search string to search incidents by
--by-list Can be:
  • any
  • gray (Gray List)
  • white (White List)
  • black (Black List)
Filters output based on the list type.
Example: --by-list black.

Example:

The following command shows the incidents (in JSON format) for recent one hour, filtered by country code UA and filtered by Black List IPs:

imunify360-agent get --period 1h --by-country-code UA --by-list black --json

Graylist

This command allows to view or edit IP Gray List.

Usage:

imunify360-agent graylist ip [command] [--optional argument]

Available commands:

delete allows to remove IP from Gray List
list allows to list IPs in Gray List

Optional arguments for list:

--by-country-code [country_code] Filters output by country code.
Requires valid country code as argument.
Find valid country codes
in CIDR notation in column ISO ALPHA-2 CODE.
--by-ip [ip_address] Filters output by abuser's IP or by subnet in CIDR notation.
Example: --by-ip 1.2.3.0/24
--limit Limits the output with specified number of IPs.
Must be a number greater than zero. By default, equals 100.
--offset Offset for pagination. By default, equals 0.

Please note that by default list command outputs only first 100 items in the list as if it was run as graylist ip list --limit 100. To check whether specific IP address is in the list, you can run the following command:

graylist ip list --by-ip 12.34.56.78

where 12.34.56.78 is that specific IP address.

Example:

The following command will remove IP 1.2.3.4 from the Gray List:

imunify360-agent graylist ip delete 1.2.3.4

Hooks

You can find more about hooks here.

This command allows to manage hooks.

Usage:

imunify360-agent hook [command] --event [event_name|all] [--path </path/to/hook_script>]

command can be one of the following:

add register a new event handler
delete unregister existing event handler
list show existing event handlers
add-native register a new native event handler
--event [event_name|all] defines a particular event that invokes
a registered handler as opposed to all keyword
--path </path/to/hook_script> shall contain a valid path to a handler of the event,
it shall be any executable or Python Native event handlers
that agent will run upon a registered event

Example:

The following command shows existing event handlers:

imunify360-agent hook list

Import

This command allows to import Black List and White List from the other 3rd party IDS (only CSF supported at the moment) to Imunify360 database. Note. If CSF is enabled, then it is not necessary to run the command because Imunify360 is integrated with CSF.

Usage:

imunify360-agent import {blocked-ports, wblist} ...

Positional arguments:

blocked-ports Import blocked-ports from other IDS
wblist Import White/Black List from other IDS

Example:

The following command will import Black List and White List from the 3rd party IDS:

imunify360-agent import wblist

Infected-domains

Allows to retrieve infected domains list.

Usage:

imunify360-agent infected-domains [--optional arguments]

Optional arguments:

--limit Limits the output with the specified number of domains.
Must be a number greater than zero. By default, equals 100.
--offset Offset for pagination. By default, equals 0.

Example:

The following command displays the results of the check-domains command:

imunify360-agent infected-domains

Login

Allows to get a token which can be used for authentication in stand-alone Imunify UI.

Usage:

imunify360-agent login [command] [--optional arguments]

command can be one of the following:

get returns a token for USERNAME (must be executed by root)
pam uses PAM to check the provided credential and returns a token for USERNAME if PASSWORD is correct

Optional arguments for get:

--username USERNAME

Optional arguments for pam:

--username USERNAME
--password PASSWORD

Example:

  1. You can use the login get command to implement your own authorization mechanism for stand-alone Imunify. For example, you can generate tokens for users which are already authorized in your system/panel, and redirect to stand-alone Imunify UI with ?token=<TOKEN> in URL. (You can also set it in localStorage: localStorage.setItem('I360_AUTH_TOKEN', '<TOKEN>');)
imunify360-agent login get --username my-user1
  1. This command is used internally by stand-alone Imunify UI as the default authorization method.
imunify360-agent login pam --username my-user1 --password ********

Malware

Allows to manage malware options.

Usage:

imunify360-agent malware [command] [--optional arguments]

Available commands:

ignore malware Ignore List operations
malicious malware Malicious List operations
on-demand on-demand Scanner operations
suspicious malware Suspicious List operations
cleanup status show the status of the cleanup process
history list lists the complete history of all malware-related incidents/actions (optional arguments available)
rebuild patterns allows to save changes after editing watched and excluded patterns for Malware Scanner. See details here.
user allows to perform Malware Scanner operations for a user

Optional arguments:

--limit LIMIT Limits the output with the specified number of domains.
Must be a number greater than zero. By default, equals 100.
--offset OFFSET Offset for pagination. By default, equals 0.
--since SINCE Start date.
--to TO End date.
--user USER Returns results for a chosen user.
--order-by [ORDER_BY [ORDER_BY ...]] Sorting order.
--by-status [BY_STATUS [BY_STATUS ...]] Return items with selected status.
--by-scan-id BY_SCAN_ID Return items with selected ID.
--items ITEMS Return selected items.
--search SEARCH Search query.

action is the second positional argument for ignore and can be one of the following:

add add file PATHS to the Ignore List
delete delete file PATHS from the Ignore List
list shows Ignore List entries (optional arguments apply)

where PATHS are the absolute paths to files or folders divided by a whitespace.

command2 is the second positional argument for the malicious command and can be one of the following:

cleanup clean up infected ITEMS for a USER
cleanup-all clean up all files that have been detected as infected for all users
restore-original restore the original (malicious/infected) file to its original location
delete delete malicious/infected files
list list malicious/infected files
move-to-ignore move a Malicious List entry to the (malware) Ignore List
quarantine-malicious add malicious/infected files to the quarantine
remove-from-list remove malicious/infected files from the Malicious List
restore-from-backup restore a clean version of infected file from backup
restore-from-quarantine restore a quarantined file. The file will be automatically re-scanned

action is the second positional argument for on-demand and can be one of the following:

list list all on-demand scans performed
start --path PATH starts an on-demand scan for a specified PATH
status show the on-demand malware scanner status
stop stop on-demand malware scanner process
queue put put file PATHS to the queue for on-demand scan
queue remove remove scans from the queue for on-demand scan

The optional arguments for on-demand start and on-demand queue put are:

--ignore-mask IGNORE_MASK
--follow-symlinks
--no-follow-symlinks
--file-mask FILE_MASK
--intensity-cpu {1 to 7} 1 means the lowest intensity, 7 means the highest intensity
--intensity-io {1 to 7} 1 means the lowest intensity, 7 means the highest intensity

action is the second positional argument for suspicious and can be one of:

delete delete a Suspicious List entry
list obtain the list of Suspicious List entries
move-to-ignore move a Suspicious List entry to the (malware) Ignore List
move-to-quarantine move a Suspicious List entry to the quarantine

action is the second positional argument for user and can be one of the following:

cleanup USER clean all infected files for a user
restore-original USER restore all original files for a user
list list all users and their current infection status
scan scan all users

Examples

  1. The following command starts on-demand scanner for the path specified after the start command:
imunify360-agent malware on-demand start --path /home/<username>/public_html/
  1. The following command shows the example of the ignore-mask usage when you have to scan all d* folders except for the dixon77w.com and dunnrrr.com:
imunify360-agent malware on-demand start --path='/var/www/vhosts/d*' --ignore-mask='/var/www/vhosts/dixon77w.com/*,/var/www/vhosts/dunnrrr.com/*'
  1. The following command adds on-demand scans for the selected path(s) to the scan queue
imunify360-agent malware on-demand queue put "/home/user1/some folder" "/home/user2" --file-mask="*.php"
  1. The following command removes the selected scans from the scan queue
imunify360-agent malware on-demand list	# get scan_ids for the selected scans from the malicious list
imunify360-agent malware on-demand queue remove 84f043211dc045ae8e6d641f3b9fdb0a 8c4ee39d4d8f43e296e893940c8e791a
  1. The following command stops the on-demand Malware Scanner process
imunify360-agent malware on-demand stop
  1. The following command stops the on-demand Malware Scanner process and clears the scan queue
imunify360-agent malware on-demand stop --all
  1. The following command shows how to get an extended list of malicious files for a particular user. By default, a limit value equals to 50
imunify360-agent malware malicious list --user cltest --limit 500
  1. The following command adds the specified path to the Ignore List
imunify360-agent malware ignore add /home/user1/public_html/ "/home/some user/public_html/index.php"
  1. The following command saves changes after editing watched and excluded patterns for Malware Scanner.
imunify360-agent malware rebuild patterns
  1. The following command lists all users and their current infection status
imunify360-agent malware user list

Notifications config

Allows to show and update notifications in the configuration file via CLI.

Usage:

imunify360-agent notifications-config [command] [configuration options]

command can be:

show returns the whole config as a JSON
update updates the config (partial update is supported) and returns the whole updated config as a JSON

You can find all configuration options here and instructions on how to apply configuration changes from CLI here.

Examples:

  1. The imunify360-agent notifications-config show command output:
{
    "admin": {
        "default_emails": [
            "email1",
            "email2"
        ],
        "locale": "en-US",
        "notify_from_email": "root@hosting.example.com"
    },
    "rules": {
        "EVENT_ID": {
            "ADMIN": {
                "admin_emails": [
                    "email3",
                    "email4",
                    "default"
                ],
                "enabled": true,
                "period": 3600
            },
            "SCRIPT": {
                "enabled": true,
                "period": 10,
                "scripts": [
                    "/path/to/script"
                ]
            }
        },
        "EVENT_ID_2": {
            "ADMIN": {
                "admin_emails": [
                    "email3",
                    "email4",
                    "default"
                ]
            },
            "SCRIPT": {
                "scripts": [
                    "/path/to/script"
                ]
            }
        }
  1. Update admin default emails:
imunify360-agent notifications-config update '{"admin": {"default_emails": ["email1", "email2"]}}'
  1. Enable and configure email notifications for ADMIN for the REALTIME_MALWARE_FOUND event:
imunify360-agent notifications-config update '{"rules": {"REALTIME_MALWARE_FOUND": {"ADMIN": {"enabled": true, "period": 3600, "admin_emails": ["email3", "email4", "default"]}}}}'
  1. Disable email notifications for ADMIN for the REALTIME_MALWARE_FOUND event:
imunify360-agent notifications-config update '{"rules": {"REALTIME_MALWARE_FOUND": {"ADMIN": {"enabled": false}}}}'
  1. Change the period for the SCRIPT hook for the REALTIME_MALWARE_FOUND event to 1 minute:
imunify360-agent notifications-config update '{"rules": {"REALTIME_MALWARE_FOUND": {"SCRIPT": {"period": 60}}}}'

Proactive

These commands allow to manage Proactive Defense feature.

Usage:

imunify360-agent proactive [command] [--option] <value>

Available commands:

ignore delete path allows to remove a file from Proactive Defense Ignore List.
ignore delete rule allows to remove a rule for a file from Proactive Defense Ignore List.
list allows to list Proactive Defense events.
details allows to show details for the event.
ignore list allows to list files included to Proactive Defense Ignore List.
ignore add allows to add a file to Proactive Defense Ignore List.

option can be one or few of the optional arguments listed above and one more.

--path for ignore add, ignore delete path, ignore delete rule commands.
Allows to specify a path to the file.
--id for details, ignore delete rule commands.
Allows to specify rule id.
--rule-id only for ignore add command.
Allows to specify rule id.
--rule-name only for ignore add command.
Allows to specify rule name.
--since [timestamp] allows to set start time to filter the list of incidents by period.
--to [timestamp] allows to set finish time to filter the list of incidents by period.
--user show events for a specific user.
--search string to search Proactive events by.

Examples:

  1. This command adds a file located at /home/user/index.php to Proactive Defense Ignore List for the rule id 12 and name Suspicious detection rule. It means that Proactive Defense will not analyze this file according to this rule:
imunify360-agent proactive ignore add --path /home/user/index.php --rule-id 12 --rule-name 'Suspicious detection rule'
  1. This command removes files located at <path to file 1> and <path to file 2> from Proactive Defense Ignore List:
imunify360-agent proactive ignore delete path <path to file 1> <path to file 2>

Register

Allows to register and activate Imunify360. You can use it in case if Imunify360 was not activated during installation process or in case if activation key of the Imunify360 was changed for any reason. If you do not know what is an activation key or have any problem with it then, please, read Installation guide or contact our support team.

Usage:

imunify360-agent register [--optional arguments] [KEY]

KEY is a positional argument:

KEY Register with activation key (use IPL to register by IP).

If you will use this command without the KEY argument, then it will try to register and activate current activation key.

Example 1:

The following command will register and activate Imunify360 with the provided activation key:

imunify360-agent register IM250sdfkKK245kJHIL

Example 2:

If you have an IP-based license, you can use IPL argument to register and activate Imunify360:

imunify360-agent register IPL

Reload lists

Allows to use external files with the list of Black/White-listed IPs.

Usage:

imunify360-agent reload-lists

Example:

To use external files with the list of Black/White-listed IPs, you should place this list into one of the following directories: /etc/imunify360/whitelist/*.txt for the White list and /etc/imunify360/blacklist/*.txt for the Black list. Then in order to apply the IP lists, you should run the following command:

imunify360-agent reload-lists

Remote-proxy

Allows to add an additional proxy subnet.

Usage:

imunify360-agent remote-proxy [commands] [--optional arguments]

Positional arguments:

add Add proxy subnet in CIDR notation
delete Delete proxy subnet in CIDR notation
list List of manually added proxies
group Manage proxies by name

Positional arguments for add:

NETWORKS Subnet in CIDR notation

Optional arguments for add:

--name NAME Name of an added proxy

Positional arguments for delete:

NETWORKS Subnet in CIDR notation

Optional arguments for list:

--by-group BY_GROUP Sort by GROUP
--by-source BY_SOURCE Sort by SOURCE

Positional arguments for group:

enable Enable group
disable Disable group

Positional arguments for enable/disable:

name Name of your proxy subnet

Optional arguments for enable/disable:

--source SOURCE Enable/disable a group by SOURCE

Examples

The following command adds proxy subnet 1.1.2.0/24 with name my_own_proxy

imunify360-agent remote-proxy add 1.1.2.0/24 --name "my_own_proxy"

Rstatus

Allows to check if Imunify360 server license is valid.

Usage:

imunify360-agent rstatus [--optional arguments]

Rules

This command allows user to manage rules disabled for firewall plugins Imunify360 uses.

Usage:

imunify360-agent rules [command] [--option] <value> [--option] <value>

command is a positional argument and can be:

disable add a new rule to the disabled rules list
enable remove a rule from the disabled rules list
list-disabled display the list of the disabled rules
update-app-specific-rules allows to update WAF ruleset configurator immediately (generally, executed by cron)

Option can be:

--id ID number of the rule provided by the firewall plugin.
--plugin Firewall plugin name. Can be one of the following:
  • modsec for ModSecurity
  • ossec for OSSEC
  • lfd Login Failure Daemon (can be used in CSF integration mode)
--name Name of the added rule or details of the rule from ModSecurity or OSSEC.
--domains List of domains to disable a rule for. Can only be used with modsec type.

Examples

  1. The following command adds a rule with id 42 and name ‘Rule name’ for the ModSecurity rules to the disabled rules list:
imunify360-agent rules disable --id 42 --plugin modsec --name 'Rule name'
  1. The following command removes a rule with id 42 for the ModSecurity rules from the disabled rules list:
imunify360-agent rules enable --id 42 --plugin modsec
  1. The following command displays the list of disabled rules:
imunify360-agent rules list-disabled

The list is displayed as follows:

{'plugin': 'modsec', 'id': '214920', 'domains': ['captchatest.com'], 'name': 'Imported from config'}

{'plugin': 'modsec', 'id': '42', 'domains': None, 'name': 'Rule name'}

{'plugin': 'ossec', 'id': '1003', 'domains': None, 'name': 'Imported from config'}

{'plugin': 'ossec', 'id': '2502', 'domains': None, 'name': 'User missed the password more than one time'}

Where

  • plugin — is a firewall plugin name (modsec for ModSecurity and ossec for OSSEC)
  • id — is id number of the rule provided by the firewall plugin
  • domains — the list of the domains for which the rule is disabled (None means all domains)*
  • name — rule description or details of the rule from ModSecurity or OSSEC

Note

Domains are specified only for ModSecurity rules. For OSSEC rules it is always applies to all domains.

4. The following command updates WAF ruleset configurator immediately:

imunify360-agent rules update-app-specific-rules

Submit false-positive/false-negative

To submit file as false positive (if Imunify360 considers file as a malicious but it actually isn't) you can use the following command (please make sure to specify the file name along with full path):

imunify360-agent submit false-positive --reason <reason> <file>

Note

--scanner argument is deprecated and will be ignored, because there is only one vendor now: ai-bolit

To submit file as false negative (if Imunify360 considers file as a non-malicious but it actually does) you can use the following command (please make sure to specify the file name along with full path):

imunify360-agent submit false-negative <file>

Optional arguments:

--to Email to send.
--sender User email.

Unregister

Allows to unregister and disable Imunify360 on the server.

Note

To remove Imunify360 from the server it needs to be uninstalled.

Usage:

imunify360-agent unregister [--optional arguments]

Vendors

Command for manipulating Imunify360 vendors.

Usage:

imunify360-agent [command]

command is a positional argument and can be:

install-vendors Install ModSecurity vendors.
This command will install the Imunify360 vendor
if there are no conflicts with other installed vendors.
uninstall-vendors uninstall ModSecurity vendors.

Example:

The following command uninstalls the ModSecurity vendors:

imunify360-agent uninstall-vendors

Version

Allows to view the actual Imunify360 version installed on the server.

Usage:

imunify360-agent version [--json]

Whitelist

This command allows to view or edit actual IPs and domains in the White List.

Usage:

imunify360-agent whitelist [subject] [command] <value> [--option]

subject is a positional argument and can be:

ip Allows to manipulate with IPs in the White List.
domain Allows to manipulate with domains in the White List.
country Allows to manipulate with countries in the White List.

Note

A domain whitelisting will affect only greylisted IPs. It will not affect ModSecurity rules and blacklisted IPs.

command is a second positional argument and can be:

add Add item(-s) to the White List.
delete Remove item(-s) from the White List.
move Move item(-s) to the White List.
edit Edit TTL, comment and other parameters of the Whitelisted item.
list List items(-s) in the White List.
reset-to Replace whitelisted domains list with a new list.

Please note that by default list command outputs only first 100 items in the list as if it was run as whitelist ip list --limit 100. To check whether specific IP address is in the list, you can run the following command:

whitelist ip list --by-ip 12.34.56.78

where 12.34.56.78 is that specific IP address.

value is an item to manipulate with. It can be IP itself or a country code (find the necessary country codes in CIDR notation in ISO ALPHA-2 CODE column), or a domain name.

option can be one or few of the optional arguments from the table above and one more:

--comment Allows to add a comment to the item.
--full-access Only for move and edit commands.
Allows to grant full access to the IP or subnet ignoring the rules in Blocked ports.
--no-full-access Only for move and edit commands.
Allows to remove full access of the IP or subnet.
--expiration Allows specifying TTL for the whitelisted IP (in seconds since epoch).
--scope Allows to set the scope to Global/Local. Accepts two values: local (a default value, means "add IP on this server only") and group (means "add IP for the whole group in which this server is").

Examples:

  1. The following commands adds IP 1.2.3.4 to the White List with a comment “one bad ip”:
imunify360-agent whitelist ip add 1.2.3.4 --comment “one good ip”
  1. The following command returns a list of IPs in the White List which are from Bolivia:
imunify360-agent whitelist --by-country-code BO
  1. The following command adds domain with a name example.com to the White List:
imunify360-agent whitelist domain add example.com
  1. The following command checks domains in the White List:
imunify360-agent whitelist domain list
  1. The following command adds an IP 1.2.3.4 to the White List and sets the scope to group:
imunify360-agent whitelist ip add 1.2.3.4 --scope group
  1. The following command adds Bolivia to the White List:
imunify360-agent whitelist country add BO

Whitelisted crawlers

Allows do operate with search engine domains.

Usage:

imunify360-agent whitelisted-crawlers [command] 

command can be one of the following:

add NAME add a search engine to the list of whitelisted crawlers
delete NAME delete a search engine to the list of whitelisted crawlers
list list all added whitelisted crawlers

Examples:

  1. This command adds two search engines to the list of whitelisted crawlers:

    imunify360-agent whitelisted-crawlers add yandex.com google.com
    
  2. This command deletes a search engine to the list of whitelisted crawlers

    imunify360-agent whitelisted-crawlers delete yandex.com
    
  3. This command lists all added whitelisted crawlers

    imunify360-agent whitelisted-crawlers list