Skip to content

Commit 3df8bba

Browse files
authored
Ensure proper ownership of NSS wrapper directory
This case can occur on vanilla Kubernetes clusters when there are multiple sidecars in a Pod.
1 parent e3a4a13 commit 3df8bba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bin/common/nss_wrapper.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ CRUNCHY_DIR=${CRUNCHY_DIR:-'/opt/crunchy'}
2121
# Define nss_wrapper directory and passwd & group files that will be utilized by nss_wrapper. The
2222
# nss_wrapper_env.sh script (which also sets these vars) isn't sourced here since the nss_wrapper
2323
# has not yet been setup, and we therefore don't yet want the nss_wrapper vars in the environment.
24+
mkdir /tmp/nss_wrapper
25+
chmod g+rwx /tmp/nss_wrapper
26+
2427
NSS_WRAPPER_DIR="/tmp/nss_wrapper/${NSS_WRAPPER_SUBDIR}"
2528
NSS_WRAPPER_PASSWD="${NSS_WRAPPER_DIR}/passwd"
2629
NSS_WRAPPER_GROUP="${NSS_WRAPPER_DIR}/group"
@@ -49,7 +52,7 @@ if [[ ! $(cat "${NSS_WRAPPER_PASSWD}") =~ ${CRUNCHY_NSS_USERNAME}:x:${USER_ID} ]
4952
rm "${passwd_tmp}"
5053
else
5154
echo "nss_wrapper: user exists"
52-
fi
55+
fi
5356

5457
# if the username (which will be the same as the group name) is missing from group file, then add it
5558
if [[ ! $(cat "${NSS_WRAPPER_GROUP}") =~ ${CRUNCHY_NSS_USERNAME}:x:${USER_ID} ]]; then

0 commit comments

Comments
 (0)