Skip to content

Instantly share code, notes, and snippets.

@cloverstd
Last active August 30, 2024 01:47
Show Gist options
  • Save cloverstd/1f5a93ee11456aeae34b4be6fab9ad96 to your computer and use it in GitHub Desktop.
Save cloverstd/1f5a93ee11456aeae34b4be6fab9ad96 to your computer and use it in GitHub Desktop.
#!/bin/sh
apt update && apt install -y curl sudo dnsutils ufw
adduser --gecos "" --disabled-password cloverstd
usermod -aG sudo cloverstd
echo "cloverstd ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/90-cloverstd
runuser -u cloverstd -- bash -c "mkdir -p ~/.ssh && curl https://github.com/cloverstd.keys | tee -a ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys && chmod 0700 ~/.ssh"
sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
systemctl reload ssh
ufw allow 22/tcp
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
curl -sf https://get.docker.com | sh -
usermod -aG docker cloverstd
curl https://github.com/nxtrace/NTrace-core/releases/download/v1.3.2/nexttrace_linux_amd64 -L -s -o /usr/local/bin/nexttrace
chmod +x /usr/local/bin/nexttrace
sudo setcap cap_net_raw,cap_net_admin+eip /usr/local/bin/nexttrace
#!/bin/sh
apt update && apt install -y curl sudo dnsutils ufw
adduser --gecos "" cloverstd
usermod -aG sudo cloverstd
echo "cloverstd ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/90-cloverstd
runuser -u cloverstd -- bash -c "ssh-import-id-lp cloverstd && ssh-import-id-gh cloverstd"
sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
systemctl reload ssh
ufw allow 22/tcp
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p && \
curl -sf https://get.docker.com | sh -
usermod -aG docker cloverstd
curl https://github.com/nxtrace/NTrace-core/releases/download/v1.3.2/nexttrace_linux_amd64 -L -s -o /usr/local/bin/nexttrace
chmod +x /usr/local/bin/nexttrace
sudo setcap cap_net_raw,cap_net_admin+eip /usr/local/bin/nexttrace
@cloverstd
Copy link
Author

cloverstd commented Apr 21, 2024

Ubuntu

wget https://gist.github.com/cloverstd/1f5a93ee11456aeae34b4be6fab9ad96/raw/f7252dccc7b241dc47ceb91c4cb477a977a12e6b/ubuntu_init.sh -O /tmp/init.sh && bash /tmp/init.sh

Debian

wget https://gist.github.com/cloverstd/1f5a93ee11456aeae34b4be6fab9ad96/raw/f7252dccc7b241dc47ceb91c4cb477a977a12e6b/debian_init.sh -O /tmp/init.sh && bash /tmp/init.sh

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