From e52698ea16fc93cfa1a7e0629e80bc98aa87ee4b Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 29 Jan 2020 15:35:10 +0300 Subject: [PATCH] update backend debug script --- debug-backend.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/debug-backend.sh b/debug-backend.sh index 7f67ad7..5d8b1c7 100755 --- a/debug-backend.sh +++ b/debug-backend.sh @@ -7,10 +7,16 @@ fi PORT="${2:-3222}" PLUGIN_NAME="${1:-zabbix-plugin_}" -ptrace_scope=`cat /proc/sys/kernel/yama/ptrace_scope` -if [ "$ptrace_scope" != 0 ]; then - echo "WARNING: ptrace_scope set to value other than 0, this might prevent debugger from connecting, try writing \"0\" to /proc/sys/kernel/yama/ptrace_scope. +if [ "$OSTYPE" == "linux-gnu" ]; then + ptrace_scope=`cat /proc/sys/kernel/yama/ptrace_scope` + if [ "$ptrace_scope" != 0 ]; then + echo "WARNING: ptrace_scope set to value other than 0, this might prevent debugger from connecting, try writing \"0\" to /proc/sys/kernel/yama/ptrace_scope. Read more at https://www.kernel.org/doc/Documentation/security/Yama.txt" + read -p "Set ptrace_scope to 0? y/N (default N)" set_ptrace_input + if [ "$set_ptrace_input" == "y" ] || [ "$set_ptrace_input" == "Y" ]; then + echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + fi + fi fi PLUGIN_PID=`pgrep ${PLUGIN_NAME}`