]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Do not run neutron-ns-metadata-proxy as root on dhcp agent
authorCedric Brandily <zzelle@gmail.com>
Wed, 7 Jan 2015 23:12:20 +0000 (23:12 +0000)
committerCedric Brandily <zzelle@gmail.com>
Fri, 20 Feb 2015 21:20:21 +0000 (21:20 +0000)
commitac6cf685176c3a985a71174b9e8f0161068e38e0
treeccd98b8012b89d43815cbd21c78b744215806a65
parent1948efa261e47b08e2cde4828321614ee6e169be
Do not run neutron-ns-metadata-proxy as root on dhcp agent

Currently neutron-ns-metadata-proxy runs with root permissions when
namespaces are enabled on the dhcp agent because root permissions are
required to "enter" in the namespace. But neutron-ns-metadata-proxy
permissions should be reduced as much as possible because it is
reachable from vms.

This change allows to change neutron-ns-metadata-proxy permissions
after its startup through the 2 new options metadata_proxy_user and
metadata_proxy_group which allow to define user/group running metadata
proxy after its initialization. Their default values are
neutron-dhcp-agent effective user and group.

This change delegates metadata proxy management to metadata driver
methods in order to reuse the work already done on l3 agent side.

Permissions drop is done after metadata proxy daemon writes its
pid in its pidfile (it could be disallowed after permissions drop) and
after metadata proxy daemon binds its privileged server port (80).

Using nobody as metadata_proxy_user/group (more secure) is currently
not supported because:

* nobody has not the permission to connect the metadata socket,
* nobody has not the permission to log to file because neutron uses
  WatchedFileHandler (which requires read/write permissions after
  permissions drop).
This limitation will be addressed in a daughter change.

DocImpact
Closes-Bug: #1187107
Change-Id: I53e97254d560e608101010f67bd2dcdec81fb6a2
12 files changed:
etc/dhcp_agent.ini
neutron/agent/dhcp/agent.py
neutron/agent/dhcp/config.py
neutron/agent/dhcp_agent.py
neutron/agent/l3/ha_router.py
neutron/agent/metadata/driver.py
neutron/agent/metadata/namespace_proxy.py
neutron/common/exceptions.py
neutron/tests/unit/agent/metadata/test_driver.py
neutron/tests/unit/test_dhcp_agent.py
neutron/tests/unit/test_l3_agent.py
neutron/tests/unit/test_metadata_namespace_proxy.py