Remote Scan#
Remote Scan is one of the two methods of "Server OS Scan".
A remote scan is a method where a server with the scanner installed (the scanner server) logs into other servers that it can connect to via SSH to perform a scan. By adding settings to the scanner server's configuration file, you can perform scans without installing the scanner on each scan target server. Since it logs into the scan target servers via SSH, a user account capable of remote login from the scanner server is required.
Meaning of Remote Scan
A remote scan does not mean scanning remotely from the internet via FutureVuls. Here, a remote scan refers to scanning servers that can be reached via SSH from a scanner server located in your network. The diagram shows an example configuration in which the scanner server and the scan target servers are on the same network.
Remote scanning has the following advantages over local scanning:
- You can use it even if the scanner cannot be installed on the scan target server.
- By using SSH tunnels or similar means, you can also scan servers on a different network, as long as the scanner server can connect to them via SSH.
- By listing multiple target servers in the scanner server's configuration file, you can scan multiple servers with a single command.
- By specifying a CIDR range, you can scan all servers within a given network range at once.
The following items are common with local scanning. See the page for each item.
| Item | Reference |
|---|---|
| Scan Targets | Supported Environments |
| Installation Method | Scanner Installation |
| Scan and Result Confirmation Methods | Scanner Execution and Scheduling |
| Location of Scan Settings | Local Linux Scans, Windows Local Scan |
| Mode Selection, Other Notes on Scanning | Scanner Settings |
| How to Check Scanner Version, Scanner Updates | Checking the Scanner Version and Updating |
Installation Flow#
Setting up a remote scan is divided into tasks you perform on the scanner server and tasks you perform on the scan target server.
| Order | Task | Server to Work On | Reference |
|---|---|---|---|
| 1 | Install the scanner. To exclude the scanner server itself from the scan targets, remove the scanner server's settings from the configuration file before the first scan after installation (about 5 minutes later) | Scanner server | Scanner Installation, the note in Remotely Scanning Multiple Servers |
| 2 | Prepare the dependent packages and sudo privileges according to the OS of the scan target server and the scan mode (Linux only) |
Scan target server | Preparation on the Target Server |
| 3 | Prepare a key pair (a private key and a public key) on the scanner server. Prepare a user for SSH login on the scan target server and register the public key | Scanner server, scan target server | Preparing for SSH Login |
| 4 | Place the private key and manually connect to the scan target server via SSH once. If the scanner server is Linux, connect as vuls-saas, the user that runs the scan |
Scanner server | Preparing for SSH Login |
| 5 | Add the scan target server to the configuration file | Scanner server | How to Modify the Configuration File |
| 6 | Run a scan and check the results in the Server / Product tab | Scanner server, FutureVuls screen | Scanner Execution and Scheduling |
Servers registered by remote scan are displayed one by one in the Server / Product tab. Each server that is successfully scanned in a month is billed as one server for that month. You can check the registered servers in "Servers / Products".
Preparation on the Target Server#
If the scan target server is Linux, the following preparation is required on the scan target server. If the scan target server is Windows, no preparation is required.
| Preparation | Description | When Required |
|---|---|---|
| Installing the dependent packages | Install the packages that the scanner uses to collect information on the scan target server | For the distributions and scan modes for which the table below shows dependent packages |
Configuring /etc/sudoers |
Allow the user who logs in via SSH to run the commands required for the scan with sudo without entering a password |
When you scan in fast-root mode. On Oracle Linux, sudo privileges for repoquery, which is used to obtain updatable packages, are also required in fast mode (except in offline mode) |
The scan mode specifies whether root privileges are used during a scan. We recommend fast-root mode, which can collect information that helps you decide whether a response is needed, such as whether processes are running. For details of the differences, see "Scan Mode".
At the start of a scan, the scanner checks whether the following dependent packages are installed. If they are not installed, the scan results in an error. The following table is reference information on the Vuls dependent packages and also lists OSes that are not in the supported environments. For the supported OSes, see "Supported Environments".
| Distribution | fast mode |
fast-root mode |
|---|---|---|
| Ubuntu, Debian, Raspbian | Not required | debian-goodies |
| Red Hat Enterprise Linux | Not required | yum-utils |
| CentOS, AlmaLinux, Rocky Linux, Oracle Linux | yum-utils |
yum-utils |
| Amazon Linux 1, Amazon Linux 2 | yum-utils |
yum-utils |
| Amazon Linux 2023 | dnf-utils |
dnf-utils |
| Fedora | dnf-utils |
dnf-utils |
| SUSE, Alpine Linux | Not required | Not required |
If you also use offline mode, the dependent packages may not be required. On Debian, also install reboot-notifier to detect whether a reboot is required (the scan does not result in an error even if it is not installed).
The commands to allow in /etc/sudoers differ depending on the distribution. For the settings to configure, see the table in the official documentation (English) of Vuls (the open-source scanner used as the FutureVuls scanner). Replace the username vuls in the examples in the table with the username that logs in via SSH.
- List of dependent packages (official Vuls documentation)
- /etc/sudoers configuration examples (official Vuls documentation)
Preparing for SSH Login#
In a remote scan, the scanner server logs into the scan target server using SSH public key authentication (password authentication is not supported). Prepare in the following order.
| Order | Task | Work Location |
|---|---|---|
| 1 | Prepare a user for SSH login | Scan target server |
| 2 | Prepare a key pair (a private key and a public key). To create a new one, use, for example, ssh-keygen -t rsa. The key types you can use depend on the OpenSSH on the scanner server and the sshd settings on the scan target server |
Scanner server |
| 3 | Register the public key in the public key location of the user from step 1. On Linux, this is ~/.ssh/authorized_keys. For the location on Windows, see the note below |
Scan target server |
| 4 | Place the private key. If the scanner server is Linux, make it owned by vuls-saas, the user that runs the scan, and set its permissions (see the note in "Basic Configuration File Modification") |
Scanner server |
| 5 | Manually connect to the scan target server via SSH once (see "Advance Preparation" below) | Scanner server |
The tasks in steps 4 and 5 differ depending on the OS of the scanner server, as follows.
| Item | Scanner Server Is Linux | Scanner Server Is Windows |
|---|---|---|
| Configuration file | /opt/vuls-saas/config.toml |
C:\Program Files\vuls-saas\config.toml |
| First manual SSH connection | Connect as vuls-saas, the user that runs the scan (sudo -u vuls-saas ssh ...) |
On the scanner server, connect by specifying the user that you specify in user in config.toml as the user to connect as |
| known_hosts | The manual connection registers the host in the known_hosts of the vuls-saas user |
Because the periodic execution runs as SYSTEM, place C:\Users\<Windows user name that ran the connection>\.ssh\known_hosts in C:\Windows\System32\config\systemprofile\.ssh |
| Private key | Make it owned by the vuls-saas user and set its permissions with chmod 600 |
Place it in C:\Windows\System32\config\systemprofile\.ssh and specify that path in keyPath |
The privileges required for the user to connect as (user in config.toml) depend not on the OS of the scanner server but on the OS of the scan target server and the scan mode. For Linux, see "Preparation on the Target Server". For Windows, see the note "If the Target Server is Windows" in "Basic Configuration File Modification".
Public Key Location When the Scan Target Server Is Windows
On the Windows OpenSSH server, the public keys of users in the administrators group are registered in C:\ProgramData\ssh\administrators_authorized_keys, not in ~\.ssh\authorized_keys. You also need to set the access permissions of the file. For the procedure, see Microsoft's "Key-based authentication in OpenSSH for Windows".
Advance Preparation
For remote scans, please manually connect via SSH from the scanner server to the target server once beforehand.
This is to register the target server's host fingerprint in the SSH known_hosts file.
If the scanner server is Linux, connect as vuls-saas, the user that runs the scan. Connecting as another user does not register the fingerprint in the known_hosts file of the vuls-saas user.
sudo -u vuls-saas ssh -i <private_key_location> <login_username>@<scan_target_server>
How to Modify the Configuration File#
To use remote scanning, you need to modify the scanner server's configuration file.
Basic Configuration File Modification#
To scan a remote server, add settings to the configuration file as follows. The installer creates the local scan settings (the settings for scanning the scanner server itself) with a name based on the hostname, with "." replaced by "_". If you also scan the scanner server itself, keep this name as it is.
[servers]
[servers.<hostname>]
host = "localhost"
port = "local"
# ↑↑ The local scan settings are automatically configured by the installer ↑↑
# ↓↓ Add the target server settings according to your environment ↓↓
# ex)
[servers.<server_name>]
user = "ec2-user"
host = "192.168.0.100"
port = "22"
keyPath = "/home/vuls-saas/.ssh/vuls-saas.pem"
scanMode = ["fast-root"]
The meaning of each item you add is as follows.
| Item | Meaning |
|---|---|
[servers.<server_name>] |
The name that identifies the scan target server in the configuration file. Assign any name |
user |
Username for remote login |
host |
Remote login destination server. An IP address or a resolvable server name |
port |
Port number of the remote login destination |
keyPath |
Location of the private key on the scanner server |
scanMode |
Scan mode. If omitted, it is fast unless specified in [default]. The setting of the scanner server itself is not inherited |
Regarding the Private Key Location and Permissions
If the scanner server is Linux, the private key file specified in keyPath must be owned by the scan execution user vuls-saas.
Also, due to security constraints, if the access permissions for the private key are too permissive, an SSH connection error will occur. Therefore, the following settings are required for the vuls-saas user.
chmod 600 <path_to_private_key>
You can check the owner and permissions with a command like ls -l <path_to_private_key>.
If the Target Server is Windows
If the target server is Windows, it is recommended to specify a user with administrator privileges for the remote login.
If a user without administrator privileges is specified, some applied KBs and some installed packages may not be detected.
Common settings can be consolidated in the [default] section as follows.
[default]
#port = "22"
#user = "username"
#keyPath = "/home/vuls-saas/.ssh/id_rsa"
Remotely Scanning Multiple Servers#
Define multiple target servers as follows. You do not need to write the UUID (the ID that FutureVuls uses to identify a server) in the configuration file.
[default]
port = "22"
keyPath = "/home/vuls-saas/.ssh/stg.pem"
scanMode = ["fast-root"]
[servers]
[servers.ama2]
user = "ec2-user"
host = "13.113.92.xx"
[servers.dev]
user = "ubuntu"
host = "54.248.62.xx"
After the first scan results are uploaded, [servers.<server_name>.uuids] is automatically added to the settings of each server. Do not change the added UUIDs.
Beware of Duplicate UUIDs
If you specify a UUID manually, make sure that it does not duplicate another UUID defined in config.toml. FutureVuls uses UUIDs to identify servers. Please be aware that if UUIDs are duplicated due to a configuration mistake, they will be recognized as the same server.
Excluding the Scanner Server from the Scan Targets
When you install the scanner, the first scan is executed about 5 minutes later with the default settings. Before then, remove the scanner server's information ([servers.<hostname>] created by the installer) from the configuration file. Only servers whose information is listed in the configuration file will be scanned.
If the first scan is executed before you do so, the scanner server is registered in FutureVuls. In that case, remove the scanner server's information from the configuration file, and then delete the registered server in the FutureVuls UI (see "Delete Server").
[saas]
GroupID = XXXX
Token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
URL = "https://auth.vuls.biz/one-time-auth"
[servers]
# Describe only the information of the scan target servers
Performing a Bulk Remote Scan of Servers in a Range by Specifying a CIDR Range#
By specifying a CIDR range in the configuration file, you can perform a remote scan on all servers within that range.
Define /opt/vuls-saas/config.toml as follows.
[default]
port = "22"
scanMode = ["fast-root"]
[servers]
[servers.testNW-target]
user = "ec2-user"
host = "192.168.0.60/31"
keyPath = "/home/vuls-saas/.ssh/auth.pem"
When the scan is executed, the scanner will attempt a remote scan on all IP addresses within the specified range. If the scan is successful, it will overwrite the configuration information for each server as follows.
[default]
port = "22"
scanMode = ["fast-root"]
[servers]
[servers."testNW-target(192.168.0.60)"]
user = "ec2-user"
host = "192.168.0.60"
keyPath = "/home/vuls-saas/.ssh/auth.pem"
[servers."testNW-target(192.168.0.60)".uuids]
"testNW-target(192.168.0.60)" = "bab806a2-59b7-628f-ff6b-c620df7191ca"
[servers."testNW-target(192.168.0.61)"]
user = "ec2-user"
host = "192.168.0.61"
keyPath = "/home/vuls-saas/.ssh/auth.pem"
[servers."testNW-target(192.168.0.61)".uuids]
"testNW-target(192.168.0.61)" = "dbad42bd-f045-5485-1189-f6a6e4d09a01"
For the second and subsequent scans, a remote scan will be executed for each server based on the information described in the configuration file.
Notes on CIDR Range Remote Scanning
- If a server that is already configured for remote scanning and has already been assigned a UUID is included in the specified CIDR range, it will be overwritten with a new UUID after the scan and will be managed as a different server on FutureVuls.
- If the UUID is changed, please edit the configuration file (
/opt/vuls-saas/config.toml) directly and revert to the original UUID. - The UUID can be found on the FutureVuls console's
Server / Product tab > Server Detailspage.
- If the UUID is changed, please edit the configuration file (
Remotely Scanning a Specific Server#
Specify the names of the servers to scan as arguments to /opt/vuls-saas/vuls-saas.sh.
The currently distributed script passes the arguments to ./vuls scan. Only if you have an old script that does not have "$@" in the part where ./vuls scan is executed, change it as follows.
- ./vuls scan -ips > scan.log 2>&1
+ ./vuls scan -ips "$@" > scan.log 2>&1
# Run as the vuls-saas user on the scanner server (the script is /opt/vuls-saas/vuls-saas.sh)
# Execute a scan for a specific server (assuming the two machines ama2 and dev from the previous section are defined)
./vuls-saas.sh dev
# To scan multiple servers, specify the server names ([servers.xxx] in config.toml) separated by spaces
./vuls-saas.sh dev ama2
# To scan all servers defined in config.toml
./vuls-saas.sh
Other Settings#
How to Divide Target Servers into Multiple Groups or Distribute Scan Processes#
When there are many target servers, the following operations may be necessary.
- Register target servers in different FutureVuls groups (the units in which servers are managed) and manage them
- Distribute the scan processes because there are many target servers and scanning takes a long time
These operations can be achieved by splitting config.toml, customizing vuls-saas.sh, and changing the crontab settings.
For specific operational examples, please refer to the following blog post.
Step 1: Split config.toml#
Create config.{group}.toml for each unit to split by, and define different target servers in each file.
For how to write config.{group}.toml, see "Basic Configuration File Modification".
Example:
- For Group A:
config.group-a.toml - For Group B:
config.group-b.toml
The group in which scan results are registered is determined not by the file name but by the GroupID and Token written in [saas] of each configuration file. To register to different groups, set the GroupID and scanner token of the destination group in [saas] for each configuration file. You can check the group ID in the URL shown when you open Group Settings of the destination group (https://console.vuls.biz/org/xxx/group/[Group ID]/setting/profile). You can check the scanner token under Group Settings → Token (see "Managing Scanner Tokens").
The settings made in steps 1 to 3 correspond as follows (for the example in step 3).
| Managing Group | Configuration File | GroupID and Token in [saas] |
Servers Defined in [servers] |
Results Directory (-results-dir) |
cron Execution Time |
|---|---|---|---|---|---|
| Group A | config.group-a.toml |
The ID and scanner token of Group A | The scan target servers managed in Group A | /opt/vuls-saas/results/groupA |
02:00 |
| Group B | config.group-b.toml |
The ID and scanner token of Group B | The scan target servers managed in Group B | /opt/vuls-saas/results/groupB |
02:10 |
Step 2: Modify vuls-saas.sh#
Next, to enable the use of the -config option when executing vuls-saas.sh, edit /opt/vuls-saas/vuls-saas.sh as follows.
- ./vuls saas > report.log 2>&1
+ ./vuls saas "$@" > report.log 2>&1
With this modification, the arguments passed to vuls-saas.sh (such as -config and -results-dir) are passed to both ./vuls scan and ./vuls saas. In the currently distributed script, the ./vuls scan line already has "$@". If you use an older script whose ./vuls scan line does not have "$@", add it to that line as well, as described in "Remotely Scanning a Specific Server".
If you re-run the installation command, vuls-saas.sh is replaced with the distributed script and this modification is lost. After reinstalling, perform this step again (see "Notes on Reinstallation").
About the vuls command's -config option
The vuls command reads config.toml from the current directory by default, but you can specify a different configuration file with the -config option.
# Scan servers of Group A using config.group-a.toml
./vuls scan -ips -config config.group-a.toml
./vuls saas -config config.group-a.toml
# Scan servers of Group B using config.group-b.toml
./vuls scan -ips -config config.group-b.toml
./vuls saas -config config.group-b.toml
Compatibility with Specific Server Scanning
This method is not compatible with passing server names as arguments like ./vuls-saas.sh dev as described in "Remotely Scanning a Specific Server".
When using the -config option, all target server specifications should be done within config.{group}.toml.
Step 3: Configure crontab#
Finally, change the crontab to execute scans for each group at different times as follows. Please change the time and configuration file names according to your environment.
# /etc/cron.d/vuls-saas-scan
# Execute Group-A at 02:00 and specify a dedicated results-dir
0 2 * * * vuls-saas /opt/vuls-saas/vuls-saas.sh -config config.group-a.toml -results-dir /opt/vuls-saas/results/groupA > /dev/null 2>&1
# Execute Group-B at 02:10 and specify another dedicated results-dir
10 2 * * * vuls-saas /opt/vuls-saas/vuls-saas.sh -config config.group-b.toml -results-dir /opt/vuls-saas/results/groupB > /dev/null 2>&1
Note on Concurrent Execution of Multiple Groups on the Same Server
If you execute multiple groups (e.g., Group-A, Group-B) at the same time using vuls-saas.sh on the same server, issues such as duplicate timestamps, JSON file conflicts, and problems like "upload target not found" or "servers from other groups being mixed in" are likely to occur.
To avoid such conflicts, separate the execution times and also split the results directories as shown in the example above.
Timeout Setting
The vuls scan command has two types of timeouts. -timeout is the timeout for processing other than scanning, and its default value is 300 seconds. -timeout-scan is the timeout for scanning all servers, and its default value is 7,200 seconds.
You can explicitly specify the timeout by modifying /opt/vuls-saas/vuls-saas.sh as follows.
- ./vuls scan -ips "$@" > scan.log 2>&1
+ ./vuls scan -ips -timeout 300 "$@" > scan.log 2>&1
Reference: https://vuls.io/docs/en/usage-scan.html
Windows Remote Scan#
The procedure for targeting Windows for scanning is common to the sections on this page. For the points specific to Windows, see the note in "Preparing for SSH Login" (where to register the public key) and the note in "Basic Configuration File Modification" (the user who logs in). An SSH server (such as OpenSSH Server) must be available on the scan target Windows machine. Also refer to the following blog post.
Even in environments without access to the internet or a Windows Update service such as WSUS, you can combine a Cab file with remote scanning to collect update status information and detect vulnerabilities.
Once registered with the procedure shown below, vulnerabilities included in cumulative updates will be continuously detected in FutureVuls as new updates are released. However, to detect "vulnerabilities in KBs that are not cumulative updates," you will need to obtain a new Cab file and rescan whenever a new Windows update is released.
For details, please refer to the FutureVuls Blog.
Configuring a Scan Using a Cab File#
The settings in this section are the same not only for Remote Scan but also for Windows Local Scan.
Note the File Size
The Cab file required for the scan is about 800MB. Please be mindful of your network bandwidth and available disk space.
Configuration and scanning are performed with the following steps.
-
Obtain
wsusscn2.cabfrom windowsupdate.com, operated by Microsoft Corporation (cab URL). If the scan target Windows machine cannot connect to the internet, obtain it on a device that can connect and copy it to the scan target Windows machineFor example, to get it with
curl, it would be as follows.curl.exe -sS -o C:\wsusscn2.cab http://download.windowsupdate.com/microsoftupdate/v6/wsusscan/wsusscn2.cab -
Modify
config.tomlThe following example shows the settings for the case where the scanner is installed on the Windows machine itself where the Cab file is placed (local scan). For a remote scan, specify the same two items in
[servers.<server_name>.windows]of the scan target server in the scanner server's configuration file. ForcabPath, specify the path of the Cab file on the scan target Windows machine.<hostname>in the examples represents the computer name recorded in the configuration file by the installer. Keep the server name and UUID values as they are, and add or change only the settings you need.Specify
serverSelection=3, which means "use a cab for Windows Update," and setcabPathto the full path of the Cab file obtained above.~ Omitted ~ [servers] [servers.<hostname>] host = "localhost" port = "local" [servers.<hostname>.uuids] <hostname> = "xxxx-xxxx-xxxx" [servers.<hostname>.windows] serverSelection = 3 cabPath = "C:\\wsusscn2.cab" ~ Omitted ~
Using the config.toml above, run a scan on the scanner server. The command to run depends on the OS of the scanner server (see "Scanner Execution and Scheduling > Running the Scanner Manually").
| Scanner server | Command to run |
|---|---|
| Windows (Local Scan, or Remote Scan from the Windows scanner) | Run C:\Program Files\vuls-saas\vuls-saas.bat with administrator privileges |
| Linux (Remote Scan from the Linux scanner) | On the scanner server, run /opt/vuls-saas/vuls-saas.sh as the vuls-saas user |
The scanner uploads configuration information, including update information obtained using the Cab file, to FutureVuls SaaS. For the detection conditions, see "Windows Local Scan".
Troubleshooting#
Check the common causes and fixes on the following pages.