laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36867?usp=email )
Change subject: ttcn3-tcpdump-start.sh: Avoid using dumpcap if it has no access to pcap parent dir
......................................................................
ttcn3-tcpdump-start.sh: Avoid using dumpcap if it has no access to pcap parent dir
dumpcap seems to be opening the pcap file it writes to *after* dropping
privileges, which means even if running it as root, it will fail to
create the pcap file inside a directory where that same user (even if
root) doesn't have write+execute permissions.
This is exactly what happens when one tries to run the
ttcn3-tcmpdump-start.sh script inside docker with "--cap-add=NET_ADMIN
--cap-add=SYS_RESOURCE" and root user, where it then tells dumpcap to
write to a volume mounted inside docker which was created by the user
outside user, hence with UID=1000 instead of UID=0 inside docker.
Since tcpdump works fine in this setup, simply skip using dumpcap if it
would fail to create the pcap file.
Related: OS#6455
Change-Id: If8ea5bb62f4866042761d3e08fe83179bf10c75a
---
M ttcn3-tcpdump-start.sh
1 file changed, 30 insertions(+), 1 deletion(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh
index 8b75d0e..4068b26 100755
--- a/ttcn3-tcpdump-start.sh
+++ b/ttcn3-tcpdump-start.sh
@@ -62,7 +62,12 @@
fi
if [ -u $DUMPCAP -o "$CAP_ERR" = "0" ]; then
- CMD="$DUMPCAP -q"
+ # dumpcap, *after dropping permissions*, needs to be able to write to the directory to create the pcap file:
+ if [ "$(stat -L -c "%u" "$TTCN3_PCAP_PATH")" = "$(id -u)" ] && [ "$(stat -L -c "%A" "$TTCN3_PCAP_PATH" | head -c 4)" = "drwx" ]; then
+ CMD="$DUMPCAP -q"
+ else
+ echo "NOTE: unable to use dumpcap due to missing permissions in $TTCN3_PCAP_PATH"
+ fi
else
echo "NOTE: unable to use dumpcap due to missing capabilities or suid bit"
fi
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36867?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If8ea5bb62f4866042761d3e08fe83179bf10c75a
Gerrit-Change-Number: 36867
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria, pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36870?usp=email )
Change subject: asterisk: Delay test start until FullyBooted event is received in AMI
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36870?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I65f56bcee332f4ae9ffc71ad7119c378ca1649dc
Gerrit-Change-Number: 36870
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 May 2024 09:03:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Hoernchen, pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36867?usp=email )
Change subject: ttcn3-tcpdump-start.sh: Avoid using dumpcap if it has no access to pcap parent dir
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36867?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If8ea5bb62f4866042761d3e08fe83179bf10c75a
Gerrit-Change-Number: 36867
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 May 2024 09:03:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36866?usp=email )
Change subject: ttcn3-tcpdump-start.sh: Log command used to record packets
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36866?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8bebe53e630ba43e368700dc857b0e00d3cc7c56
Gerrit-Change-Number: 36866
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 May 2024 09:02:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment