6aac43
From 3a0a1774798178f709fc4aa54b6fc3c78e30add7 Mon Sep 17 00:00:00 2001
6aac43
From: Lukas Nykryn <lnykryn@redhat.com>
6aac43
Date: Mon, 19 Jul 2021 11:27:28 +0200
6aac43
Subject: [PATCH] fix(95nfs): set correct ownership and permissions for statd
6aac43
 directory
d1a34d
6aac43
The directory ownership for the statd directory should be
6aac43
rpcuser:rpcuser.
6aac43
6aac43
Resolves: #2017846
d1a34d
---
6aac43
 modules.d/95nfs/module-setup.sh | 9 +++++++--
6aac43
 1 file changed, 7 insertions(+), 2 deletions(-)
d1a34d
6aac43
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
6aac43
index 16bafe30..5351c2d5 100755
6aac43
--- a/modules.d/95nfs/module-setup.sh
6aac43
+++ b/modules.d/95nfs/module-setup.sh
6aac43
@@ -120,8 +120,13 @@ install() {
6aac43
     mkdir -m 0755 -p "$initdir/var/lib/nfs"
6aac43
     mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
6aac43
     mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
6aac43
-    [ -d "/var/lib/nfs/statd/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
6aac43
-    [ -d "/var/lib/nfs/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm"
6aac43
+    [ -d "$dracutsysrootdir/var/lib/nfs/statd/sm" ] \
6aac43
+        && mkdir -m 0700 -p "$initdir/var/lib/nfs/statd" \
6aac43
+        && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" \
6aac43
+        && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/statd"
6aac43
+    [ -d "$dracutsysrootdir/var/lib/nfs/sm" ] \
6aac43
+        && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm" \
6aac43
+        && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/sm"
d1a34d
 
6aac43
     # Rather than copy the passwd file in, just set a user for rpcbind
6aac43
     # We'll save the state and restart the daemon from the root anyway
d1a34d