mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 13:40:51 +07:00
setrootpw: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
a9a6cdbe26
commit
b6098ac6d2
Binary file not shown.
BIN
setrootpw/all/usr/lib/libcrypto.so.3
Executable file
BIN
setrootpw/all/usr/lib/libcrypto.so.3
Executable file
Binary file not shown.
@ -1,4 +1,10 @@
|
||||
#!/usr/bin/env ash
|
||||
#
|
||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
if [ "${1}" = "late" ]; then
|
||||
echo "Installing addon setrootpw - ${1}"
|
||||
@ -7,6 +13,7 @@ if [ "${1}" = "late" ]; then
|
||||
|
||||
mkdir -p /tmpRoot/usr/lib/openssh
|
||||
cp -vf /usr/lib/openssh/sftp-server /tmpRoot/usr/lib/openssh/sftp-server
|
||||
[ ! -f "/tmpRoot/usr/lib/libcrypto.so.3" ] && cp -vf /usr/lib/libcrypto.so.3 /tmpRoot/usr/lib/libcrypto.so.3
|
||||
|
||||
FILE="/tmpRoot/etc/ssh/sshd_config"
|
||||
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
|
||||
@ -23,21 +30,23 @@ if [ "${1}" = "late" ]; then
|
||||
fi
|
||||
echo "insert setrootpw task to esynoscheduler.db"
|
||||
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
||||
if echo "SELECT * FROM task;" | /tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db | grep -q "SetRootPw||bootup||1|0|0|0||0|"; then
|
||||
echo "SetRootPw task already exists and it is enabled"
|
||||
else
|
||||
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
||||
DELETE FROM task WHERE task_name LIKE 'SetRootPw';
|
||||
INSERT INTO task VALUES('SetRootPw', '', 'bootup', '', 0, 0, 0, 0, '', 0, '
|
||||
PW="" # Please change to the password you need.
|
||||
if [ -n "\${PW}" ]; then
|
||||
/usr/syno/sbin/synouser --setpw root \${PW}
|
||||
systemctl restart sshd
|
||||
[ -n "\${PW}" ] && /usr/syno/sbin/synouser --setpw root \${PW} && systemctl restart sshd
|
||||
synowebapi --exec api=SYNO.Core.Terminal method=set version=3 enable_ssh=true ssh_port=22
|
||||
fi
|
||||
', 'script', '{}', '', '', '{}', '{}');
|
||||
EOF
|
||||
fi
|
||||
elif [ "${1}" = "uninstall" ]; then
|
||||
echo "Installing addon setrootpw - ${1}"
|
||||
|
||||
rm -f /tmpRoot/usr/lib/openssh/sftp-server
|
||||
# rm -f /tmpRoot/usr/lib/libcrypto.so.3
|
||||
|
||||
FILE="/tmpRoot/etc/ssh/sshd_config"
|
||||
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
|
||||
|
Loading…
Reference in New Issue
Block a user