Skip to content

Commit

Permalink
Check ptrace_scope procfile before proceeding
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Engelbert <[email protected]>
  • Loading branch information
pmengelbert committed Jan 8, 2025
1 parent 3ad3a1a commit 6f4ea48
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions debug/debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eux

PTRACE_SCOPE_PROCFILE="/proc/sys/kernel/yama/ptrace_scope"

if [ -z "$(command -v socat)" ]; then
echo you must have "'socat'" installed
exit 1
Expand All @@ -11,6 +13,16 @@ if [ -z "$(command -v pgrep)" ]; then
exit 1
fi

if ! [ -f "$PTRACE_SCOPE_PROCFILE" ]; then
echo "unable to detect necessary procfile, attempting to continue..."
fi

if [ "$(<"$PTRACE_SCOPE_PROCFILE")" != "0" ]; then
echo "you must set ${PTRACE_SCOPE_PROCFILE} to '0':"
echo "echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope"
exit 1
fi

PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${PROJECT_DIR}"

Expand Down

0 comments on commit 6f4ea48

Please sign in to comment.