0

I would like to execute three commands in a fortinet firewall, the commands are:

#To enter in the config mode:
config vdom
#To select the virtual domain:
edit "name"
#To see the info I want:
get router info routing-table static

But I need to do it remotely, to do that, I try this:

ssh xx@xx "config vdom; edit "xxx"; get router info routing-table static"

When I do that, it executes only the command 1 and gives an error in the second and the third.

I tried changing the command to something like this and it executes 1 and 2, but not the third:

ssh xx@xx "config vdom edit "xxxx"; get router info routing-table static"

And I tried the same for the third one but it does not work...

Looks like it executes the commands independently and not in a sequence.

Is there a way to do that in a single command?

aldegalan
  • 43
  • 7

1 Answers1

1

I did it by using paramiko in a python script.

The command to introduce in the exec_command is this one:

command = "config vdom\nedit %s\nget router info routing-table static" % (vdom)
aldegalan
  • 43
  • 7