Flow matrix
Every network connection in the infrastructure, with its purpose and what allows it. Anything not in these tables is blocked.
Incoming flows from the Internet
| # | Source | Destination | Port | Why | Allowed by |
|---|---|---|---|---|---|
| E1 | Internet | trinity-prod · Traefik | 443, 80 | the site, the API and the docs; port 80 redirects to HTTPS and serves the Let's Encrypt challenge | GCP trinity-allow-web, UFW 80 and 443 |
| E2 | Internet | trinity-dev · Traefik | 443, 80 | the dev site and API | GCP trinity-allow-web, UFW 80 and 443 |
| E3 | Administrators | both VMs | 22 | SSH: Ansible, administration | GCP default-allow-ssh, UFW 22, SSH key |
Internal flows
Inside each VM, only through the Docker networks. Diagram: The two networks.
| # | Source | Destination | Port | Why | Allowed by |
|---|---|---|---|---|---|
| I1 | Traefik | trinity_web, trinity_api, trinity_docs (prod) | 3000, 8000, 8080 | serve the site, the API and the docs | trinity Docker network |
| I2 | api | db | 5432 | read and write products | internal Docker network |
Outgoing flows
| # | Source | Destination | Port | Why |
|---|---|---|---|---|
| S1 | the 3 runners | gitlab.com | 443 | ask for jobs and send logs back: the runner calls out, GitLab opens no connection to the servers |
| S2 | CI runner (*:build) | registry.gitlab.com | 443 | push the api:<sha>, web:<sha>, docs:<sha> images |
| S3 | Swarm on trinity-prod | registry.gitlab.com | 443 | pull the commit's images at deployment |
| S4 | Traefik | Let's Encrypt | 443 | obtain and renew certificates |
| S5 | trinity-dev (jobs and dev builds) | Docker Hub, npm, PyPI | 443 | base images and dependencies |
| S6 | both VMs | Ubuntu, Docker, GitLab Runner repositories | 443 | packages and updates (Ansible) |
| S7 | web | api.trinity.jostud.com (its own Traefik) | 443 | server-side rendering calls the API at its public address (API_URL) |
Flows outside our servers
| # | Source | Destination | Why |
|---|---|---|---|
| X1 | GitLab.com | GitHub (school repository) | mirror: every push is copied, over SSH, with a key generated by GitLab |
| X2 | GitLab.com | Datadog (us5.datadoghq.com) | CI Visibility: durations and statuses of pipelines and jobs |
Deliberately impossible
| Flow | Why it is blocked |
|---|---|
| Internet to the database (5432) | the database is only on the internal network, with no published port |
| Internet straight to the API, web or docs (8000, 3000, 8080) | no published port: only Traefik exposes 80 and 443 |
| Traefik to the database | Traefik is not on the internal network |
| GitLab to the servers | no deployment SSH key: the runners fetch the work themselves |
| SSH login with a password | disabled: key only |
| Remote desktop (3389) | default-allow-rdp rule deleted |