typeにfortigateを設定するとxSSHはFortigate機器へログインするものと認識しVDOM単位でコマンドを送信できるようになります。
{ "targets": [ { "type": "fortigate", "host": "HOSTNAME", "auth_method": "password", "user": "USER", "password": "PASSWORD", "fortigate": { "execute": { "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] } } } ] }
ログイン後にコマンドを送信したい場合はexecute内のcommandsで送信したいコマンドを複数設定できます。ファイルからコマンドを読み出して送信したい場合はfilesで複数設定できます。
VDOMを切り替えてコマンドを送信したい場合はvdomを設定します。VDOMは複数指定できます。存在しないVDOMを指定した場合はエラーとなり、新規にVDOMが作成されることはありません。
{ "targets": [ { "type": "fortigate", "host": "HOSTNAME", "auth_method": "password", "user": "USER", "password": "PASSWORD", "fortigate": { "execute": { "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, "vdom": [ { "name": "VDOM-NAME-A", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, { "name": "VDOM-NAME-B", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] } ] } } ] }
targetsは配列のため複数の接続先を指定したい場合は次のように設定します。
{ "targets": [ { "type": "fortigate", "host": "HOSTNAME", "auth_method": "password", "user": "USER", "password": "PASSWORD", "fortigate": { "execute": { "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, "vdom": [ { "name": "VDOM-NAME-A", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, { "name": "VDOM-NAME-B", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] } ] } }, { "type": "fortigate", "host": "HOSTNAME", "auth_method": "password", "user": "USER", "password": "PASSWORD", "fortigate": { "execute": { "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, "vdom": [ { "name": "VDOM-NAME-A", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] }, { "name": "VDOM-NAME-B", "command": ["COMMAND-1", "COMMAND-2", "COMMAND-3"], "file": ["/PATH/TO/FILE-1", "/PATH/TO/FILE-2", "PATH/TO/FILE-3"] } ] } } ] }