Security

Create a firewall rule

Parameters
typerequiredString"global" or "rich" firewall rule
portrequiredInteger | StringPort number or range of port number. E.g: 8000-8999
protocolrequiredString"tcp" or "udp"
ipAddressOnly if type is "rich"StringIP Address or CIDR
firewallActionOnly if type is "rich"String"accept" or "reject"

POST /servers/{serverId}/security/firewalls

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

Parameters
iprequiredStringThe blocked IP address you wanted to remove

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

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"
}