GigakubeWikigigakube.ch →Menu ↓

Firewall

Every server has its own firewall: everything closed from outside until you open a port, everything open going out.

How it works

The rules for ports other than 80 and 443

To protect you from a common mistake (the database or SSH port open to the world), ports other than 80 and 443 have two extra rules:

  1. they can only be opened by saying from where: the source is required;
  2. opening them to the whole internet (0.0.0.0/0 or ::/0) can only be done by someone with Can manage or by the project owner. People with Can edit open them to specific addresses and networks.

Ports 80 and 443 can be opened to everyone by anyone with Can edit.

Opening a port

On the server page, under Firewall:

  1. Port: the number, from 1 to 65535;
  2. Protocol: tcp or udp;
  3. From: the source. The Me button fills in the address you are connected from right now (handy for SSH from your office). For 80 and 443 you can leave it empty: that means anywhere;
  4. Open.

When creating a server you can already open 80, 443 and 22 (see Virtual machines).

Changing a rule

Click the pencil (Change rule) next to the rule. You can change:

Then Save. The rule is replaced and gets a new id. The same rules as for opening apply.

Port ranges and the icmp protocol are set from here (and from the API with Cloud/updatePort), not from the field used to open a port.

Closing a port

The bin (Close port) next to the rule. Whatever the rule let in stops getting in immediately.

Examples

What you want Rule
A website open to everyone tcp 80 and tcp 443, From empty
SSH only from your office tcp 22 from 203.0.113.7 (or the office network, for example 203.0.113.0/24)
SSH from your current address tcp 22, Me button
A database reachable only from another of your servers No rules: use the project's private network
WireGuard open to everyone (needs Can manage) udp 51820 from 0.0.0.0/0, and another from ::/0 for IPv6

For developers

What Method MCP tool Role
A server's rules Cloud/getFirewall (server_id) cloud_get_firewall viewer
Open Cloud/openPort (server_id, port, protocol: tcp/udp, source?) cloud_open_port operator (admin for non-web ports to the whole internet)
Change Cloud/updatePort (server_id, rule_id, protocol: tcp/udp/icmp, port, port_max?, source?) cloud_update_port as above
Close Cloud/closePort (server_id, rule_id) cloud_close_port operator
The address you are calling from Customer/getMyAddress — panel only

Each rule has id, protocol, port, port_max, source (null = everyone). All writes accept dry_run.

Example, SSH from one address:

curl -s https://gigakube.ch/api/rpc \
  -H "Authorization: Bearer $GIGAKUBE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"Cloud/openPort","params":{"call_data":{"server_id":"<id>","port":22,"protocol":"tcp","source":"203.0.113.7/32"}}}'

Without source for a port other than 80 and 443 the response is a CLOUD_INVALID_REQUEST error (Ports [22] need an explicit source); to the whole internet without the role, CLOUD_FORBIDDEN.