Skip to content
Guides & References

Fortinet FortiOS connection templates

The FortiGate templates in rconfig/rConfig-templates v2.2.2: standard, login banner, VDOM and non-interactive, and how to set FortiGate prompts.

Connection TemplatesUpdated
Platform
Fortinet
On this page

Fortinet FortiOS connection templates

The fortinet/ folder holds four SSH templates for FortiGate, all Core and Pro, none using enable mode. They differ in how the session starts. This page covers release v2.2.2.

Which template

Template Use for
fortinet-fortios-ssh-noenable The starting point for a standard FortiGate
fortinet-fortios-ssh-noenable-vdom FortiGates with VDOMs enabled
fortinet-fortios-ssh-noenable-banner A login banner that must be accepted with a
fortinet-fortios-ssh-noenable-noninteractive Running commands over a non-interactive SSH exec

FortiOS has no terminal length command. Every template turns paging off by changing the console output mode, which takes several lines:

pagingCmd (standard template)
config system console
set output standard
end

The VDOM template wraps the same lines in config global and a closing end, because console settings are global on a VDOM-enabled FortiGate.

The banner template adds a vt100 section. Before any prompt matching, rConfig reads up to (Press 'a' to accept): and sends a. Without it the session appears to hang, because rConfig is waiting for a prompt while the device is still showing its banner.

The non-interactive template sets isNonInteractiveMode, so each command runs over an SSH exec channel instead of being typed into an interactive shell and read back to the prompt (see non-interactive SSH in the repository). Its header notes that configurations of 30,000 lines or more need a higher timeout than the template’s 5 seconds.

The templates

rConfig-templates / fortinet /fortinet-fortios-ssh-noenable.ymlView on GitHub
Protocol
SSH, port 22
Enable
off
Paging
set output standard
Status
community-tested
rConfig-templates / fortinet /fortinet-fortios-ssh-noenable-vdom.ymlView on GitHub
Protocol
SSH, port 22
Enable
off
Paging
config global, set output standard
Status
community-tested
rConfig-templates / fortinet /fortinet-fortios-ssh-noenable-banner.ymlView on GitHub
Protocol
SSH, port 22
Banner
vt100, sends a
Paging
set output standard
Status
community-tested
rConfig-templates / fortinet /fortinet-fortios-ssh-noenable-noninteractive.ymlView on GitHub
Protocol
SSH, port 22
Mode
isNonInteractiveMode
Paging
set output standard
Status
community-tested

Device prompts

The template headers set out how to write a FortiGate prompt on the device record:

  • Use the form hostname #, with no regex wildcard (.*) between the hostname and the #.
  • If the prompt contains $, escape it with a backslash: prompt\$.

A bare # is too broad on a FortiGate: the configuration is full of # characters, and capture stops at the first one. See prompts, privilege and paging.


Type to search.