Skip to content

Commit 782c4c9

Browse files
committed
Fix required root rights for entrypoint
1 parent 0f77289 commit 782c4c9

File tree

60 files changed

+180
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+180
-132
lines changed

docker/base/alpine-3/conf/bin/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
1313

1414
source /opt/docker/bin/config.sh
1515

16-
rootCheck
16+
rootCheck "$0"
1717

1818
# Save the buildtime
1919
date +%s > /opt/docker/BUILDTIME

docker/base/alpine-3/conf/bin/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PROVISION_REGISTRY_PATH="/opt/docker/etc/.registry"
1212
function rootCheck() {
1313
# Root check
1414
if [ "$(/usr/bin/whoami)" != "root" ]; then
15-
echo "[ERROR] Must be run as root"
15+
echo "[ERROR] $* must be run as root"
1616
exit 1
1717
fi
1818
}

docker/base/alpine-3/conf/bin/control.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
77

88
source /opt/docker/bin/config.sh
99

10-
rootCheck
10+
rootCheck "$0"
1111

1212
CONTROL_COMMAND="$1"
1313
shift

docker/base/alpine-3/conf/bin/entrypoint.d/supervisord.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
## Supervisord (start daemons)
55
#############################################
66

7+
rootCheck "supervisord"
8+
79
## Start services
810
exec /opt/docker/bin/service.d/supervisor.sh
911

docker/base/alpine-3/conf/bin/entrypoint.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ TASK="$(echo $1| sed 's/[^-_a-zA-Z0-9]*//g')"
1313

1414
source /opt/docker/bin/config.sh
1515

16-
rootCheck
17-
18-
if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
19-
# Visible provisioning
20-
runProvisionEntrypoint
21-
else
22-
# Hidden provisioning
23-
runProvisionEntrypoint > /dev/null
16+
if [ "$(/usr/bin/whoami)" == "root" ]; then
17+
# Only run provision if user is root
18+
19+
if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
20+
# Visible provisioning
21+
runProvisionEntrypoint
22+
else
23+
# Hidden provisioning
24+
runProvisionEntrypoint > /dev/null
25+
fi
2426
fi
2527

2628
#############################

docker/base/centos-7/conf/bin/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
1313

1414
source /opt/docker/bin/config.sh
1515

16-
rootCheck
16+
rootCheck "$0"
1717

1818
# Save the buildtime
1919
date +%s > /opt/docker/BUILDTIME

docker/base/centos-7/conf/bin/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PROVISION_REGISTRY_PATH="/opt/docker/etc/.registry"
1212
function rootCheck() {
1313
# Root check
1414
if [ "$(/usr/bin/whoami)" != "root" ]; then
15-
echo "[ERROR] Must be run as root"
15+
echo "[ERROR] $* must be run as root"
1616
exit 1
1717
fi
1818
}

docker/base/centos-7/conf/bin/control.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
77

88
source /opt/docker/bin/config.sh
99

10-
rootCheck
10+
rootCheck "$0"
1111

1212
CONTROL_COMMAND="$1"
1313
shift

docker/base/centos-7/conf/bin/entrypoint.d/supervisord.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
## Supervisord (start daemons)
55
#############################################
66

7+
rootCheck "supervisord"
8+
79
## Start services
810
exec /opt/docker/bin/service.d/supervisor.sh
911

docker/base/centos-7/conf/bin/entrypoint.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ TASK="$(echo $1| sed 's/[^-_a-zA-Z0-9]*//g')"
1313

1414
source /opt/docker/bin/config.sh
1515

16-
rootCheck
17-
18-
if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
19-
# Visible provisioning
20-
runProvisionEntrypoint
21-
else
22-
# Hidden provisioning
23-
runProvisionEntrypoint > /dev/null
16+
if [ "$(/usr/bin/whoami)" == "root" ]; then
17+
# Only run provision if user is root
18+
19+
if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
20+
# Visible provisioning
21+
runProvisionEntrypoint
22+
else
23+
# Hidden provisioning
24+
runProvisionEntrypoint > /dev/null
25+
fi
2426
fi
2527

2628
#############################

0 commit comments

Comments
 (0)