]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Allow metadata proxy running with nobody user/group
authorCedric Brandily <zzelle@gmail.com>
Tue, 17 Mar 2015 15:20:07 +0000 (15:20 +0000)
committerCedric Brandily <zzelle@gmail.com>
Mon, 6 Apr 2015 16:31:37 +0000 (18:31 +0200)
commit80bea7a38670620934faafd5f583fe6164b9f9b3
tree6a5363f5ff4d2c8ce317595d2f5f4c6ff2a7761e
parentaa943f930d2d6e13c652917bac36c51abcaf4696
Allow metadata proxy running with nobody user/group

Currently metadata proxy cannot run with nobody user/group as metadata
proxy requires to connect to metadata_proxy_socket when queried.

This change allows to run metadata proxy with nobody user/group by
allowing to choose the metadata_proxy_socket mode with the new option
metadata_proxy_socket_mode (4 choices) in order to adapt socket
permissions to metadata proxy user/group.

This change refactors also where options are defined to enable
metadata_proxy_user/group options in the metadata agent.

In practice:
* if metadata_proxy_user is agent effective user or root, then:
  * metadata proxy is allowed to use rootwrap (unsecure)
  * set metadata_proxy_socket_mode = user (0o644)
* else if metadata_proxy_group is agent effective group, then:
  * metadata proxy is not allowed to use rootwrap (secure)
  * set metadata_proxy_socket_mode = group (0o664)
  * set metadata_proxy_log_watch = false
* else:
  * metadata proxy has lowest permissions (securest) but metadata proxy
    socket can be opened by everyone
  * set metadata_proxy_socket_mode = all (0o666)
  * set metadata_proxy_log_watch = false

An alternative is to set metadata_proxy_socket_mode = deduce, in such
case metadata agent uses previous rules to choose the correct mode.

DocImpact
Closes-Bug: #1427228
Change-Id: I235a0cc4f0cbd55ae4ec1570daf2ebbb6a72441d
13 files changed:
etc/metadata_agent.ini
neutron/agent/dhcp_agent.py
neutron/agent/l3_agent.py
neutron/agent/linux/utils.py
neutron/agent/metadata/agent.py
neutron/agent/metadata/config.py
neutron/agent/metadata/driver.py
neutron/agent/metadata_agent.py
neutron/tests/functional/agent/linux/helpers.py
neutron/tests/functional/agent/test_l3_agent.py
neutron/tests/unit/agent/linux/test_utils.py
neutron/tests/unit/agent/metadata/test_driver.py
neutron/tests/unit/test_metadata_agent.py