From 87d1187bd1b0bd05210e4b6a80bb5652b4edbbbc Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 17 Apr 2017 21:56:25 -0400 Subject: [PATCH] More sudoers permission check to install.d Because we also check sudoers files in our zuul-worker element, we need to make sure our permissions are set in install.d not postinstall.d. This was also not an issue locally, since our puppet master seems to chmod 0755 our elements directory on nodepool-builders. Change-Id: Ibcfd2741263889ef2dce8e04237537a6d83de301 Signed-off-by: Paul Belanger --- .../nodepool-base/install.d/59-sudoers | 26 +++++++++++++++++++ .../post-install.d/89-jenkins-scripts | 4 --- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 nodepool/elements/nodepool-base/install.d/59-sudoers diff --git a/nodepool/elements/nodepool-base/install.d/59-sudoers b/nodepool/elements/nodepool-base/install.d/59-sudoers new file mode 100755 index 0000000000..8b0d57d43c --- /dev/null +++ b/nodepool/elements/nodepool-base/install.d/59-sudoers @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2017 Red Hat, Inc. +# +# 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. + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# Make sure our sudoers files have the proper permissions. +chmod 0440 /etc/sudoers.d/jenkins-sudo +chmod 0440 /etc/sudoers.d/jenkins-sudo-grep diff --git a/nodepool/elements/nodepool-base/post-install.d/89-jenkins-scripts b/nodepool/elements/nodepool-base/post-install.d/89-jenkins-scripts index a81028d542..4e36080399 100755 --- a/nodepool/elements/nodepool-base/post-install.d/89-jenkins-scripts +++ b/nodepool/elements/nodepool-base/post-install.d/89-jenkins-scripts @@ -29,7 +29,3 @@ cp -a /opt/git/openstack-infra/project-config/jenkins/data \ /usr/local/jenkins/common_data cp -a /opt/git/openstack-infra/project-config/jenkins/scripts \ /usr/local/jenkins/slave_scripts - -# Make sure our sudoers files have the proper permissions. -chmod 0440 /etc/sudoers.d/jenkins-sudo -chmod 0440 /etc/sudoers.d/jenkins-sudo-grep