FortiNAC-OS-F 7.2.4-CLI Reference Guide
FortiNAC-OS-F 7.2.4-CLI Reference Guide
FortiNAC-OS-F 7.2.4-CLI Reference Guide
Version F 7.2.4
FORTINET DOCUMENT LIBRARY
https://docs.fortinet.com
FORTINET BLOG
https://blog.fortinet.com
NSE INSTITUTE
https://training.fortinet.com
FORTIGUARD CENTER
https://www.fortiguard.com
FEEDBACK
Email: [email protected]
Overview 4
CLI basics 5
Pipe options for displaying content 6
Show commands 7
Get commands 8
Execute commands 10
Diagnose commands 17
Configuration commands 22
Global 22
DNS 22
Admin user 23
High Availability 24
Interface 25
NTP 27
Route 28
Shell Commands 30
Overview
This document describes FortiNAC-OS CLI commands used to configure and manage a FortiNAC unit from the
command line interface (CLI).
Important: Any commands should be executed under guidance from Fortinet.
CLI basics
Basic features and characteristics of the CLI environment provide support and ease of use for many CLI tasks.
l At any point, the tab key can be used to list possibilities for the next command or auto-complete partially
filled in commands
l The CLI will restrict which commands are shown based on the current context the user is in. When first
launched, the user is in the base context, but running certain commands (such as config system interface)
will switch the user to the appropriate context, with a completely new set of commands available.
l When inside a context, hitting ctrl-c will ‘abort’ any unsaved changes and exit the context.
l Attempting to run an incomplete command (e.g. config system) will show the usage info for the next
available possible parameters for that command.
Top Level Commands
Command Description
help Display usage
diagnose Diagnostic Tools
get Get system information
config Configure object
execute Execute static commands
show Show configuration
exit Exit
The options in the table below are available for many commands that display content, such as “get”, “show” and
“diagnose” commands.
[- -i Ignore case
C=<outputContextCount>] -n Print line number with output lines
<pattern>
-v Display non-matching lines
Less usage:
show system interface |
less
Show commands
Command Description
show system Show the currently active configuration for the specified subsystem
Available options:
show full- Shows the currently active configuration across all subsystems
configuration
Get commands
Command Description
get hardware memory Get information about the system memory
get hardware nic List the available interfaces on the system (port 1, port 2, etc)
get hardware status Retrieve an overview of the system:
l Model Name
l UUID
l MAC
l CPU
l Number of CPU cores
l RAM
l Hard disk (partition information)
get system public-key Retrieve the root user’s public key, which can then be used for configuring
HA on other systems. If multiple keys are present, it will prioritize the
ed25519 key
get system status Retrieve an overview of the FortiNAC status:
l FortiNAC Version
l Serial-Number
l License Status (Valid or expired)
l License Expiration Date
l Hostname
l Release Version Information (GA or interim)
l System time
get system license Print License Information
Available options:
Command Description
TEXT, JSON
get hardware cpu Display detailed information for all installed CPU(s).
get system interface Get interface configuration.
<portName>
Execute commands
Execute commands are used for the tasks listed below. These commands are run from the base context.
l Backup
l Factory Reset
l License
l Ping and traceroute
l SSH
l Reboot and shutdown
l Restore image
l Restore config
l Important: Any configuration that isn’t explicitly defined in the backup configuration will be removed
upon restore. The one exception is admin user settings (which are left untouched). All other config
(interface, route, etc) will be reset to default and then have the configuration present in the provided
config applied.
l All methods of restore will first create a back-up configuration prior to applying the new config.
Available commands
Command Description
execute enter-shell Enters a shell to interact with the appliance more directly. See shell
commands for details.
execute help Lists the available commands under execute
execute db-shell Enters the database shell
execute sensors list Show sensor information.
execute time <time> Set the system system time (hh:mm:ss format, hh: 0-23 mm: 0-59 ss: 0-59).
execute date <date> Set the system date (yyyy-mm-dd format, yyyy: 2023, mm: 1-12, dd: 1-31).
execute reset Reset configuration and disk partition to factory default
execute factoryreset Reset to factory default and shutdown
all-shutdown
Command Description
execute tcpdump [-v] Sniff packets on the specified interface.
[-c=<count>] [-
G=<seconds>] [- Available options:
i=<port>] [-
Q=<direction>] [- [<filter>...] Sniffer filter
s=<snaplen>] [-
-c=<count> Maximum number of packets to capture
w=<file>] [-x | -xx |
-X | -XX] -G=<seconds> Maximum duration in seconds to capture
[<filter>...]
-i=<port> Port to sniff packets on
-Q=<direction> Packet direction(s) to capture [in|out|inout]
-s=<snaplen> Number of bytes to snarf from each packet
-v, --verbose Enable verbose output
-w=<file> Write captured packets to specified file
-x Display packet data (minus link level header) in
hex
-X Display packet data (minus link level header) in
hex and ASCII
-xx Display packet data (including link level header)
in hex
-XX Display packet data (including link level header)
in hex and ASCII
help Display usage
Backup
execute backup config Backs up the current "config system" CLI configuration locally to disk
local (/bsc/backups/). See Configuration commands.
execute backup config ftp Backs up the current system configuration via FTP to the remote
[<remote filename>] [<ftp destination using the provided username and password.
server:port>] [<username>] The port option may be omitted if the destination uses the default FTP
[<password>] port (21)
execute backup config scp Backs up the current system configuration remotely via SCP to the
[<remote filename>] [<scp destination provided.
server:port>] [<username>] The port option may be omitted if the destination uses the default SSH
[<password>] port (22)
execute backup config tftp Backs up the current system configuration to the specified TFTP
[<remote filename>] [<tftp destination
server>]
License
execute license add Add the raw license string to the system
[<license>]
execute license import Import the specified remote license file on the specified tftp host
tftp [<remote host>]
[<remote file>]
execute license import scp Import the specified remote license file from the specified host via
[<remote file>] [<remote SCP
host>] [<username>]
[<password>]
Restore
execute restore image scp Install the .out image located on the specified remote host. Image is
[<remote out file>] downloaded via SCP
[<host>] [<username>] Note: This command is used for upgrading the software on the
[<password>] system.
execute restore image ftp Install the .out image located on the specified remote host. Image is
[<remote out file>] downloaded via FTP.
[<host>] [<username>]
[<password>]
Note: This command is used for upgrading the software on the
system.
execute restore image tftp Install the .out image located on the specified remote host. Image is
[<remote out file>] downloaded via TFTP
[<host>]
Note: This command is used for upgrading the software on the
system.
execute restore config Restore the "config system" CLI configuration stored locally. Tab
local [<local config completion can be used to list the available configuration backups.
backup>] See Configuration commands.
execute restore config scp Restore the "config system" CLI configuration stored on the remote
[<remote file>] [<host>] host at the specified location. Configuration downloaded via SCP.
[<username>] [<password>] See Configuration commands.
execute restore config ftp Restore the "config system" CLI configuration stored on the remote
[<remote file>] [<host>] host at the specified location. Configuration downloaded via FTP. See
[<username>] [<password>] Configuration commands.
execute restore config Restore the "config system" CLI configuration stored on the remote
tftp [<remote file>] host at the specified location. Configuration downloaded via TFTP.
[<host>] See Configuration commands.
execute restore legacy- Used for migrating CentOS configurations to new FortiNAC-OS
migrate [COMMAND] platform. Important: Do not use without first reviewing the CentOS to
FortiNAC-OS Migration documentation in the Documentation Library.
Available options:
execute restore database Restore database using a remote database backup downloaded via
scp <host> <username> scp
<password> <backup-path> Argument descriptions:
<host> Remote host
<username> Remote username
<password> Remote password
<backup> Path to database backup on remote host (.gz)
SSH
execute ssh [<user@host>] SSH to the specified host as the specified user
execute ssh-known-hosts Remove the specified known host fingerprint
remove-host [<host>]
execute ssh-known-hosts Removes all the SSH host fingerprints from the known hosts
remove-all
execute ssh-authorized- Adds the specified public key to the user's authorized hosts
keys add <public key
string>
execute ssh-authorized- Import the specified public key from a specified host, using the
keys import scp <file specified credentials, into the user's authorized hosts via scp
path> <host> <username>
<password>
execute ssh-authorized- Removes any authorized host keys that match the specified host. Tab
keys remove <host> completion of the <host> is supported.
Disk
execute disk checkhealth Perform a read-only filesystem check for errors on the specified
<partition> partition
execute disk list List partitions and mountpoints
execute disk scan Perform a (fsck) filesystem check on the specified partition
<partition>
Service
execute service is-active Display if a specified service is active
<service>... Arguments
<service>...
Service = nac, naccontrol, nacapplication, nacprobe, p0f, dhcpd,
mysqld, apache2, named
execute service restart Restart a specified service
<service>... Arguments
<service>...
Service = nac, naccontrol, nacapplication, nacprobe, p0f, dhcpd,
mysqld, apache2, named
execute service start Start a specified service
<service>... Arguments
<service>...
Service = nac, naccontrol, nacapplication, nacprobe, p0f, dhcpd,
mysqld, apache2, named
Diagnose commands
Diagnose commands are used for debugging/troubleshooting purposes. These commands are executed from
the base context.
Tail: Run this command to display the entries of a specific log file as they are printed in real time. Plugins
and/or loggers may need to be enabled prior to running this command for more in-depth data gathering.
Debug Plugin: Debug plugin commands are used for listing, enabling, disabling, and getting performance
metrics for the running FortiNAC plugins.
Debug Logger: Debug logger commands are used for listing loggers and setting their log levels.
Available commands
Command Description
Command Description
diagnose debug plugin list Lists all the plugins, their associated
loader, and their debug status. Type “q”
to return to prompt
diagnose debug plugin list-debug-enabled Lists all the debug-enabled plugins
along with their associated loader
diagnose debug plugin perf [<plugin>] Display the performance metrics for the
specified plugin
diagnose debug plugin [enable|disable] Enable or disable debug for the
[<plugin>] specified plugin
diagnose send-test-email [-file=<fileName>] - Send a Test email to verify Email server
message=<message> -subject=<subject> - configuration.
to=<mailTo>
Available options:
Command Description
diagnose dump-dpc-hosts [COMMAND] Displays Host Device Profiling
information
Available options:
Available options:
Command Description
Command Description
Configuration commands
Global
Global configuration is handled within the global context. This is for settings that apply to the system as a whole
(such as hostname) that otherwise do not fit in other contexts.
To enter the global context, from the base context run:
config system global
Available commands
Command Description
abort Cancels any edits made since entering the context, and
returns to the base context
set admin-idle-timeout [1-480] Sets the administrator idle timeout to the specified
minutes, between 1 and 480
set timezone help Alternative method to get the list of timezone ids and their
corresponding timezone
set strong-crypto [disable|enable] Enables or disables strong-crypto mode, which will ensure
running services utilize only secure cryptographic
configurations
unset [admin-idle- Resets the specified configuration to the default value
timeout|hostname|timezone|strong-
crypto]
DNS
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
set primary [<primary Sets the primary DNS address (ip or hostname)
address>]
Admin user
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
next Readies the changes for commit, but does not push them until end is called
on the admin context. Returns to the admin context.
set password Sets the user’s password to the specified value. Must be between 8 and
[<password>] 128 characters long
High Availability
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
set public-key add Add the specified SSH public key for use with high-availability connectivity
[<key contents>]
Command Description
set public-key import Import the specified remote SSH public key for use with high-availability
[<remote key path>] connectivity by copying it from the specified remotely accessible SSH host
[<remote host>]
[<remote username>]
[<remote password>]
Interface
Interface configuration is handled in the global interface context. To enter the global interface context, from the
base context run:
config system interface
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
edit [<interface>] Enter the specified interface’s context, in order to edit that interface’s
configuration
port1 Management
port2 Portal/Isolation interface
port3 Available network port
port4 Available network port
port5 Available network port
port6 Available network port
Command Description
abort Cancels any edits made since entering the context, and returns to the
base context
end Saves changes made since entering the context, and returns to the
base context
next Readies the changes for commit, but does not push them until end is
called on the global interface context. Returns to the global interface
context
show Show the current configuration, including uncommitted edits
set allowaccess [[protocol Enables access to this interface via the specified protocol. Multiple
list]] options must be specified at once to enable both.
Example: Enable both http and https:
set allowaccess http https
Available options:
Command Description
set allowaccess help Alternative method to get the help for all the options available for
allowaccess
set ip [<ip/cidr>] Specifies the interface’s IPv4 address and subnet mask. For
example:
set ip 192.0.2.5/24
set ip6 [<ip6/cidr>] Specifies the interface’s IPv6 address and subnet mask
set mode [static|dhcp] Sets the interface’s IP mode to be either static or dynamically
allocated
NTP
Available commands
Command Description
abort Cancels any edits made since entering the context, and
returns to the base context
set ntpserver [<ntp address>] Sets the NTP server address list. You may specify up to 10
addresses, space separated. All addresses must be
reachable
set ntpsync [disable|enable] Enable or disable syncing time with specified ntp servers
set syncinterval [1-1440] Set the interval to sync in minutes, between 1 and 1440
unset Unset the configured value for the specified property, and
[ntpserver|ntpsync|syncinterval] reset it to default
Route
Available commands
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
Command Description
purge Deletes all configured routes
rename [<route id>] to Rename a route id to the specified new id
[<new route id>]
edit [<route id>] Opens the specific route context for the specified route id
Command Description
abort Cancels any edits made since entering the context, and returns to the base
context
end Saves changes made since entering the context, and returns to the base
context
next Readies the changes for commit, but does not push them until end is called
on the global interface context. Returns to the global interface context
show Show the current configuration, including uncommitted edits
set device [<interface Set the interface for this route to the specified interface
name>]
set dst [<ipv4/cidr>] Set the destination subnet for this route to the specified IPv4 Address and
CIDR mask.
Example:
set dst 192.0.2.0/24
set gateway [<gateway Set the gateway IP used for this route
ip>]
unset Unset the specified configuration and reset it to the default value
[device|dst|gateway]
Shell Commands
Enters a shell to interact with the appliance more directly. Once in this mode, many of the commands used in
CentOS are the same.
It is handled inside the shell context
To enter the shell context, from the base context run:
execute enter-shell
Command Description
DeviceImport Imports (create) devices based on the contents of the input CSV file. This
tool only supports importing SNMP devices that are managed using
SNMPv1
For usage details see CLI import tool in the Administration Guide.
All entries in the file should be for devices of the same type.
EntitlementsTool The poll function uses the serial number to look up entitlements
getDefaultGW Displays port1 default gateway
Command Description
device -ip 10.12.228.126 -setAttr -name SSH_KBD_ENABLED -
value true
sudo grab-log-snapshot Creates a one-time snapshot of the logs available on the appliance. For
details see KB article 190755
For Admin UI instructions see Download logs in the Administration Guide
SendCoA This program will exercise the Radius rfc5176 functionality
Selection Options:
-ip <NAS device IP>
sudo ydb_dated_backup Database backup with timestamp included in filename. Backs up locally to
disk (/bsc/backups/).
Command Description
uptime The number of days/min/sec since last power up or reboot.
sudo ydb_restore_full_ Load a previously saved database backup. For Admin UI instructions see
backup Database backup/restore in the Administration Guide