Esta é uma API de gerenciamento das regras de entrada de Firewall
Regras de entrada do firewall, é usada para permitir/bloquear tráfego de entrada para o próprio servidor de firewall.
API de listagem de regras de entrada
Exemplo de requisição
GET /api/firewall/rules/input HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.firewall.get_input_rules()
print(response.payload)
const response = sdk.firewall.getInputRules();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"input_rules": [
{
"id": 1,
"enabled": true,
"order": 3,
"group_id": 1,
"description": "Rule01",
"action": "accept",
"protocol": "tcp/udp",
"log_enabled": false,
"log_info": null,
"src_conn_type": "connection",
"src_conn": "iface:1",
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
},
{
"id": 2,
"enabled": true,
"order": 8,
"group_id": 2,
"description": "Rule02",
"action": "accept",
"protocol": "ip",
"log_enabled": false,
"log_info": null,
"src_conn_type": "connection",
"src_conn": "iface:1",
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "network",
"dst_addr": "192.168.0.0/24",
"dst_port_type": null,
"dst_port": null,
"created_at": "2018-12-13T14:15:02.932000+00:00",
"updated_at": "2018-12-13T14:15:02.932000+00:00"
}
]
}
[
InputRule(
id=1,
enabled=True,
order=3,
group_id=1,
description="Rule01",
action="accept",
protocol="tcp/udp",
log_enabled=False,
log_info=None,
src_conn_type="connection",
src_conn="iface:1",
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
),
InputRule(
id=2,
enabled=True,
order=8,
group_id=2,
description="Rule02",
action="accept",
protocol="ip",
log_enabled=False,
log_info=None,
src_conn_type="connection",
src_conn="iface:1",
src_addr_type="zone",
src_addr="wan",
dst_addr_type="network",
dst_addr="192.168.0.0/24",
dst_port_type=None,
dst_port=None,
created_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00'))
)
]
[
{
id: 1,
enabled: true,
order: 3,
groupId: 1,
description: "Rule01",
action: "accept",
protocol: "tcp/udp",
logEnabled: false,
logInfo: null,
srcConnType: "connection",
srcConn: "iface:1",
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
},
{
id: 2,
enabled: true,
order: 8,
groupId: 2,
description: "Rule02",
action: "accept",
protocol: "ip",
logEnabled: false,
logInfo: null,
srcConnType: "connection",
srcConn: "iface:1",
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "network",
dstAddr: "192.168.0.0/24",
dstPortType: null,
dstPort: null,
createdAt: "2018-12-13T14:15:02.000Z",
updatedAt: "2018-12-13T14:15:02.000Z"
}
];
API de consulta de regra de entrada
id
Exemplo de requisição
GET /api/firewall/rules/input/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.firewall.get_input_rule(id=1)
print(response.payload)
const response = sdk.firewall.getInputRule({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"enabled": true,
"order": 3,
"group_id": 1,
"description": "Rule01",
"action": "accept",
"protocol": "tcp/udp",
"log_enabled": false,
"log_info": null,
"src_conn_type": "connection",
"src_conn": "iface:1",
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
}
InputRule(
id=1,
enabled=True,
order=3,
group_id=1,
description="Rule01",
action="accept",
protocol="tcp/udp",
log_enabled=False,
log_info=None,
src_conn_type="connection",
src_conn="iface:1",
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
enabled: true,
order: 3,
groupId: 1,
description: "Rule01",
action: "accept",
protocol: "tcp/udp",
logEnabled: false,
logInfo: null,
srcConnType: "connection",
srcConn: "iface:1",
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API de criação de regra de entrada
Exemplo de requisição
POST /api/firewall/rules/input HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "accept",
"protocol": "tcp",
"log_enabled": false,
"src_conn_type": "connection",
"src_conn": "iface:1",
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"apply": true
}
from itflex_sdk.firewall.types import CreateInputRuleRequest
request = CreateInputRuleRequest(
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="accept",
protocol="tcp",
log_enabled=False,
src_conn_type="connection",
src_conn="iface:1",
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
apply=True
)
response = sdk.firewall.create_input_rule(request)
print(response.payload)
const inputRule = sdk.dbc.types.InputRule();
inputRule.enabled = true;
inputRule.order = 11;
inputRule.groupId = 1;
inputRule.description = "New Rule";
inputRule.action = "accept";
inputRule.protocol = "tcp";
inputRule.logEnabled = false;
inputRule.srcConnType = "connection";
inputRule.srcConn = "iface:1";
inputRule.srcAddrType = "zone";
inputRule.srcAddr = "wan";
inputRule.dstAddrType = "zone";
inputRule.dstAddr = "wan";
inputRule.dstPortType = "range";
inputRule.dstPort = "8000:8080";
inputRule.apply = true;
const response = sdk.firewall.createInputRule(inputRule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 3,
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "accept",
"protocol": "tcp",
"log_enabled": false,
"log_info": null,
"src_conn_type": "connection",
"src_conn": "iface:1",
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T09:20:02.932000+00:00"
}
InputRule(
id=3,
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="accept",
protocol="tcp",
log_enabled=False,
log_info=None,
src_conn_type="connection",
src_conn="iface:1",
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 3,
enabled: true,
order: 11,
groupId: 1,
description: "New Rule",
action: "accept",
protocol: "tcp",
logEnabled: false,
logInfo: null,
srcConnType: "connection",
srcConn: "iface:1",
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T09:20:02.000Z"
}
API de edição de regra de entrada
id
Exemplo de requisição
PUT /api/firewall/rules/input/3 HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"order": 11,
"description": "New Rule",
"action": "accept",
"protocol": "ip",
"log_enabled": true,
"log_info": "test log message",
"src_conn_type": "any",
"src_addr_type": "any",
"dst_addr_type": "any",
"dst_addr": "wan",
"apply": true
}
from itflex_sdk.firewall.types import UpdateInputRuleRequest
request = UpdateInputRuleRequest(
id=3,
enabled=True,
order=11,
description="New Rule",
action="accept",
protocol="ip",
log_enabled=True,
log_info="test log message",
src_conn_type="any",
src_addr_type="any",
dst_addr_type="any",
apply=True
)
response = sdk.firewall.update_input_rule(request)
print(response.payload)
const inputRule = {
id: 3,
enabled: true,
order: 11,
description: "New Rule",
action: "accept",
protocol: "ip",
logEnabled: true,
logInfo: "test log message",
srcConnType: "any",
srcAddrType: "any",
dstAddrType: "any",
apply: true
};
const response = sdk.firewall.updateInputRule(inputRule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 3,
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "accept",
"protocol": "ip",
"log_enabled": true,
"log_info": "test log message",
"src_conn_type": "any",
"src_conn": null,
"src_addr_type": "any",
"src_addr": null,
"dst_addr_type": "any",
"dst_addr": null,
"dst_port_type": null,
"dst_port": null,
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T10:30:02.932000+00:00"
}
InputRule(
id=3,
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="accept",
protocol="ip",
log_enabled=True,
log_info="test log message",
src_conn_type="any",
src_conn=None,
src_addr_type="any",
src_addr=None,
dst_addr_type="any",
dst_addr=None,
dst_port_type=None,
dst_port=None,
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 10, 30, 2, tzinfo=Timezone('+00:00'))
)
{
id: 3,
enabled: true,
order: 11,
groupId: 1,
description: "New Rule",
action: "accept",
protocol: "ip",
logEnabled: true,
logInfo: "test log message",
srcConnType: "any",
srcConn: null,
srcAddrType: "any",
srcAddr: null,
dstAddrType: "any",
dstAddr: null,
dstPortType: null,
dstPort: null,
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T10:30:02.000Z"
}
API de exclusão de regra de entrada
id
Exemplo de requisição
DELETE /api/firewall/rules/input/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.firewall.delete_input_rule(id=1)
const response = sdk.firewall.deleteInputRule({ id: 1 });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API de aplicação de regras de entrada
Exemplo de requisição
POST /api/firewall/rules/input/apply HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.firewall.apply_input_rules()
const response = sdk.firewall.applyInputRules();
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Parâmetros da url
Campo | Descrição |
---|---|
id | int Identificador da regra de entrada |
Requisição
Campo | Descrição | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enabled | boolrequerido Flag que determina se regra está habilitada ou desabilitada. |
||||||||||||
order | intrequerido Campo indicador da ordem da regra em relação às demais regras do grupo. Deve ser sempre um número positivo. |
||||||||||||
group_id | intrequerido Identificador do grupo da regra. |
||||||||||||
description | stringrequerido Breve descrição da regra. Tamanho máximo: 30 caracteres |
||||||||||||
action | stringrequerido Ação que a regra executará. Valores possíveis:
|
||||||||||||
protocol | stringrequerido Protocolo da regra. Valores possíveis:
|
||||||||||||
log_enabled | bool Flag que a indica a geração de uma regra de log. Ocultar/Ignorar se: campo Valor padrão: |
||||||||||||
log_info | bool Texto do log da regra. Requerido se:
Deve satisfazer a expressão:
|
||||||||||||
src_conn_type | stringrequerido Tipo da conexão de entrada dos pacotes. Valores possíveis:
|
||||||||||||
src_conn | string Conexão ou Zona de origem dos pacotes. O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
src_addr_type | stringrequerido Tipo do endereço de origem dos pacotes. Valores possíveis:
|
||||||||||||
src_addr | string Endereço de origem dos pacotes. O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
dst_addr_type | stringrequerido Tipo do endereço de destino dos pacotes. Valores possíveis:
|
||||||||||||
dst_addr | string Endereço de destino dos pacotes. O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
dst_port_type | string Tipo da porta de destino dos pacotes. Se o valor do campo
|
||||||||||||
dst_port | string Porta ou faixa de portas de destino do pacote. Se o valor do campo O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
apply | bool Flag que indica se as informações serão provisionadas imediatamente após a criação ou edição Valor padrão: |
Resposta
Campo | Descrição |
---|---|
id | int Identificador da regra de entrada |
enabled | bool Flag que determina se regra está habilitada ou desabilitada. |
order | int Campo indicador da ordem da regra em relação às demais regras do grupo. |
group_id | int Identificador do grupo da regra. |
description | string Breve descrição da regra. |
action | string Ação que a regra executará. |
protocol | string Protocolo da regra. |
log_enabled | string Flag que a indica a geração de uma regra de log. |
log_info | bool Texto do log da regra. |
src_conn_type | string Tipo da conexão de entrada dos pacotes. |
src_conn | string Conexão ou Zona de origem dos pacotes. |
src_addr_type | string Tipo do endereço de origem dos pacotes. |
src_addr | string Endereço de origem dos pacotes. |
dst_addr_type | string Tipo do endereço de destino dos pacotes. |
dst_addr | string Endereço de destino dos pacotes. |
dst_port_type | string Tipo da porta de destino dos pacotes. |
dst_port | string Porta ou faixa de portas de destino do pacote. |
created_at | string Data de criação
|
updated_at | string Data da última edição
|