Skip to content

Commit

Permalink
ns-api: firewall, add log field for zones (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti authored Oct 7, 2024
1 parent d8e4a81 commit ece787f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/ns-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ Response:
"forward": "REJECT",
"masq": "1",
"mtu_fix": "1",
"log": "1",
"network": [
"wan6",
"RED_2",
Expand Down Expand Up @@ -627,7 +628,7 @@ Response:
Create zone:

```
api-cli ns.firewall create_zone --data '{"name": "cool_zone", "input": "DROP", "forward": "DROP", "traffic_to_wan": true, "forwards_to": [], "forwards_from": ["lan"]}'
api-cli ns.firewall create_zone --data '{"name": "cool_zone", "input": "DROP", "forward": "DROP", "traffic_to_wan": true, "forwards_to": [], "forwards_from": ["lan"], "log": true}'
```

Response:
Expand All @@ -643,7 +644,7 @@ Response:
Edit zone:

```
api-cli ns.firewall edit_zone --data '{"name": "cool_zone", "input": "ACCEPT", "forward": "REJECT", "traffic_to_wan": false, "forwards_to": ["lan"], "forwards_from": ["guest"]}'
api-cli ns.firewall edit_zone --data '{"name": "cool_zone", "input": "ACCEPT", "forward": "REJECT", "traffic_to_wan": false, "forwards_to": ["lan"], "forwards_from": ["guest"], "log": false}'
```

Response:
Expand Down
14 changes: 10 additions & 4 deletions packages/ns-api/files/ns.firewall
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ if cmd == 'list':
'forward': 'String',
'traffic_to_wan': 'Boolean',
'forwards_to': 'Array',
'forwards_from': 'Array'
'forwards_from': 'Array',
'log': 'Boolean',
},
'edit_zone': {
'name': 'String',
'input': 'String',
'forward': 'String',
'traffic_to_wan': 'Boolean',
'forwards_to': 'Array',
'forwards_from': 'Array'
'forwards_from': 'Array',
'log': 'Boolean',
},
'delete_zone': {
'config_name': 'String'
Expand Down Expand Up @@ -173,7 +175,9 @@ elif cmd == 'call':
data['forward'],
data['traffic_to_wan'],
data['forwards_to'],
data['forwards_from'], )
data['forwards_from'],
data.get('log', False)
)

if type(ret) is tuple:
# success
Expand All @@ -189,7 +193,9 @@ elif cmd == 'call':
data['forward'],
data['traffic_to_wan'],
data['forwards_to'],
data['forwards_from'])
data['forwards_from'],
data.get('log', False)
)

if type(ret) is tuple:
# success
Expand Down

0 comments on commit ece787f

Please sign in to comment.