API Documentation

A documentation for developer

Security

POST Create firewall rule

HTTP Request

POST https://manage.runcloud.io/base-api/servers/<server.id>/security

Arguments

Parameters Required Description
type YES "global" or "rich" firewall rule
port YES Port number or range of port number. E.g: 8000-8999
protocol YES "tcp" or "udp"
ipAddress Only if type is "rich" IP Address or CIDR
richAction Only if type is "rich" "accept" or "reject"

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

GET List firewall rules

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

PUT Deploy rules to server

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 Delete rule

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

GET List Fail2Ban blocked IP Addresses

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 Delete blocked IP Address

HTTP Request

DELETE https://manage.runcloud.io/base-api/servers/<server.id>/security/fail2ban/blockedip

Arguments

Parameters Required Description
ip YES The blocked IP address you wanted to remove

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