Simple Permission Manager
is used to approve some packages' priviledged commands automatically, some drivers packages and other packages need high permission to execute their actions.
-
Download package from https://github.com/XPEnology-Community/SimplePermissionManager/releases
-
Install
Simple Permission Manager
inPackage Center
- Open
Simple Permission Manager
- From
Package Center
- From
Main Menu
- Click
Active
button
- Type password
- Actived
- Open
Simple Permission Manager
in DSM - Click
Package
in tab - Enable target package by clicking checkbox
- Open
Simple Permission Manager
in DSM - Click
User
in tab - Enable target user by clicking checkbox
Prepare gpg key before the following steps
- Export middle public key
gpg --output public.pgp --export 'Hello World <hello@world.com>'
- Send public key to Jim to sign by root key
gpg --output public.pgp.sig --detach-sign public.pgp
- Save middle public key signature
Save public.pgp
and public.pgp.sig
- Sign by middle key
gpg --output hello-world.sh.gpg.sig --detach-sign hello-world.sh
- Save binary signature
File name: hello-world.sh.sig
{
"version": 1,
"signature": "<base64 format read binary signature>",
"publicKeys": [
{
"publicKey": "<base64 format middle public key>",
"signature": "<base64 format middle public signature>"
}
]
}
file=hello-world.sh
pub_key=$(base64 -w 0 public.pgp)
pub_sig=$(base64 -w 0 public.pgp.sig)
sha256=$(sha256sum $file | awk '{print $1}')
gpg --output "$file".gpg.sig --detach-sign "$file"
sig=$(base64 -w 0 "$file".gpg.sig)
rm -f "$file".gpg.sig
cat << EOF > "$file".sig
{
"version": 1,
"sha256": "${sha256}",
"signature": "${sig}",
"publicKeys": [
{
"publicKey": "${pub_key}",
"signature": "${pub_sig}"
}
]
}
EOF
## check permission first
if [ ! -e /usr/local/bin/spm-exec ]; then
echo "ERROR: /usr/local/bin/spm-exec not found. Please install SimplePermissionManager package and active it."
exit 1
fi
st=$(stat -c "%U %G %a" /usr/local/bin/spm-exec)
if [ ! "$st" = "root root 6755" ]; then
echo "ERROR: /usr/local/bin/spm-exec permission is not ready. Please active SimplePermissionManager."
exit 1
fi
## 1. execute target command
/usr/local/bin/spm-exec /path/to/hello-world.sh
## 2. execute target command and store pid
## if need check status with pid, please ensure parent script is root
## or also call spm-exec to check status,
## like: spm-exec kill -0 $pid, or proxy all script to spm-exec, eg:
## for start-stop-status, we can call spm-exec like this:
## start-stop-status -> spm-exec real-start-stop-status > real-start-stop-status
/usr/local/bin/spm-exec -pid /path/to/pid /path/to/hello-world.sh