Last active
November 27, 2023 22:11
-
-
Save lukaszlach/c0fdb7a728cdea632db1aebbbff3f6d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# curl -sSfL https://gist.githubusercontent.com/lukaszlach/c0fdb7a728cdea632db1aebbbff3f6d6/raw/gcp-uw.sh | bash | |
# SSHd | |
sed -i "s/.*PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config | |
sed -i "s/.*Port.*/Port 6667/g" /etc/ssh/sshd_config | |
echo 'Port 80' >> /etc/ssh/sshd_config | |
sed -i "s/.*ClientAliveInterval.*/ClientAliveInterval 45/g" /etc/ssh/sshd_config | |
sed -i "s/.*ClientAliveCountMax.*/ClientAliveCountMax 3/g" /etc/ssh/sshd_config | |
#echo 'ServerAliveInterval 15' >> /etc/ssh/sshd_config | |
#echo 'ServerAliveCountMax 3' >> /etc/ssh/sshd_config | |
service sshd restart | |
apt-get install -y figlet | |
figlet "docker" > /etc/motd | |
apt-get remove -y figlet | |
cat >> /etc/motd <<banner | |
Docker Extensive Workshop | |
Łukasz Lach <[email protected]> | |
https://lach.dev/orca | |
banner | |
# Register in DNS | |
curl -sSfL d.cmd.cat:30080/dns -H "VPS-IP: $(curl -sSf ipinfo.io/ip)" | |
# Docker / Workshop | |
curl -sSfL get.docker.com | bash | |
curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
apt-get install -y bash bash-completion curl wget make jq net-tools procps htop vim git fail2ban socat | |
curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker \ | |
-o /etc/bash_completion.d/docker.sh | |
wget https://github.com/sharkdp/bat/releases/download/v0.17.1/bat_0.17.1_amd64.deb | |
dpkg -i bat_0.17.1_amd64.deb | |
rm -f bat_0.17.1_amd64.deb | |
# cntr | |
wget 'https://github.com/Mic92/cntr/releases/download/1.2.0/cntr-bin-1.2.0-x86_64-unknown-linux-musl' -O /usr/bin/cntr | |
chmod +x /usr/bin/cntr | |
# Workshop user | |
D_UID=12345 | |
D_GID=12345 | |
groupadd -g "$D_GID" d | |
useradd -m -u "$D_UID" -g "$D_GID" -s /bin/bash d | |
echo d:docker | chpasswd | |
adduser d docker | |
adduser d sudo | |
mkdir -p /home/d/project | |
echo 'd ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
mkdir -p /home/d/.ssh | |
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDKf1wEiD/odhyLID3FeG++YADi5Vr+L0Z8Bt0GeTwxjY5R8MD1OOgM8KViYUihcZj6WvQ8McAJL0E9MP/qLyvAFy3mSScxVMM7V3CyRaB5SXE5Bv1kIndn7X1pAuUS3/cAUgwx8DsFsXmbYOHQJaaWYf5lfh5oShsZjlNlEoBiQ/Nb04qUPlk0UO4G3GnY8hjBrHrzg0vXHPGeP7kLLab3V7U3h6n+nptDql378ekmd8UPoY6keRNd5Fbu0f3A6tkqGHCJCjBLA20AzO8tWgI88SyD44TRqkGl+Zkc+z1ri0ShML6BdLlzB0OEdS3ZDkDxtMLRfdHUeGmqeG/xP+NxU33peyhvitOTX943fjbLguu4tvS6hJtjjn4vJUnVotqkJLEpsYcpfJCXzex9DEZ4IMq7hlv0l7W2han+55GFbBDXpvtObv0laKSipnR0xvDNRPmFhESUPoGEgTsKjIgZndBs9MVliTK6+FFgPNVvemD9D2snqoZyhgSZ7oWbJXWHWeH2ZkqQjcPpIy6VikXQgMsK+kTg2xRZjrPU/4tYUgNZyJxecHJharHExrhoCi8vin5oPkq3YyuXBzkZdG4L857pG5/oi7ROu28a6qYl2Kmc9dIDpzh4T7ksiM/MQfnGk9mV/9omJAkpjaMMK36qlpWttsFIfS2OM9Y0bwoUqQ== [email protected]' >> /home/d/.ssh/authorized_keys | |
chown d:d /home/d /home/d/.ssh | |
# Workshop project | |
( | |
cd /home/d/project | |
git clone https://github.com/lukaszlach/orca.git orca/ | |
chown -R d:d /home/d/project | |
) | |
# Workshop preparation script | |
curl -sSfL lach.dev/orca-sh | bash | |
# Workshop editor | |
( | |
cd /home/d | |
export EDITOR_PORT=18080 | |
export EDITOR_PASSWORD=docker | |
export EDITOR_UID="$D_UID" | |
export EDITOR_GID="$D_GID" | |
#export EDITOR_CLONE=https://github.com/lukaszlach/orca.git | |
curl -sSfL lach.dev/orca-editor | bash | |
) | |
docker run -d --name orca-editor-proxy-443 \ | |
--net host \ | |
-e LISTEN=:443 -e TALK=127.0.0.1:18080 \ | |
-e TIMEOUT_SERVER=3600 -e TIMEOUT_CLIENT=3600 -e TIMEOUT_TUNNEL=3600 \ | |
tecnativa/tcp-proxy | |
docker run -d --name orca-editor-proxy-6668 \ | |
--net host \ | |
-e LISTEN=:6668 -e TALK=127.0.0.1:18080 \ | |
-e TIMEOUT_SERVER=3600 -e TIMEOUT_CLIENT=3600 -e TIMEOUT_TUNNEL=3600 \ | |
tecnativa/tcp-proxy | |
( | |
cd / | |
wget -O gotty.tar.gz https://github.com/yudai/gotty/releases/download/v2.0.0-alpha.3/gotty_2.0.0-alpha.3_linux_amd64.tar.gz | |
tar zxvf gotty.tar.gz | |
cd /home/d | |
/gotty -w -c 'd:docker' -p 8022 --reconnect /usr/bin/sudo -u d bash -l & | |
) | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment