Deprecation Notice - RunCloud API Beta is deprecated effective 31 May 2019. New API will be released and it's not backward compatible.

Security

Create a firewall rule

Arguments
typerequired"global" or "rich" firewall rule
portrequiredPort number or range of port number. E.g: 8000-8999
protocolrequired"tcp" or "udp"
ipAddressOnly if type is "rich"IP Address or CIDR
richActionOnly if type is "rich""accept" or "reject"

POST /servers/<server.id>/security

HTTP Request
POST https://manage.runcloud.io/base-api/servers/<server.id>/security
Request
curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "type": "rich",
        "port": "9000",
        "protocol": "tcp",
        "ipAddress": "192.168.1.1",
        "richAction": "accept"
    }'
Response
{
	"message": "Successfully added new firewall rule",
	"redirect": "/servers/yO4VAbX2BkNz/security"
}

List firewall rules

POST /servers/<server.id>/security

HTTP Request
GET https://manage.runcloud.io/base-api/servers/<server.id>/security
Request
curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"data": [
		{
			"id": "B5XMaKP2oWkO",
			"type": "Global",
			"port": "22",
			"protocol": "tcp",
			"ipAddress": null,
			"action": null,
			"_links": {
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/security/B5XMaKP2oWkO"
				}
			}
		},
		{
			"id": "QezxA5yAo6P1",
			"type": "Global",
			"port": "80",
			"protocol": "tcp",
			"ipAddress": null,
			"action": null,
			"_links": {
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/security/QezxA5yAo6P1"
				}
			}
		},
		{
			"id": "WwZ5AxXAKonR",
			"type": "Global",
			"port": "443",
			"protocol": "tcp",
			"ipAddress": null,
			"action": null,
			"_links": {
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/security/WwZ5AxXAKonR"
				}
			}
		},
		{
			"id": "g704AYp4lmNo",
			"type": "Rich",
			"port": "9000",
			"protocol": "tcp",
			"ipAddress": "192.168.1.1",
			"action": "Accept",
			"_links": {
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/security/g704AYp4lmNo"
				}
			}
		}
	]
}

Deploy rules to server

PUT /servers/<server.id>/security

HTTP Request
PUT https://manage.runcloud.io/base-api/servers/<server.id>/security
Request
curl -X PUT "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"message": "Successfully deployed your firewall. Changes will happen shortly"
}

Delete rule

DELETE /servers/<server.id>/security/<rule.id>

HTTP Request
DELETE https://manage.runcloud.io/base-api/servers/<server.id>/security/<rule.id>
Request
curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security/g704AYp4lmNo" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"message": "Successfully deleted firewall rule. Please deploy to make changes to the server."
}

List Fail2Ban blocked IP Addresses

GET /servers/<server.id>/security/fail2ban/blockedip

HTTP Request
GET https://manage.runcloud.io/base-api/servers/<server.id>/security/fail2ban/blockedip
Request
curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security/fail2ban/blockedip" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"success": true,
	"message": "",
	"ip": "192.168.1.2 192.168.1.3 192.168.10.4"
}

Delete blocked IP Address

Arguments
iprequiredThe blocked IP address you wanted to remove

DELETE /servers/<server.id>/security/fail2ban/blockedip

HTTP Request
DELETE https://manage.runcloud.io/base-api/servers/<server.id>/security/fail2ban/blockedip
Request
curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/security/fail2ban/blockedip" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "ip": "192.168.1.2"
    }'
Response
{
	"success": true,
	"message": "Successfully unban 192.168.1.2 from SSH login"
}