Skip to main content

4.5 – IP filter (iptables)

You can set up IP files for SparkGateway.

First, save you ip filters into a JSON file. Here is the format of the IP filter configuration file:

{
  "zoneRules": {
    "HTTP_API": {
      "allow": true,
      "ranges": [
        {
          "from": "192.168.12.100",
          "to": "192.168.12.200"
        },
        {
          "from": "169.254.84.132"
        }
      ]
    },
    "TCP": {
      "allow": true,
      "ranges": [
        {
          "from": "192.168.12.100",
          "to": "192.168.12.200"
        },
        {
          "from": "192.168.12.10",
          "to": "192.168.12.20"
        },
        {
          "from": "169.254.84.132"
        }
      ]
    }
  }
}

Then, you need to specify the location of this file in gateway.conf:
iptables= C:\\workspace\\data\\iptables.json

There are 3 zones available in SparkGateway:

  • "TCP" is used to control TCP connections
  • "HTTP_API" is used to control the HTTP API usage
  • "CONFIG" is used to control the config.html

Rules for accessing config.html:

  1. Always accessible from the localhost.
  2. Accessible from anywhere if remoteManage=true in gateay.conf and correct password is provided.
  3. Accessible if remoteManage=false and source IP is allowed in iptables.