Create a firewall rule

POST /servers/{serverId}/security/firewalls

Parameters
type requiredString“global” or “rich” firewall rule
port requiredInteger | StringPort number or range of port number. E.g: 8000-8999
protocol requiredString“tcp” or “udp”
ipAddress Only if type is “rich”StringIP Address or CIDR
firewallAction Only if type is “rich”String“accept” or “reject”
HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/security/firewalls
Request
curl --request POST \
  --url https://manage.runcloud.io/api/v2/servers/7/security/firewalls \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "type": "rich",
    "port": 9000,
    "protocol": "tcp",
    "ipAddress": "192.168.43.0/24",
    "firewallAction": "accept"
}'
Response
{
    "id": 200,
    "type": "rich",
    "port": "9000",
    "protocol": "tcp",
    "ipAddress": "192.168.43.0/24",
    "firewallAction": "accept",
    "created_at": "2019-06-27 09:55:35"
}

List firewall rules

GET /servers/{serverId}/security/firewalls

HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/security/firewalls
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/security/firewalls \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
    "data": [
        {
            "id": 4,
            "type": "global",
            "port": "22",
            "protocol": "tcp",
            "ipAddress": null,
            "firewallAction": null,
            "created_at": "2019-02-17 01:12:15"
        },
        {
            "id": 6,
            "type": "global",
            "port": "443",
            "protocol": "tcp",
            "ipAddress": null,
            "firewallAction": null,
            "created_at": "2019-02-17 01:12:15"
        },
        {
            "id": 5,
            "type": "global",
            "port": "80",
            "protocol": "tcp",
            "ipAddress": null,
            "firewallAction": null,
            "created_at": "2019-02-17 01:12:15"
        },
        {
            "id": 200,
            "type": "rich",
            "port": "9000",
            "protocol": "tcp",
            "ipAddress": "192.168.43.0/24",
            "firewallAction": "accept",
            "created_at": "2019-06-27 09:55:35"
        }
    ],
    "meta": {
        "pagination": {
            "total": 4,
            "count": 4,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

Firewall object

PUT /servers/{serverId}/security/firewalls/{firewallId}

HTTP Request
PUT https://manage.runcloud.io/api/v2/servers/{serverId}/security/firewalls/{firewallId}
Request
curl --request GET \
    --url https://manage.runcloud.io/api/v2/servers/7/security/firewalls/202 \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    --header 'accept: application/json' \
    --header 'content-type: application/json'
Response
{
    "id": 202,
    "type": "rich",
    "port": "9000",
    "protocol": "tcp",
    "ipAddress": "192.168.43.0/24",
    "firewallAction": "accept",
    "created_at": "2019-06-27 10:15:07"
}

Deploy rules to server

PUT /servers/{serverId}/security/firewalls

HTTP Request
PUT https://manage.runcloud.io/api/v2/servers/{serverId}/security/firewalls
Request
curl --request PUT \
  --url https://manage.runcloud.io/api/v2/servers/7/security/firewalls \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response

Delete rule

DELETE /servers/{serverId}/security/firewalls/{firewallId}

HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/security/firewalls/{firewallId}
Request
curl --request DELETE \
  --url https://manage.runcloud.io/api/v2//servers/7/security/firewalls/200 \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
    "id": 200,
    "type": "rich",
    "port": "9000",
    "protocol": "tcp",
    "ipAddress": "192.168.43.0/24",
    "firewallAction": "accept",
    "created_at": "2019-06-27 09:55:35"
}

List Fail2Ban blocked IP Addresses

GET /servers/{serverId}/security/fail2ban/blockedip

HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/security/fail2ban/blockedip
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/security/fail2ban/blockedip \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
["1.1.1.3", "1.1.1.2", "1.1.1.1"]

Delete blocked IP Address

DELETE /servers/{serverId}/security/fail2ban/blockedip

Parameters
ip requiredStringThe blocked IP address you wanted to remove
HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/security/fail2ban/blockedip
Request
curl --request DELETE \
  --url https://manage.runcloud.io/api/v2/servers/7/security/fail2ban/blockedip \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "ip": "1.1.1.1"
}'
Response
{
    "ip": "1.1.1.1"
}