Skip to content

Commit 4c7ee28

Browse files
committed
Fix aesmd service permission in linksgx.sh.
This commit ensures that no matter what the order of package installation is, aesmd can have access to the sgx_provision device file. Signed-off-by: yuguorui <yuguorui@pku.edu.cn>
1 parent 5178e0c commit 4c7ee28

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

linux/installer/common/sgx-aesm-service/linksgx.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,21 @@ if test $(id -u) -ne 0; then
3535
exit 1
3636
fi
3737

38-
/usr/bin/getent group sgx_prv &> /dev/null
39-
if [ $? == "0" ]; then
40-
/usr/sbin/usermod -aG sgx_prv aesmd &> /dev/null
38+
if [ -c /dev/sgx_provision -o -c /dev/sgx/provision ]; then
39+
getent group sgx_prv &> /dev/null
40+
if [ "$?" != "0" ]; then
41+
# Add sgx_prv for dcap driver, which ensures that no matter what
42+
# the order of package installation, aesmd can have access to
43+
# the sgx_provision device file.
44+
groupadd sgx_prv
45+
46+
if ! which udevadm &> /dev/null; then
47+
exit 0
48+
fi
49+
udevadm control --reload || :
50+
udevadm trigger || :
51+
fi
52+
usermod -aG sgx_prv aesmd &> /dev/null
4153
fi
4254

4355
echo

0 commit comments

Comments
 (0)