summaryrefslogtreecommitdiff
path: root/openstack-neutron.configure
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2014-12-03 16:45:38 +0000
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-01-22 12:46:26 +0000
commit9d03381893ff1d301840532623b9d86d7d71e784 (patch)
treeaeaa410a7b212193ea2df700866f71a776f80b04 /openstack-neutron.configure
parent822ce87fcb92f5034a3f52b956741ba2fbeef86b (diff)
downloaddefinitions-9d03381893ff1d301840532623b9d86d7d71e784.tar.gz
WIP: Add openstack neutron configuration extension
Diffstat (limited to 'openstack-neutron.configure')
-rw-r--r--openstack-neutron.configure49
1 files changed, 49 insertions, 0 deletions
diff --git a/openstack-neutron.configure b/openstack-neutron.configure
new file mode 100644
index 00000000..ffd5ed58
--- /dev/null
+++ b/openstack-neutron.configure
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Copyright (C) 2014 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -e
+
+ROOT="$1"
+
+##########################################################################
+# Substitutions in configuration files
+##########################################################################
+
+cat <<EOF > "$ROOT"/etc/openstack-neutron-setup.sed
+s/##NEUTRON_SERVICE_USER##/$NEUTRON_SERVICE_USER/g
+s/##NEUTRON_SERVICE_PASSWORD##/$NEUTRON_SERVICE_PASSWORD/g
+s/##NEUTRON_PUBLIC_URL##/$NEUTRON_PUBLIC_URL/g
+s/##NEUTRON_INTERNAL_URL##/$NEUTRON_INTERNAL_URL/g
+s/##NEUTRON_ADMIN_URL##/$NEUTRON_ADMIN_URL/g
+EOF
+
+sed -f "$ROOT"/etc/openstack-neutron-setup.sed -i \
+ "$ROOT"/etc/nova/neutron.conf \
+ "$ROOT"/usr/share/openstack/openstack-neutron-setup
+
+##########################################################################
+
+ln -sf "/etc/systemd/system/openstack-neutron-setup.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-neutron-setup.service"
+
+##########################################################################
+# Add neutron to sudoers controlling which commands is running as a root
+# using the openstack rootwrap.
+##########################################################################
+install -D -m 0440 /proc/self/fd/0 <<'EOF' "$ROOT"/etc/sudoers.d/neutron-rootwrap
+neutron ALL=(root) NOPASSWD: /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf *
+EOF