feat(neutron): run policy server checks in-process and add quarantine (#4439)

Signed-off-by: Mohammed Naser <435815+mnaser@users.noreply.github.com>
Co-authored-by: Mohammed Naser <435815+mnaser@users.noreply.github.com>
This commit is contained in:
Mohammed NaserandMohammed Naser authored and GitHub committed 2026-10-27 18:00:18 +00:00
1 parent e315a7a1b0
commit 6cd57b060a
15 files changed
+134 -415

No files matched your search

@@ -1,28 +0,0 @@
#!/bin/bash
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
COMMAND="${@:-start}"
function start () {
exec uwsgi --ini /etc/neutron/neutron-policy-server-uwsgi.ini
}
function stop () {
kill -TERM 1
}
$COMMAND
@@ -91,8 +91,6 @@ data:
{{- end }}
neutron-server.sh: |
{{ tuple "bin/_neutron-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-policy-server.sh: |
{{ tuple "bin/_neutron-policy-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-rpc-server.sh: |
{{ tuple "bin/_neutron-rpc-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-ironic-agent-init.sh: |
@@ -201,15 +201,6 @@ limitations under the License.
{{- $_ := set .Values.conf.neutron_api_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
{{- if empty .Values.conf.neutron_policy_server_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.neutron_policy_server_uwsgi.uwsgi "processes" .Values.conf.neutron.DEFAULT.api_workers -}}
{{- end -}}
{{- if empty (index .Values.conf.neutron_policy_server_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.neutron_policy_server_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
@@ -308,7 +299,6 @@ data:
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" $envAll.Values.conf.paste | b64enc }}
policy.yaml: {{ toYaml $envAll.Values.conf.policy | b64enc }}
neutron-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.neutron_api_uwsgi | b64enc }}
neutron-policy-server-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.neutron_policy_server_uwsgi | b64enc }}
neutron.conf: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.neutron | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
api_audit_map.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.api_audit_map | b64enc }}
@@ -289,64 +289,6 @@ spec:
{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.network.server.internal "path" "/etc/neutron/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
{{ if $mounts_neutron_server.volumeMounts }}{{ toYaml $mounts_neutron_server.volumeMounts | indent 12 }}{{ end }}
{{- if .Values.pod.sidecars.neutron_policy_server }}
- name: neutron-policy-server
{{ tuple $envAll "neutron_policy_server" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.neutron_policy_server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "neutron_server" "container" "neutron_policy_server" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/neutron-policy-server.sh
- start
ports:
- name: q-policy
containerPort: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
httpGet:
path: /health
port: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts:
- name: neutron-bin
mountPath: /tmp/neutron-policy-server.sh
subPath: neutron-policy-server.sh
readOnly: true
- name: neutron-etc
mountPath: /etc/neutron/neutron-policy-server-uwsgi.ini
subPath: neutron-policy-server-uwsgi.ini
readOnly: true
- name: neutron-etc
mountPath: /etc/neutron/neutron.conf
subPath: neutron.conf
readOnly: true
{{- if( has "tungstenfabric" .Values.network.backend ) }}
- name: neutron-etc
mountPath: /etc/neutron/plugins/tungstenfabric/tf_plugin.ini
subPath: tf_plugin.ini
readOnly: true
- name: neutron-etc
mountPath: /etc/contrail/vnc_api_lib.ini
subPath: vnc_api_lib.ini
readOnly: true
- name: neutron-plugin-shared
mountPath: /opt/plugin
- name: neutron-bin
mountPath: /usr/local/lib/python2.7/site-packages/tf-plugin.pth
subPath: tf-plugin.pth
readOnly: true
- name: neutron-bin
mountPath: /var/lib/openstack/lib/python2.7/site-packages/tf-plugin.pth
subPath: tf-plugin.pth
readOnly: true
- name: neutron-bin
mountPath: /var/lib/openstack/lib/python3.6/site-packages/tf-plugin.pth
subPath: tf-plugin.pth
readOnly: true
{{- else }}
- name: neutron-etc
mountPath: /etc/neutron/plugins/ml2/ml2_conf.ini
subPath: ml2_conf.ini
readOnly: true
{{- end }}
{{- end }}
volumes:
- name: pod-tmp
emptyDir: {}
@@ -26,11 +26,6 @@ spec:
{{ if .Values.network.server.node_port.enabled }}
nodePort: {{ .Values.network.server.node_port.port }}
{{ end }}
- name: q-policy
port: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ if .Values.network.server.node_port.enabled }}
nodePort: {{ .Values.network.server.node_port.port }}
{{ end }}
selector:
{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ if .Values.network.server.node_port.enabled }}
-33
View File
@@ -32,7 +32,6 @@ images:
ks_endpoints: docker.io/openstackhelm/heat:2024.1-ubuntu_jammy
netoffload: ghcr.io/vexxhost/netoffload:v1.0.1
neutron_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_policy_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_rpc_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_dhcp: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_metadata: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
@@ -389,8 +388,6 @@ dependencies:
service: local_image_registry
pod:
sidecars:
neutron_policy_server: false
use_fqdn:
neutron_agent: true
probes:
@@ -655,9 +652,6 @@ pod:
neutron_server:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
neutron_policy_server:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
neutron_rpc_server:
pod:
runAsUser: 42424
@@ -952,13 +946,6 @@ pod:
limits:
memory: "1024Mi"
cpu: "2000m"
neutron_policy_server:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
ironic_agent:
requests:
memory: "128Mi"
@@ -1387,22 +1374,6 @@ conf:
thunder-lock: true
worker-reload-mercy: 80
module: "neutron.wsgi.api:application"
neutron_policy_server_uwsgi:
uwsgi:
add-header: "Connection: close"
buffer-size: 65535
die-on-term: true
enable-threads: true
exit-on-reload: false
hook-master-start: unix_signal:15 gracefully_kill_them_all
lazy-apps: true
log-x-forwarded-for: true
master: true
procname-prefix-spaced: "neutron-policy-server:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/neutron-policy-server-wsgi
policy: {}
api_audit_map:
DEFAULT:
@@ -2571,10 +2542,6 @@ endpoints:
default: 9696
public: 80
service: 9696
policy_server:
default: 9697
public: 80
service: 9697
load_balancer:
name: octavia
hosts:
@@ -1,240 +0,0 @@
diff --git a/neutron/templates/bin/_neutron-policy-server.sh.tpl b/neutron/templates/bin/_neutron-policy-server.sh.tpl
new file mode 100644
index 00000000..3ff9c8dd
--- /dev/null
+++ b/neutron/templates/bin/_neutron-policy-server.sh.tpl
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+{{/*
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+set -ex
+COMMAND="${@:-start}"
+
+function start () {
+ exec uwsgi --ini /etc/neutron/neutron-policy-server-uwsgi.ini
+}
+
+function stop () {
+ kill -TERM 1
+}
+
+$COMMAND
diff --git a/neutron/templates/configmap-bin.yaml b/neutron/templates/configmap-bin.yaml
index 40b70060..b6ad4af4 100644
--- a/neutron/templates/configmap-bin.yaml
+++ b/neutron/templates/configmap-bin.yaml
@@ -91,6 +91,8 @@ data:
{{- end }}
neutron-server.sh: |
{{ tuple "bin/_neutron-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+ neutron-policy-server.sh: |
+{{ tuple "bin/_neutron-policy-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-rpc-server.sh: |
{{ tuple "bin/_neutron-rpc-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-ironic-agent.sh: |
diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml
index f7411bf5..bd52753d 100644
--- a/neutron/templates/configmap-etc.yaml
+++ b/neutron/templates/configmap-etc.yaml
@@ -198,6 +198,15 @@ limitations under the License.
{{- $_ := set .Values.conf.neutron_api_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
+{{- if empty .Values.conf.neutron_policy_server_uwsgi.uwsgi.processes -}}
+{{- $_ := set .Values.conf.neutron_policy_server_uwsgi.uwsgi "processes" .Values.conf.neutron.DEFAULT.api_workers -}}
+{{- end -}}
+{{- if empty (index .Values.conf.neutron_policy_server_uwsgi.uwsgi "http-socket") -}}
+{{- $http_socket_port := tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
+{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
+{{- $_ := set .Values.conf.neutron_policy_server_uwsgi.uwsgi "http-socket" $http_socket -}}
+{{- end -}}
+
{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
@@ -293,6 +302,7 @@ data:
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" $envAll.Values.conf.paste | b64enc }}
policy.yaml: {{ toYaml $envAll.Values.conf.policy | b64enc }}
neutron-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.neutron_api_uwsgi | b64enc }}
+ neutron-policy-server-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.neutron_policy_server_uwsgi | b64enc }}
neutron.conf: {{ include "helm-toolkit.utils.to_oslo_conf" $envAll.Values.conf.neutron | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
api_audit_map.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.api_audit_map | b64enc }}
diff --git a/neutron/templates/deployment-server.yaml b/neutron/templates/deployment-server.yaml
index b6b634d2..457401b4 100644
--- a/neutron/templates/deployment-server.yaml
+++ b/neutron/templates/deployment-server.yaml
@@ -275,6 +275,64 @@ spec:
{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.network.server.internal "path" "/etc/neutron/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
{{ if $mounts_neutron_server.volumeMounts }}{{ toYaml $mounts_neutron_server.volumeMounts | indent 12 }}{{ end }}
+ {{- if .Values.pod.sidecars.neutron_policy_server }}
+ - name: neutron-policy-server
+{{ tuple $envAll "neutron_policy_server" | include "helm-toolkit.snippets.image" | indent 10 }}
+{{ tuple $envAll $envAll.Values.pod.resources.neutron_policy_server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
+{{ dict "envAll" $envAll "application" "neutron_server" "container" "neutron_policy_server" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
+ command:
+ - /tmp/neutron-policy-server.sh
+ - start
+ ports:
+ - name: q-policy
+ containerPort: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+ readinessProbe:
+ httpGet:
+ path: /health
+ port: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+ volumeMounts:
+ - name: neutron-bin
+ mountPath: /tmp/neutron-policy-server.sh
+ subPath: neutron-policy-server.sh
+ readOnly: true
+ - name: neutron-etc
+ mountPath: /etc/neutron/neutron-policy-server-uwsgi.ini
+ subPath: neutron-policy-server-uwsgi.ini
+ readOnly: true
+ - name: neutron-etc
+ mountPath: /etc/neutron/neutron.conf
+ subPath: neutron.conf
+ readOnly: true
+ {{- if( has "tungstenfabric" .Values.network.backend ) }}
+ - name: neutron-etc
+ mountPath: /etc/neutron/plugins/tungstenfabric/tf_plugin.ini
+ subPath: tf_plugin.ini
+ readOnly: true
+ - name: neutron-etc
+ mountPath: /etc/contrail/vnc_api_lib.ini
+ subPath: vnc_api_lib.ini
+ readOnly: true
+ - name: neutron-plugin-shared
+ mountPath: /opt/plugin
+ - name: neutron-bin
+ mountPath: /usr/local/lib/python2.7/site-packages/tf-plugin.pth
+ subPath: tf-plugin.pth
+ readOnly: true
+ - name: neutron-bin
+ mountPath: /var/lib/openstack/lib/python2.7/site-packages/tf-plugin.pth
+ subPath: tf-plugin.pth
+ readOnly: true
+ - name: neutron-bin
+ mountPath: /var/lib/openstack/lib/python3.6/site-packages/tf-plugin.pth
+ subPath: tf-plugin.pth
+ readOnly: true
+ {{- else }}
+ - name: neutron-etc
+ mountPath: /etc/neutron/plugins/ml2/ml2_conf.ini
+ subPath: ml2_conf.ini
+ readOnly: true
+ {{- end }}
+ {{- end }}
volumes:
- name: pod-tmp
emptyDir: {}
diff --git a/neutron/templates/service-server.yaml b/neutron/templates/service-server.yaml
index 8fcee669..c7075b10 100644
--- a/neutron/templates/service-server.yaml
+++ b/neutron/templates/service-server.yaml
@@ -26,6 +26,11 @@ spec:
{{ if .Values.network.server.node_port.enabled }}
nodePort: {{ .Values.network.server.node_port.port }}
{{ end }}
+ - name: q-policy
+ port: {{ tuple "network" "service" "policy_server" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+ {{ if .Values.network.server.node_port.enabled }}
+ nodePort: {{ .Values.network.server.node_port.port }}
+ {{ end }}
selector:
{{ tuple $envAll "neutron" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ if .Values.network.server.node_port.enabled }}
diff --git a/neutron/values.yaml b/neutron/values.yaml
index 4e9c6a11..495e0bab 100644
--- a/neutron/values.yaml
+++ b/neutron/values.yaml
@@ -32,6 +32,7 @@ images:
ks_endpoints: docker.io/openstackhelm/heat:2024.1-ubuntu_jammy
netoffload: ghcr.io/vexxhost/netoffload:v1.0.1
neutron_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
+ neutron_policy_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_rpc_server: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_dhcp: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
neutron_metadata: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
@@ -372,6 +373,8 @@ dependencies:
service: local_image_registry
pod:
+ sidecars:
+ neutron_policy_server: false
use_fqdn:
neutron_agent: true
probes:
@@ -615,6 +618,9 @@ pod:
neutron_server:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
+ neutron_policy_server:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true
neutron_rpc_server:
pod:
runAsUser: 42424
@@ -890,6 +896,13 @@ pod:
limits:
memory: "1024Mi"
cpu: "2000m"
+ neutron_policy_server:
+ requests:
+ memory: "128Mi"
+ cpu: "100m"
+ limits:
+ memory: "256Mi"
+ cpu: "500m"
ironic_agent:
requests:
memory: "128Mi"
@@ -1318,6 +1331,22 @@ conf:
thunder-lock: true
worker-reload-mercy: 80
- wsgi-file: /var/lib/openstack/bin/neutron-api
+ module: "neutron.wsgi.api:application"
+ neutron_policy_server_uwsgi:
+ uwsgi:
+ add-header: "Connection: close"
+ buffer-size: 65535
+ die-on-term: true
+ enable-threads: true
+ exit-on-reload: false
+ hook-master-start: unix_signal:15 gracefully_kill_them_all
+ lazy-apps: true
+ log-x-forwarded-for: true
+ master: true
+ procname-prefix-spaced: "neutron-policy-server:"
+ route-user-agent: '^kube-probe.* donotlog:'
+ thunder-lock: true
+ worker-reload-mercy: 80
+ wsgi-file: /var/lib/openstack/bin/neutron-policy-server-wsgi
policy: {}
api_audit_map:
DEFAULT:
@@ -2463,6 +2492,10 @@ endpoints:
default: 9696
public: 80
service: 9696
+ policy_server:
+ default: 9697
+ public: 80
+ service: 9697
load_balancer:
name: octavia
hosts:
@@ -0,0 +1,12 @@
diff --git a/neutron/values.yaml b/neutron/values.yaml
index 4ffdd2f5..a4dd3a1a 100644
--- a/neutron/values.yaml
+++ b/neutron/values.yaml
@@ -1318,6 +1318,6 @@ conf:
thunder-lock: true
worker-reload-mercy: 80
- wsgi-file: /var/lib/openstack/bin/neutron-api
+ module: "neutron.wsgi.api:application"
policy: {}
api_audit_map:
DEFAULT:
@@ -33,8 +33,8 @@ diff --git a/neutron/templates/configmap-bin.yaml b/neutron/templates/configmap-
index 2032b156..87b2b798 100644
--- a/neutron/templates/configmap-bin.yaml
+++ b/neutron/templates/configmap-bin.yaml
@@ -95,6 +95,8 @@ data:
{{ tuple "bin/_neutron-policy-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
@@ -93,6 +93,8 @@ data:
{{ tuple "bin/_neutron-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
neutron-rpc-server.sh: |
{{ tuple "bin/_neutron-rpc-server.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+ neutron-ironic-agent-init.sh: |
+52 -9
View File
@@ -80,14 +80,57 @@ For a deeper dive into the Azure AD configuration within Keycloak, consult the
Neutron Policy Server
*********************
The `Neutron Policy Server <https://github.com/vexxhost/neutron-policy-server>`_ is a
straightforward service that provides the ability to manage and enforce policy more
complex policy rules inside Neutron.
The `Neutron Policy Server <https://github.com/vexxhost/neutron-policy-server>`_
provides policy checks that need more context than the Neutron policy file can
express, such as looking up other ports or security groups in the database.
This service runs as a sidecar WSGI server that responds to ``oslo.policy`` ``HttpCheck``
rules which are configured into the Neutron policy file.
The checks are installed in the Neutron image and run inside the Neutron API
server as ``oslo.policy`` rule checks, so they add no extra service or network
round trip. They are referenced in the Neutron policy file like this:
By default, the policy server is enabled and the Neutron policy is updated to include
the necessary checks. In order to disable the policy server, set the
``neutron_policy_server_integration_enabled`` variable to ``false`` in the deployment
configuration.
.. list-table::
:header-rows: 1
* - Check
- Purpose
* - ``address_pair:strict=1``
- Only allow allowed address pairs that point to addresses of ports in
the same network and project.
* - ``port_update:strict=1``
- Block changes to the IP or MAC address of a port that another port uses
as an allowed address pair.
* - ``port_delete:strict=1``
- Block deleting a port that another port uses as an allowed address pair.
* - ``quarantine:security_group=quarantine``
- Block project members from changing the security groups, allowed address
pairs or port security of a quarantined port.
With ``strict=0``, the address pair checks compare only IP addresses and ignore
MAC addresses.
By default, the policy server checks are enabled and the Neutron policy is
updated to include them. In order to disable them, set the
``neutron_policy_server_integration_enabled`` variable to ``false`` in the
deployment configuration.
Quarantining an instance
========================
A port is quarantined when it has a security group named ``quarantine`` that
belongs to a different project than the port. Project members cannot attach
security groups from other projects to their ports, so only an administrator
can place a port in quarantine.
To quarantine an instance:
#. As an administrator, create a security group named ``quarantine`` in an
administrative project, with rules that allow only the traffic you need,
such as access from a security operations network.
#. Replace all security groups on each of the instance's ports with the
``quarantine`` security group. Don't leave the project's own security groups
on the port, since project members can still change their rules.
#. Lock the instance so that project members cannot attach or detach network
interfaces.
To release the instance, an administrator restores the original security groups
on its ports and unlocks it.
@@ -0,0 +1,16 @@
---
features:
- |
Administrators can quarantine an instance by replacing the security groups
on its ports with an administrative security group named ``quarantine``
and locking it. Project members can no longer change the security groups,
allowed address pairs or port security of a quarantined port.
upgrade:
- |
The Neutron policy server checks now run inside the Neutron API server, and
the ``neutron-policy-server`` sidecar container and its port ``9697`` are
removed. Deployments that override Neutron policy rules with
``http://neutron-server:9697/...`` checks must switch them to the
``address_pair``, ``port_update``, ``port_delete`` or ``quarantine`` checks
before upgrading, otherwise the deployment stops with an error listing the
affected rules.
+19 -20
View File
@@ -155,26 +155,25 @@ _atmosphere_images:
manila_share: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/manila:main@sha256:eacce88247e184467f6bb41002e6137ad4d25ca16f0fd4b7d42f3def17ebac42"
memcached: "{{ atmosphere_image_prefix }}docker.io/library/memcached:1.6.26"
netoffload: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/netoffload:main@sha256:12c59e88398559e915221b84c1a4e95532431cba79a633ed4e287371965b651e"
neutron_bagpipe_bgp: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_bgp_dragent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_bagpipe_bgp: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_bgp_dragent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_coredns: "{{ atmosphere_image_prefix }}docker.io/coredns/coredns:1.11.1"
neutron_db_sync: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_dhcp: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_ironic_agent_init: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_ironic_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_l2gw: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_l3: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_linuxbridge_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_metadata: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_netns_cleanup_cron: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_openvswitch_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_ovn_metadata: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_ovn_vpn: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_server: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_rpc_server: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_sriov_agent_init: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_sriov_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_policy_server: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
neutron_db_sync: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_dhcp: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_ironic_agent_init: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_ironic_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_l2gw: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_l3: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_linuxbridge_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_metadata: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_netns_cleanup_cron: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_openvswitch_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_ovn_metadata: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_ovn_vpn: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_server: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_rpc_server: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_sriov_agent_init: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
neutron_sriov_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
node_feature_discovery: "{{ atmosphere_image_prefix }}registry.k8s.io/nfd/node-feature-discovery:v0.15.4"
nova_api: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/nova:main@sha256:74cb1d03529ec94668b54d739f4984e486a7cbad6385913ab52d4bba9a63cadf"
nova_archive_deleted_rows: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/nova:main@sha256:74cb1d03529ec94668b54d739f4984e486a7cbad6385913ab52d4bba9a63cadf"
@@ -208,7 +207,7 @@ _atmosphere_images:
ovn_bgp_agent: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn-bgp-agent:main@sha256:418a93f5cb947f22d98c719a27ace8b48b43c9298b2f173a96590e01a0c3118e"
ovn_controller: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn:v24.03.7-3@sha256:deb1966eff94d8da072a3647db63546722094deb3ef34b6b464609bcba61887a"
ovn_controller_kubectl: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn:v24.03.7-3@sha256:deb1966eff94d8da072a3647db63546722094deb3ef34b6b464609bcba61887a"
ovn_logging_parser: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:34b1e8abcdfc41cf7f3db921cbd68bce0520f270a7a647264cbeeb602ace9588"
ovn_logging_parser: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/neutron:main@sha256:36c625206243b4c01c1911861b7f7623b1738b83b3c97ef972fff7589ddb8d16"
ovn_northd: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn:v24.03.7-3@sha256:deb1966eff94d8da072a3647db63546722094deb3ef34b6b464609bcba61887a"
ovn_ovsdb_nb: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn:v24.03.7-3@sha256:deb1966eff94d8da072a3647db63546722094deb3ef34b6b464609bcba61887a"
ovn_ovsdb_sb: "{{ atmosphere_image_prefix }}ghcr.io/vexxhost/ovn:v24.03.7-3@sha256:deb1966eff94d8da072a3647db63546722094deb3ef34b6b464609bcba61887a"
+4 -2
View File
@@ -37,8 +37,10 @@ neutron_ingress_annotations: {}
# Enable dns integration
neutron_designate_integration_enabled: false
# Enable neutron policy server to force external
# policy check neutron port and address pairs actions.
# Enable the Neutron policy server checks, which run inside the Neutron API
# server and protect port, address pair and quarantine operations.
#
# neutron_policy_server_integration_enabled: false
neutron_policy_server_integration_enabled: true
# List of SSH keys for generic switch ML2 plugin configuration.
+21
View File
@@ -56,6 +56,27 @@
ansible.builtin.set_fact:
_neutron_helm_values: "{{ _neutron_helm_values | combine(__neutron_generic_switch_keys_helm_values, recursive=True) }}"
- name: Fail if policy overrides still use the removed policy server sidecar
vars:
_neutron_sidecar_policy_rules: >-
{{
(neutron_helm_values.conf | default({})).policy | default({})
| dict2items
| selectattr('value', 'string')
| selectattr('value', 'search', ':9697')
| map(attribute='key')
| list
}}
ansible.builtin.assert:
that:
- _neutron_sidecar_policy_rules | length == 0
fail_msg: >-
The Neutron policy server no longer runs as a sidecar on port 9697. Replace
the http://neutron-server:9697/... checks in these policy rules with the
in-process checks (address_pair, port_update, port_delete or quarantine):
{{ _neutron_sidecar_policy_rules | join(', ') }}
quiet: true
- name: Deploy Helm chart
run_once: true
kubernetes.core.helm:
+8 -6
View File
@@ -25,8 +25,6 @@ __neutron_helm_values:
replicas:
server: 3
rpc_server: 3
sidecars:
neutron_policy_server: true
conf:
neutron:
DEFAULT:
@@ -158,12 +156,16 @@ __neutron_ovn_helm_values:
daemonset_ovn_vpn_agent: true
daemonset_ovs_agent: false
# NOTE: The ``address_pair``, ``port_update``, ``port_delete`` and ``quarantine``
# checks are provided by ``neutron-policy-server``, which is installed in
# the Neutron image and runs inside ``neutron-server``.
__neutron_policy_server_helm_values:
conf:
policy:
delete_port: "((rule:admin_only) or (rule:service_api) or role:member and rule:network_owner or role:member and project_id:%(project_id)s) and http://neutron-server:9697/port-delete"
update_port:mac_address: "((rule:admin_only) or (rule:service_api) or role:manager and project_id:%(project_id)s) and http://neutron-server:9697/port-update"
update_port:fixed_ips: "((rule:admin_only) or (rule:service_api) or role:manager and project_id:%(project_id)s or role:member and rule:network_owner) and http://neutron-server:9697/port-update"
update_port:allowed_address_pairs: "((rule:admin_only) or (role:member and rule:network_owner) or role:manager and project_id:%(project_id)s) or (role:member and project_id:%(project_id)s and http://neutron-server:9697/address-pair )"
delete_port: "((rule:admin_only) or (rule:service_api) or role:member and rule:network_owner or role:member and project_id:%(project_id)s) and port_delete:strict=1"
update_port: "(rule:admin_only) or (rule:service_api) or (role:member and project_id:%(project_id)s and quarantine:security_group=quarantine)"
update_port:mac_address: "((rule:admin_only) or (rule:service_api) or role:manager and project_id:%(project_id)s) and port_update:strict=1"
update_port:fixed_ips: "((rule:admin_only) or (rule:service_api) or role:manager and project_id:%(project_id)s or role:member and rule:network_owner) and port_update:strict=1"
update_port:allowed_address_pairs: "((rule:admin_only) or (role:member and rule:network_owner) or role:manager and project_id:%(project_id)s) or (role:member and project_id:%(project_id)s and address_pair:strict=1)"
update_port:allowed_address_pairs:ip_address: "((rule:admin_only) or (role:member and rule:network_owner) or role:manager and project_id:%(project_id)s) or (role:member and project_id:%(project_id)s)"
update_port:allowed_address_pairs:mac_address: "((rule:admin_only) or (role:member and rule:network_owner) or role:manager and project_id:%(project_id)s) or (role:member and project_id:%(project_id)s)"