pespin has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/36836?usp=email )
Change subject: ttcn3-docker-run.sh: Fix dumpcap failing to access /data inside docker
......................................................................
ttcn3-docker-run.sh: Fix dumpcap failing to access /data inside docker
In docker, the /data dir is mapped to $VOL_BASE_DIR, which is created by
docker-playground.git jenkins-common.sh, hence as the user running
jenkins.sh in the host system.
As a result, when the dir is mapped to /data, inside the container it
will have the UID:GID of the outter user, not the one inside docker.
Before this patch, if a ttcn3 container was started in jenkins.sh with
--cap-add=NET_ADMIN, then osmo-ttcn3-hacks.git/ttcn3-tcpdump-start.sh
would select dumpcap instead of tcpdump, to attempt to record a pcap
file to /data/$testcase.pcap.
Due to some unknown way of dropping privileges done by dumpcap though,
it was unable to open the /data/$testcase.pcap due to /data being owned
to another user (tcpdump doesn't have this problem).
This patch fixes the above scenario by making sure /data is chowned to
the user running stuff inside docker. This is already kinda expected
since there's a fix_perms() script in jenkins-common.sh reverting files
created during the test so that they can be accessible by outter user
once everything is finished.
Change-Id: I1229a91cdbb1aa73fd94f1bf7e26f34086f06b25
---
M common/ttcn3-docker-run.sh
1 file changed, 32 insertions(+), 0 deletions(-)
Approvals:
pespin: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/common/ttcn3-docker-run.sh b/common/ttcn3-docker-run.sh
index c8c871e..60339c4 100755
--- a/common/ttcn3-docker-run.sh
+++ b/common/ttcn3-docker-run.sh
@@ -31,6 +31,9 @@
done
fi
+# Make sure /data is owned to the user running inside docker.
+# jenkins-commons.sh fix_perms() will fix back the permissions once done.
+chown -R "$(id -u):$(id -g)" /data
cd /data
# Use TEST_NAME to only run one test instead of all. Set it like this:
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/36836?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I1229a91cdbb1aa73fd94f1bf7e26f34086f06b25
Gerrit-Change-Number: 36836
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-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: lynxis lazus, msuraev.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/29412?usp=email )
Change subject: contrib/systemd: run as osmocom user
......................................................................
Patch Set 16:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/29412?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I915f2fc12d0bd905d24636aacb2760a6b72a55e3
Gerrit-Change-Number: 29412
Gerrit-PatchSet: 16
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Thu, 16 May 2024 08:20:17 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/36841?usp=email )
Change subject: doc: set state-dir to /var/lib/osmocom/osmo-ggsn
......................................................................
doc: set state-dir to /var/lib/osmocom/osmo-ggsn
Prepare to run osmo-ggsn as user with the systemd service. As with other
Osmocom service files, we will set StateDirectory= and WorkingDirectory=
options. This results in osmo-ggsn only being able to write to
/var/lib/osmocom, therefore let's change the state-dir from /tmp to
/var/lib/osmocom/osmo-ggsn to avoid:
gsn.c:411 fopen(path=/tmp/gsn_restart, mode=w) failed: Error = Permission denied
Having the state in /var/lib/osmocom also makes more sense, because then
it doesn't get deleted on reboot.
Change-Id: I5b51529b4f8bd2462e54f58a1ce2e2d7c76ff46a
---
M doc/examples/osmo-ggsn-kernel-gtp.cfg
M doc/examples/osmo-ggsn.cfg
M doc/manuals/chapters/configuration.adoc
3 files changed, 24 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/41/36841/1
diff --git a/doc/examples/osmo-ggsn-kernel-gtp.cfg b/doc/examples/osmo-ggsn-kernel-gtp.cfg
index 28eb207..12da4f8 100644
--- a/doc/examples/osmo-ggsn-kernel-gtp.cfg
+++ b/doc/examples/osmo-ggsn-kernel-gtp.cfg
@@ -36,7 +36,7 @@
no login
!
ggsn ggsn0
- gtp state-dir /tmp
+ gtp state-dir /var/lib/osmocom/osmo-ggsn
gtp bind-ip 127.0.0.2
apn internet
gtpu-mode kernel-gtp
diff --git a/doc/examples/osmo-ggsn.cfg b/doc/examples/osmo-ggsn.cfg
index 02523e9..76fa257 100644
--- a/doc/examples/osmo-ggsn.cfg
+++ b/doc/examples/osmo-ggsn.cfg
@@ -36,7 +36,7 @@
no login
!
ggsn ggsn0
- gtp state-dir /tmp
+ gtp state-dir /var/lib/osmocom/osmo-ggsn
gtp bind-ip 127.0.0.2
apn internet
gtpu-mode tun
diff --git a/doc/manuals/chapters/configuration.adoc b/doc/manuals/chapters/configuration.adoc
index 5314d10..f0889d3 100644
--- a/doc/manuals/chapters/configuration.adoc
+++ b/doc/manuals/chapters/configuration.adoc
@@ -16,7 +16,7 @@
.Example: Single GGSN configuration section
----
ggsn ggsn0
- gtp state-dir /tmp
+ gtp state-dir /var/lib/osmocom/osmo-ggsn
gtp bind-ip 127.0.0.6
apn internet
gtpu-mode tun
@@ -58,7 +58,7 @@
for every GGSN instance:
----
-OsmoGGSN(config-ggsn)# gtp state-dir /var/lib/ggsn/ggsn0 <1>
+OsmoGGSN(config-ggsn)# gtp state-dir /var/lib/osmocom/osmo-ggsn <1>
OsmoGGSN(config-ggsn)# gtp bind-ip 127.0.0.6 <2>
----
<1> Store the GSN restart state in the specified directory
--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/36841?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I5b51529b4f8bd2462e54f58a1ce2e2d7c76ff46a
Gerrit-Change-Number: 36841
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange