瀏覽代碼

checking for access to pid ns

Grega Bremec 2 年之前
父節點
當前提交
c3e3b140cb
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      images/entrypoint-psacct.sh

+ 6 - 0
images/entrypoint-psacct.sh

@@ -12,6 +12,12 @@ if [ -z "$(capsh --decode=$(cat /proc/self/status | grep ^CapEff | cut -f2) | gr
     exit 1
 fi
 
+# Die if running as PID 1 (no access to host PID namespace)
+if [ $$ -eq 1 ]; then
+    echo "FATAL: Need access to host PID namespace, can't seriously be PID 1."
+    exit 1
+fi
+
 # Shutdown handler.
 trap_shutdown() {
     echo "Shutting down..."