-
Notifications
You must be signed in to change notification settings - Fork 46
Move co-located containers onto shared foreman-core-network #728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,36 +10,14 @@ The `iop` feature depends on `rh-cloud`, which installs the `foreman_rh_cloud` p | |
|
|
||
| ## Architecture | ||
|
|
||
| IOP runs as a set of containerized services managed via podman quadlets on the `iop-core-network` (bridge, `10.130.0.0/24`). The gateway is registered as a Foreman smart proxy at `https://localhost:24443`. | ||
| IOP runs as a set of containerized services managed via podman quadlets on the shared `foreman-core-network` (bridge, `10.130.0.0/24`), alongside Foreman, Postgres, and other co-located services. See [Network Architecture](network.md) for the host/bridge split, unix sockets, and published ports. | ||
|
|
||
| The subnet matches the former `iop-core-network` so the gateway image nginx resolver (`10.130.0.1`) can resolve upstream service names. The gateway is registered as a Foreman smart proxy at `https://iop-core-gateway:8443` (host publish remains `127.0.0.1:24443` for host-side tools and tests). | ||
|
|
||
| ```mermaid | ||
| graph TB | ||
| subgraph Host["Host System"] | ||
| Foreman["Foreman<br/>(foreman_rh_cloud)"] | ||
| Apache["Apache httpd"] | ||
| PG[(PostgreSQL)] | ||
|
|
||
| subgraph Network["iop-core-network (10.130.0.0/24)"] | ||
| Kafka[Kafka] | ||
|
|
||
| subgraph Core["Core Pipeline"] | ||
| Ingress[Ingress] | ||
| Puptoo[Puptoo] | ||
| Yuptoo[Yuptoo] | ||
| Engine[Engine] | ||
| end | ||
|
|
||
| Gateway["Gateway<br/>:24443"] | ||
|
|
||
| subgraph Services["Application Services"] | ||
| Inventory["Inventory API<br/>:8081"] | ||
| Advisor["Advisor API<br/>:8000"] | ||
| Remediation["Remediation API<br/>:3000"] | ||
| VMAAS["VMAAS<br/>(reposcan + webapp)"] | ||
| Vuln["Vulnerability<br/>(8 containers)"] | ||
| end | ||
| end | ||
|
|
||
| subgraph Frontends["Frontend Assets (/var/www/iop)"] | ||
| InventoryFE[Inventory Frontend] | ||
| AdvisorFE[Advisor Frontend] | ||
|
|
@@ -49,6 +27,29 @@ graph TB | |
| CVEMap["CVE Map Downloader<br/>(systemd timer + path watcher)"] | ||
| end | ||
|
|
||
| subgraph Network["foreman-core-network (10.130.0.0/24)"] | ||
| Foreman["Foreman<br/>(foreman_rh_cloud)"] | ||
| PG[(PostgreSQL)] | ||
| Kafka[Kafka] | ||
|
|
||
| subgraph Core["Core Pipeline"] | ||
| Ingress[Ingress] | ||
| Puptoo[Puptoo] | ||
| Yuptoo[Yuptoo] | ||
| Engine[Engine] | ||
| end | ||
|
|
||
| Gateway["Gateway<br/>:24443"] | ||
|
|
||
| subgraph Services["Application Services"] | ||
| Inventory["Inventory API<br/>:8081"] | ||
| Advisor["Advisor API<br/>:8000"] | ||
| Remediation["Remediation API<br/>:3000"] | ||
| VMAAS["VMAAS<br/>(reposcan + webapp)"] | ||
| Vuln["Vulnerability<br/>(8 containers)"] | ||
| end | ||
| end | ||
|
|
||
| Foreman -- "smart proxy<br/>relay" --> Gateway | ||
| Gateway --> Kafka | ||
| Apache -- "Alias" --> Frontends | ||
|
|
@@ -113,7 +114,7 @@ Key Kafka topics: | |
| | gateway | `iop-core-gateway` | 127.0.0.1:24443 | nginx proxy, smart proxy relay to Foreman | | ||
| | inventory | `iop-core-host-inventory-migrate` (oneshot), `iop-core-host-inventory`, `iop-core-host-inventory-api`, `iop-core-host-inventory-cleanup` (timer) | 8081 (internal) | Host inventory with DB migration, MQ consumer, REST API, and periodic cleanup | | ||
| | advisor | `iop-service-advisor-backend-api`, `iop-service-advisor-backend-service` | 8000 (internal) | Advisor recommendations | | ||
| | remediation | `iop-service-remediations-api` | 3000 (host network) | Remediation playbook generation | | ||
| | remediation | `iop-service-remediations-api` | 3000 (internal) | Remediation playbook generation | | ||
| | vmaas | `iop-service-vmaas-reposcan`, `iop-service-vmaas-webapp-go` | - | Vulnerability metadata and advisory sync | | ||
| | vulnerability | 8 containers (see below) | 8443 (internal) | Vulnerability assessment pipeline | | ||
|
|
||
|
|
@@ -132,11 +133,7 @@ Key Kafka topics: | |
|
|
||
| ### Network | ||
|
|
||
| All IOP containers join the `iop-core-network` bridge network (`10.130.0.0/24`, gateway `10.130.0.1`). Containers communicate with each other by container name within this network. | ||
|
|
||
| Database connectivity uses `host.containers.internal:5432` to reach the host's PostgreSQL instance. SSL is disabled for these internal connections. | ||
|
|
||
| The gateway binds only to `127.0.0.1:24443` so it is not externally accessible. | ||
| All IOP containers join `foreman-core-network` and reach Postgres at `postgresql:5432`. The gateway is published on host loopback as `127.0.0.1:24443` (container port `8443`) so it is not externally accessible; the Foreman container talks to it as `https://iop-core-gateway:8443`. The gateway relays to Foreman via `https://host.containers.internal` (Apache on the host). See [Network Architecture](network.md). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 1170 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target documentation ---'
sed -n '125,145p' docs/architecture/iop.md
sed -n '150,170p' docs/architecture/network.md
printf '%s\n' '--- relevant configuration references ---'
rg -n -S --glob '!node_modules' --glob '!dist' --glob '!build' \
'host\.containers\.internal|proxy_ssl_name|proxy_ssl_server_name|proxy_ssl_verify|proxy_pass|iop-core-gateway|foreman.*(fqdn|FQDN)|server_name' .Repository: theforeman/foremanctl Length of output: 16615 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- relay template ---'
cat -n src/roles/iop_gateway/templates/relay.conf.j2
printf '%s\n' '--- gateway defaults and deployment mounts ---'
cat -n src/roles/iop_gateway/defaults/main.yaml
sed -n '1,85p' src/roles/iop_gateway/tasks/main.yaml
printf '%s\n' '--- certificate and Foreman identity definitions ---'
sed -n '1,45p' src/vars/certificates.yml
rg -n -S --glob '*.yaml' --glob '*.yml' --glob '*.j2' \
'foreman_name|foreman.*certificate|proxy_ssl_trusted_certificate|proxy_ssl_verify|proxy_ssl_server_name|ca\.crt|certificates_ca_directory' srcRepository: theforeman/foremanctl Length of output: 21443 🌐 Web query:
💡 Result: These directives are part of the ngx_http_proxy_module in NGINX and are used to configure SSL/TLS connections between NGINX and a proxied HTTPS server [1]. proxy_ssl_server_name Syntax: proxy_ssl_server_name on | off; Default: proxy_ssl_server_name off; Context: http, server, location This directive enables or disables the passing of the server name through the TLS Server Name Indication (SNI) extension when establishing a connection with the proxied HTTPS server [1]. proxy_ssl_verify Syntax: proxy_ssl_verify on | off; Default: proxy_ssl_verify off; Context: http, server, location This directive enables or disables the verification of the proxied HTTPS server certificate [1]. proxy_ssl_trusted_certificate Syntax: proxy_ssl_trusted_certificate file; Default: — Context: http, server, location This directive specifies a file containing trusted CA certificates in PEM format, which is used to verify the certificate of the proxied HTTPS server [1]. proxy_ssl_name Syntax: proxy_ssl_name name; Default: proxy_ssl_name $proxy_host; Context: http, server, location This directive allows you to override the server name used for two purposes: to verify the certificate of the proxied HTTPS server and to be passed through SNI when establishing the connection. By default, it uses the host part of the proxy_pass URL [1]. Citations: 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- gateway image and relay references ---'
rg -n -S --glob '!node_modules' --glob '!dist' --glob '!build' \
'iop_gateway|smart-proxy-relay|relay\.conf|quay\.io/iop/gateway|proxy_ssl_' \
README.md docs src tests development 2>/dev/null || true
printf '%s\n' '--- Foreman HTTPD TLS configuration ---'
sed -n '35,65p' src/roles/httpd/templates/foreman-ssl-vhost.conf.j2
printf '%s\n' '--- base variable binding ---'
sed -n '20,82p' src/vars/base.yamlRepository: theforeman/foremanctl Length of output: 8972 Enable upstream TLS identity verification. The relay template sets 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| ### Smart Proxy Registration | ||
|
|
||
|
|
@@ -164,7 +161,8 @@ Timers: | |
|
|
||
| ## Databases | ||
|
|
||
| IOP creates five PostgreSQL databases, all accessible to containers via `host.containers.internal:5432`: | ||
| IOP creates five PostgreSQL databases, all accessible to containers via the | ||
| `postgresql` container on `foreman-core-network` (`postgresql:5432`): | ||
|
|
||
| | Database | User | | ||
| |----------|------| | ||
|
|
@@ -180,6 +178,8 @@ Passwords are auto-generated using Ansible's `password` lookup and stored as pod | |
|
|
||
| Advisor and vulnerability services use PostgreSQL foreign data wrappers (FDW) to query the inventory database directly, avoiding REST API overhead for bulk data access. | ||
|
|
||
| IOP app containers still connect as `postgresql:5432` on the bridge. FDW is different: Ansible sets up the foreign server from the host (`login_host: 127.0.0.1`, the published IPv4 port), and `CREATE SERVER` stores `host=127.0.0.1`, which Postgres interprets inside its own container so advisor/vuln stay on-box instead of hairpinning through the bridge. See [PostgreSQL from three vantage points](network.md#postgresql-from-three-vantage-points). | ||
|
|
||
| The reusable `iop_fdw` role sets up each FDW connection: | ||
|
|
||
| 1. Enables the `postgres_fdw` extension on the consuming database | ||
|
|
@@ -288,8 +288,8 @@ Gateway and service certificates use the default foremanctl CA infrastructure at | |
|
|
||
| | Certificate | Path | | ||
| |-------------|------| | ||
| | Gateway server cert | `certs/localhost.crt` | | ||
| | Gateway server key | `private/localhost.key` | | ||
| | Gateway server cert | `certs/iop-core-gateway.crt` | | ||
| | Gateway server key | `private/iop-core-gateway.key` | | ||
| | Gateway client cert | `certs/localhost-client.crt` | | ||
| | Gateway client key | `private/localhost-client.key` | | ||
| | CA | `certs/ca.crt` | | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🤖 get_repo_knowledge executed:
get_repo_knowledge theforeman/foremanctl /tmp/coderabbit-repo-knowledge/theforeman-foremanctl-289d0450/learnings /tmp/coderabbit-repo-knowledge/theforeman-foremanctl-289d0450/conventionsLength of output: 1377
🏁 Script executed:
Repository: theforeman/foremanctl
Length of output: 2921
🏁 Script executed:
Repository: theforeman/foremanctl
Length of output: 45219
Security Misconfiguration (CWE-16)
Reachability: External · Exploitability: Moderate
Bind the remote PostgreSQL port to an explicit interface.
The role publishes
postgresql_publishdirectly to Podman. This playbook overrides the role's loopback default with"5432:5432", which can bind PostgreSQL on all host interfaces. Bind it to the approved management interface and enforce the intended firewall scope.🤖 Prompt for AI Agents