Skip to content

Commit 3e7874e

Browse files
committed
fix: do not exit on failure of setcap on Telegraf
The Telegraf container entrypoints attempt to use setcap to add additional capabilites to the telegraf binary. Users who use aufs or run a kernel that does not allow the setcap option will fail to start the telegraf container as-is. This allows users to continue to use Telegraf, but instead print an error message that setcap failed. Resolves: #561
1 parent a640cf9 commit 3e7874e

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

telegraf/1.19/alpine/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ "$(id -u)" -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec su-exec telegraf "$@"
1515
fi

telegraf/1.19/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ $EUID -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec setpriv --reuid telegraf --init-groups "$@"
1515
fi

telegraf/1.20/alpine/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ "$(id -u)" -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec su-exec telegraf "$@"
1515
fi

telegraf/1.20/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ $EUID -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec setpriv --reuid telegraf --init-groups "$@"
1515
fi

telegraf/1.21/alpine/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ "$(id -u)" -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec su-exec telegraf "$@"
1515
fi

telegraf/1.21/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ $EUID -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec setpriv --reuid telegraf --init-groups "$@"
1515
fi

telegraf/nightly/alpine/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ "$(id -u)" -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec su-exec telegraf "$@"
1515
fi

telegraf/nightly/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ $EUID -ne 0 ]; then
99
exec "$@"
1010
else
1111
# Allow telegraf to send ICMP packets and bind to privliged ports
12-
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf
12+
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
1313

1414
exec setpriv --reuid telegraf --init-groups "$@"
1515
fi

0 commit comments

Comments
 (0)