PortGate

Resources · Product docs · Product doc

Installer and agent options

Every flag install.sh and agent.py accept, what each mode installs, and where the files, schedules and logs go.

install.sh

sh install.sh --token <TOKEN> --mode <server|ai-proxy|malware|all> [--url <ORIGIN>] [--upstream <MODEL_API_URL>]
Flag Required What it does
--token yes The install token from the dashboard. It decides which modes are allowed.
--mode yes What to install: server, ai-proxy, malware or all.
--url no The dashboard origin, such as https://portgate.dev. No path after it.
--upstream ai-proxy only The model API the proxy forwards to, such as http://127.0.0.1:11434. Must start with http:// or https://.

Run it as root, or with sudo or doas. The ai-proxy mode can also be installed without root; it then goes into $HOME/.portgate.

Modes add up. Running the installer again with another mode adds that part and leaves the others in place.

What each mode installs

Mode Runs as Schedule or service Log
server root cron job every 5 minutes, /etc/cron.d/portgate /var/log/portgate-heartbeat.log
malware root cron job every 15 minutes, /etc/cron.d/portgate-malware /var/log/portgate-malware.log
ai-proxy service portgate-ai-proxy always on, listens on 127.0.0.1:8787 the service journal
all all three as above as above

On Alpine the cron lines go into /etc/crontabs/root and the proxy runs as an OpenRC service with the same name.

Files

  • /opt/portgate/agent.py: the agent, one Python file you can read.
  • /opt/portgate/config.json: the dashboard URL, the token and the AI limits. Mode 600.
  • /opt/portgate/quarantine/: where you move files the malware scan reports, if you choose to.

A user install of the AI proxy uses ~/.portgate/ instead.

agent.py

python3 /opt/portgate/agent.py --mode <server|ai-proxy|all|malware> [--config /opt/portgate/config.json]

Running a mode by hand is the quickest way to see an error. For example, one heartbeat:

sudo python3 /opt/portgate/agent.py --mode server --config /opt/portgate/config.json

Using the AI proxy

Point your SDK or app at the proxy instead of the model API:

OPENAI_BASE_URL=http://127.0.0.1:8787/v1

The proxy blocks known prompt-injection patterns, redacts secrets in its local log, and enforces the daily request and token caps in config.json. Prompts stay on the machine; the dashboard only receives counts.

Change the dashboard address or the token

Re-run the installer with the new --url or --token. Editing config.json by hand is easy to get wrong. After switching tokens, revoke the old one in the dashboard.