Created on
‎10-01-2020
01:47 AM
Edited on
‎03-19-2025
07:15 AM
By
Jean-Philippe_P
Description
This article describes changes implemented to make administrative access to the GUI and CLI more secure.
Scope
FortiGate, FortiProxy.
Solution
Disable administrative access to the external (Internet-facing) interface.
When possible, do not allow administration access on the external (Internet-facing) interface.
To disable administrative access, go to Network -> Interfaces, edit the external interface, and disable HTTPS, PING, HTTP, SSH, and TELNET under Administrative Access.
From CLI:
config system interface
edit <external-interface-name>
unset allowaccess
end
Allow only HTTPS access to the GUI and SSH access to the CLI.
For greater security never allow HTTP or Telnet administrative access to a FortiGate interface, only allow HTTPS and SSH access.
Change these settings for individual interfaces by going to Network -> Interfaces and adjusting the administrative access to each interface.
From CLI:
config system interface
edit <interface-name>
set allowaccess https ssh
end
Require TLS v1.2 for HTTPS administrator access.
Use the following command to require TLS v1.2 for HTTPS administrator access from GUI:
config system global
set admin-https-ssl-versions tlsv1-2
end
TLS 1.2 is currently the most secure SSL/TLS-supported version for SSL-encrypted administrator access.
Re-direct HTTP GUI logins to HTTPS.
Go to System -> Settings -> Administrator Settings and enable 'Redirect to HTTPS' to make sure that all attempted HTTP login connections are redirected to HTTPS.
From CLI:
config system global
set admin-https-redirect enable
end
Change the HTTPS and SSH admin access ports to non-standard ports.
Go to System -> Settings -> Administrator Settings and change the HTTPS and SSH ports. Change the default port configurations for HTTPS and SSH administrative access for added security. To connect to a non-standard port, the new port number has to be included in the collection request.
For example:
- If the HTTPS port to 7734 is changed, browse to https://<ip-address>:7734
- If the SSH port to 2345 is changed, connect to SSH admin@<ip-address>:2345
From CLI:
config system global
set admin-sport 7734
set admin-ssh-port 2345
end
If the HTTPS or SSH port numbers are changed, make sure that the changes do not conflict with ports used for other services.
Maintain short login timeouts.
Set the idle timeout to a short time to avoid the possibility of an administrator walking away from their management computer and leaving it exposed to unauthorized personnel.
To set the administrator idle timeout, go to System -> Settings and enter the amount of time for the Idle timeout. A best practice is to keep the default time of 5 minutes.
From CLI.
config system global
set admintimeout 5
end
Use the following command to adjust the grace time permitted between making an SSH connection and authenticating. The range can be between 10 and 3600 seconds, the default is 120 seconds (minutes). Shortening this time decreases the chances of someone attempting a brute force attack from being successful.
For example, set the time to 30 seconds.
config system global
set admin-ssh-grace-time 30
end
set admintimeout 5
end
set admin-ssh-grace-time 30
end
For FortiProxy (v7.0/v7.2/v7.4/v7.6), the trusted host setting applies to the ping service. FortiProxy only responds to ping requests from trusted hosts. (The ping request will fail if the device is not inside the trusted host list).
To identify trusted hosts, go to System -> Administrators, edit the administrator account, enable Restrict login to trusted hosts, and add up to ten trusted host IP addresses.
edit <administrator-name>
set trusthost1 172.25.176.23 255.255.255.255
set trusthost2 172.25.177.0 255.255.255.0
end
- The list of administrators can be found under System -> Administrators.
- Select an Administrator and then edit.
- An option in the administrator edit page can be seen to enable trusted hosts ('Restrict login to trusted hosts').
- List the host IP or network addresses that can access the firewall.
Every registered FortiGate unit includes two trial tokens for free. Purchase additional tokens from the reseller or Fortinet.
To assign a FortiToken to an administrator, go to System -> Administrators and select 'Enable Two-factor Authentication' for each administrator.
Both the number of attempts (admin-lockout-threshold) and the wait time before the administrator can try to enter a password again (admin-lockout-duration) can be configured within the CLI.
Keep in mind that the higher the lockout threshold, the higher the risk that someone may be able to break into the FortiGate.
To set the admin-lockout-threshold to one attempt and the admin-lockout-duration to a five-minute duration before the administrator can try to log in again, enter the commands:
set admin-lockout-threshold 1
set admin-lockout-duration 300
end

Rename the admin administrator account.
Add administrator disclaimers.
FortiOS can display a disclaimer before or after logging from GUI or CLI (or both).
Use the following command to display a disclaimer before logging in:
set pre-login-banner enable
end
set post-login-banner enable
end
From the CLI:
config system replacemsg admin post_admin-disclaimer-text
Configure local-in policy to allow only authorized IPs and block unknown/malicious IPs from accessing the FortiGate:
FortiOS: Restricting Local Administrator Logins
FortiOS: starting from version 7.6.0.
allows restrictions on local administrator logins when the FortiGate can access the remote authentication server. This feature enhances system security by controlling login methods.
From the CLI:
config system global
set admin-restrict-local {all | non-console-only | disable}
end
Options:
all: Restricts all local admin logins, including the console.
non-console-only: Restricts non-console methods (e.g., SSH) but allows console access.
disable: No restrictions on local admin logins.