Layerbeat

Add a firewall rule

POST
/v1/vms/{id}/firewall-rules

Adds an inbound firewall rule to the VPS.

Access: API key: vm:write · Session: developer, admin or owner.

Authorization

headerAuthorizationBearer <token>

Send Authorization: Bearer <token>. A token is an API key (lb_live_…, scoped, for programs) or a session (lb_sess_…, from signup or login, for people). See Authentication above.

Path Parameters

id*string

The resource id.

Header Parameters

X-Org-ID?string

Sessions only: act on this organization (you must be a member). Default: your first organization.

Request Body

application/json
  1. body
protocol*string
Value in"tcp""udp""icmp""all"
port?string

ALL, a port like 443, or a range like 8000-8100. Ignored for icmp and all.

cidr?string

Default 0.0.0.0/0.

action?string

Default accept.

Value in"accept""drop"
description?string
Lengthlength <= 64

Response Body

Rule added

application/json
  1. response
id*string

Stable id derived from protocol, port, cidr and action.

protocol*string
Value in"tcp""udp""icmp""all"
port*string

ALL, a port like 443, or a range like 8000-8100.

cidr*string

IPv4 or IPv6 address or block.

action*string
Value in"accept""drop"
description*string
curl -X POST 'https://layerbeat.com/v1/vms/string/firewall-rules' \  -H 'Content-Type: application/json' \  -d '{  "protocol": "tcp",  "port": "443",  "description": "HTTPS"}'
{  "id": "fw_0c9e71aac8634b64",  "protocol": "tcp",  "port": "443",  "cidr": "0.0.0.0/0",  "action": "accept",  "description": "HTTPS"}