File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11NAMESPACE=$( kubectl get stc -A -o jsonpath=' {.items[].metadata.namespace}' )
2- POD=$( kubectl get pods -n $NAMESPACE -l name=portworx -o wide | tail -1 | cut -f 1 -d " " )
2+ [ -z $NAMESPACE ] && echo " Cannot find StorageCluster in any namespace." && exit 1
3+ POD=$( kubectl get pods -n $NAMESPACE --field-selector=status.phase==Running -l name=portworx -o wide -o jsonpath=' {.items[0].metadata.name}' )
4+ [ -z $POD ] && echo " Cannot find a running oci-monitor pod in namespace $NAMESPACE ." && exit 1
35ADMIN_TOKEN=$( kubectl -n $NAMESPACE get secret px-admin-token -o jsonpath=' {.data.auth-token}' 2> /dev/null | base64 -d)
46[ " $ADMIN_TOKEN " ] && kubectl -n $NAMESPACE exec -ti $POD -c portworx -- /opt/pwx/bin/pxctl context create admin --token=$ADMIN_TOKEN
57kubectl -n $NAMESPACE exec -ti $POD -c portworx -- bash -c " /opt/pwx/bin/pxctl $* || true"
Original file line number Diff line number Diff line change 22
33global ttys
44
5- probe kernel.function("pty_write ") {
5+ probe kernel.function("pty_open ") {
66 tty = kernel_string($tty->name)
7- if (tty =~ "^pts" && !ttys[tty] && uid() > 1000 && uid() < 1200) {
8- ttys[tty]=1
9- uid = sprintf("%d", uid() - 1000)
10- system("screen -dmS training".uid.".".tty.".snoop bash -c '(trap \"\" INT; snoop ".tty.")'")
7+ if (tty =~ "^pts" && uid() > 1000 && uid() < 1200 && execname() == "sshd") {
8+ n = substr(tty, 3, 2)
9+ ttys[n]++
10+ if (ttys[n] == 2) {
11+ uid = sprintf("%d", uid() - 1000)
12+ system("screen -dmS training.".tty.".training".uid.".snoop bash -c 'trap \"\" INT; while :; do snoop ".tty."; done'")
13+ }
14+ }
15+ }
16+
17+ probe kernel.function("pty_close") {
18+ tty = kernel_string($tty->name)
19+ if (tty =~ "^ptm" && execname() == "sshd") {
20+ n = substr(tty, 3, 2)
21+ ttys[n]--
22+ if (!ttys[n]) {
23+ system("screen -S training.pts".n.". -X quit")
24+ }
1125 }
1226}
1327
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ tmux new-session -d -s snoop -n main bash -c " trap '' INT; watch screen -ls"
4+
5+ while : ; do
6+ sleep 1
7+ oldscreens=$screens
8+ screens=$( screen -ls | awk ' /training.*snoop/{print$1}' | sort -t . -k 2,2 -k 3,3)
9+ [ " $screens " = " $oldscreens " ] && continue
10+ tmux select-pane -t snoop:0.0
11+ tmux kill-pane -a
12+ for i in $screens ; do
13+ tmux split-window -t " snoop:main" -h " screen -x $i "
14+ tmux select-pane -T $i
15+ tmux select-layout -t " snoop:main" tiled
16+ done
17+ done
Original file line number Diff line number Diff line change 1- #! /usr/bin/env bash
2-
3- tmux new-session -d -s snoop -n main bash -c " watch " who | grep training" "
4-
5- for i in $( screen -ls | awk ' /training.*snoop/{print$1}' | sort -t . -k 2,2 -k 3,3) ; do
6- tmux split-window -t " snoop:main" -h " screen -x $i "
7- tmux select-pane -T $i
8- tmux select-layout -t " snoop:main" tiled
9- done
10-
111tmux attach -t snoop
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ systemctl disable firewalld 2>/dev/null
9696while ! yum update -y glib2; do
9797 sleep 1
9898done
99- while ! dnf install -y at bash-completion nfs-utils chrony unzip ca-certificates netcat net-tools vim-enhanced nano git; do
99+ while ! dnf install -y at bash-completion nfs-utils chrony unzip ca-certificates netcat net-tools vim-enhanced nano git tmux screen ; do
100100 sleep 1
101101done
102102git config --global color.ui auto true
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ rpm -ih https://dl.rockylinux.org/vault/rocky/9.5/devel/x86_64/os/Packages/k/ker
33rpm -ih https://dl.rockylinux.org/vault/rocky/9.5/devel/x86_64/debug/tree/Packages/k/kernel-debuginfo-5.14.0-503.14.1.el9_5.x86_64.rpm https://dl.rockylinux.org/vault/rocky/9.5/devel/x86_64/os/Packages/k/kernel-debuginfo-common-x86_64-5.14.0-503.14.1.el9_5.x86_64.rpm https://dl.rockylinux.org/vault/rocky/9.5/devel/x86_64/os/Packages/k/kernel-headers-5.14.0-503.14.1.el9_5.x86_64.rpm
44dnf install -y systemtap
55
6- install -m 700 /assets/ttysnoop/snoop /assets/ttysnoop/snoopall /assets/ttysnoop/_snoop /usr/sbin
6+ install -m 700 /assets/ttysnoop/snoop /assets/ttysnoop/snoopall /assets/ttysnoop/_snoop /assets/ttysnoop/_snoopall / usr/sbin
77
88snoop test &
99while [ ! -d /proc/systemtap ]; do
@@ -12,5 +12,9 @@ while [ ! -d /proc/systemtap ]; do
1212done
1313kill %1
1414
15- echo "@reboot nohup /usr/sbin/_snoop &" | crontab -
16- nohup /usr/sbin/_snoop &
15+ cat <<EOF | crontab -
16+ @reboot nohup /usr/sbin/_snoop &
17+ @reboot nohup /usr/sbin/_snoopall &
18+ EOF
19+ nohup /usr/sbin/_snoop &
20+ nohup /usr/sbin/_snoopall &
You can’t perform that action at this time.
0 commit comments