Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #4

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ force_handlers = True
stdout_callback = yaml

[ssh_connection]
pipelining = True
#pipelining = True
143 changes: 143 additions & 0 deletions documentation/importer/fortinet/fortiManager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Integrating Fortinet FortiManager 7.x

## Create api user
```console
create api user
config system admin user
edit "apiuser"
set password xxx
set adom "all_adoms"
set rpc-permit read-write
```

## login
```console
curl --request POST \
--url https://10.5.1.55/jsonrpc \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"method": "exec",
"params": [
{
"data": [
{
"passwd": "xxx",
"user": "apiuser"
}
],
"url": "sys/login/user"
}
]
}'
```

gives
```json
{
"id": 1,
"result": [
{
"status": {
"code": 0,
"message": "OK"
},
"url": "sys\/login\/user"
}
],
"session": "KCOuhqKTFt3ISXKntpIVO2kA5GJ+QcorMoxm8xLGru0HxrwwpgWuTtRcU8P9XCpbIRlDjjSv2+lzTYYIt1bSzw=="
}
```

## logout

```console
curl --request POST \
--url https://10.5.1.55/jsonrpc \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "1.0",
"method": "exec",
"params": [
{
"url": "sys/logout"
}
],
"verbose": 1,
"session": "BJG0kh4qBopxgjJ+DwEyxJSWCl3MzHdeeympX4GJqw50EoLIjXoLH3+7W3e4N9EqtWb5IhGKBJugGKS6HQrDUg=="
}'
```

## get a list of all ADOMs

```console
curl --request POST \
--url https://10.5.1.55/jsonrpc \
--header 'Content-Type: application/json' \
--data '{
"method": "get",
"params": [
{
"fields": ["name", "oid", "uuid"],
"url": "/dvmdb/adom"
}
],
"session": "lieHUJqiA0VldI45nVh8K2o0kP2XRm7NrrayIL1t977BG78\/wukwCgnFnpClbH9A6rAQbCPVjcGVFOw1VwULLQ=="
}
'
```

## get a list of fw rules

```console
curl --request POST \
--url https://10.5.1.55/jsonrpc \
--header 'Content-Type: application/json' \
--data '{
"method": "get",
"params": [
{
"url": "/pm/config/adom/my_adom/pkg/mypkg/firewall/policy"
}
],
"verbose": 1,
"id": 2,
"session": "++7z161rod0cGMaStLUWohDpyUnsyT030tNuLPyVYvIhd0GCLXwp9vCJRKnYV4I0Q\/di1bSL3Wf7o8oNnWu6cw=="
}'
```

## get nat rules

### get snat rules
```console
{
"method": "get",
"params": [
{
"url": "/pm/config/adom/my_adom/pkg/mypkg/firewall/central-snat-map"
}
],
"verbose": 1,
"id": 2,
"session": "++7z161rod0cGMaStLUWohDpyUnsyT030tNuLPyVYvIhd0GCLXwp9vCJRKnYV4I0Q\/di1bSL3Wf7o8oNnWu6cw=="
}'
```
### get dnat rules

```console
curl --request POST \
--url https://10.5.1.55/jsonrpc \
--header 'Content-Type: application/json' \
--data '{
"method": "get",
"params": [
{
"url": "/pm/config/adom/my_adom/pkg/mypkg/firewall/central/dnat"
}
],
"verbose": 1,
"id": 2,
"session": "++7z161rod0cGMaStLUWohDpyUnsyT030tNuLPyVYvIhd0GCLXwp9vCJRKnYV4I0Q\/di1bSL3Wf7o8oNnWu6cw=="
}'
```
3 changes: 3 additions & 0 deletions documentation/importer/import-via-fw-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Importing firewall configs via API

Use a tool like insomnia for testing.
Loading