fix: set correct permissions on sudoers files
RHEL validates 0600, while Debian systems expect 0440.
This commit is contained in:
1 parent
860f4f458c
commit
2e1df2578c
2 files changed
+7
-3
No files matched your search
@@ -24,6 +24,7 @@ trigger-nginx-vhosts-install() {
|
|||||||
NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-openresty"
|
NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-openresty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local mode="0440"
|
||||||
case "$DOKKU_DISTRO" in
|
case "$DOKKU_DISTRO" in
|
||||||
debian | raspbian)
|
debian | raspbian)
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||||
@@ -48,10 +49,11 @@ trigger-nginx-vhosts-install() {
|
|||||||
centos | fedora | rhel)
|
centos | fedora | rhel)
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||||
echo "Defaults:dokku !requiretty" >>"$NGINX_SUDOERS_FILE"
|
echo "Defaults:dokku !requiretty" >>"$NGINX_SUDOERS_FILE"
|
||||||
|
mode="0600"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
chmod 0440 "$NGINX_SUDOERS_FILE"
|
chmod "$mode" "$NGINX_SUDOERS_FILE"
|
||||||
|
|
||||||
# if dhparam.pem has not been created, create it the first time
|
# if dhparam.pem has not been created, create it the first time
|
||||||
if [[ ! -f "$NGINX_ROOT/dhparam.pem" ]]; then
|
if [[ ! -f "$NGINX_ROOT/dhparam.pem" ]]; then
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ trigger-storage-install() {
|
|||||||
chown dokku:dokku "${storage_directory}"
|
chown dokku:dokku "${storage_directory}"
|
||||||
|
|
||||||
STORAGE_SUDOERS_FILE="/etc/sudoers.d/dokku-storage"
|
STORAGE_SUDOERS_FILE="/etc/sudoers.d/dokku-storage"
|
||||||
|
local mode="0440"
|
||||||
case "$DOKKU_DISTRO" in
|
case "$DOKKU_DISTRO" in
|
||||||
arch | debian | opensuse | raspbian | ubuntu)
|
arch | debian | opensuse | raspbian | ubuntu)
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
||||||
@@ -21,9 +21,11 @@ trigger-storage-install() {
|
|||||||
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
||||||
echo "Defaults:dokku !requiretty" >>"$STORAGE_SUDOERS_FILE"
|
echo "Defaults:dokku !requiretty" >>"$STORAGE_SUDOERS_FILE"
|
||||||
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
|
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
|
||||||
|
mode="0600"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
chmod "$mode" "$STORAGE_SUDOERS_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger-storage-install "$@"
|
trigger-storage-install "$@"
|
||||||
Reference in new issue
Block a user