You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2018/10/18 15:25:19 UTC

[couchdb-docker] 03/03: Chmod config files only if necessary

This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch streamline-ownership-and-permissions
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git

commit 7727325ac3553d15335b0a246a913a659fabe8b9
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Thu Oct 18 11:16:22 2018 -0400

    Chmod config files only if necessary
    
    This patch also drops the target permissions from 775/664 to 755/644,
    as the latter permissions are the ones set by the CouchDB installation
    itself.
---
 2.2.0/docker-entrypoint.sh | 8 ++++++--
 dev/docker-entrypoint.sh   | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/2.2.0/docker-entrypoint.sh b/2.2.0/docker-entrypoint.sh
index 5874bdf..2fff0ed 100755
--- a/2.2.0/docker-entrypoint.sh
+++ b/2.2.0/docker-entrypoint.sh
@@ -37,8 +37,12 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
 	find /opt/couchdb/data -type d ! -perm 0755 -exec chmod 0755 '{}' +
 	find /opt/couchdb/data -type f ! -perm 0644 -exec chmod 0644 '{}' +
 
-        find /opt/couchdb/etc -name \*.ini -exec chmod -f 664 {} \;
-	chmod -f 775 /opt/couchdb/etc/*.d || true
+	# Do the same thing for configuration files and directories. Technically
+	# CouchDB only needs read access to the configuration files as all online
+	# changes will be applied to the "docker.ini" file below, but we set 644
+	# for the sake of consistency
+	find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod 0755 '{}' +
+	find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod 0644 '{}' +
 
 	if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
 		echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args
diff --git a/dev/docker-entrypoint.sh b/dev/docker-entrypoint.sh
index 5874bdf..2fff0ed 100755
--- a/dev/docker-entrypoint.sh
+++ b/dev/docker-entrypoint.sh
@@ -37,8 +37,12 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
 	find /opt/couchdb/data -type d ! -perm 0755 -exec chmod 0755 '{}' +
 	find /opt/couchdb/data -type f ! -perm 0644 -exec chmod 0644 '{}' +
 
-        find /opt/couchdb/etc -name \*.ini -exec chmod -f 664 {} \;
-	chmod -f 775 /opt/couchdb/etc/*.d || true
+	# Do the same thing for configuration files and directories. Technically
+	# CouchDB only needs read access to the configuration files as all online
+	# changes will be applied to the "docker.ini" file below, but we set 644
+	# for the sake of consistency
+	find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod 0755 '{}' +
+	find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod 0644 '{}' +
 
 	if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
 		echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args