diff --git a/protected_resources/scripts/install-config-ssh.sh b/protected_resources/scripts/install-config-ssh.sh new file mode 100644 index 0000000..ac7cc01 --- /dev/null +++ b/protected_resources/scripts/install-config-ssh.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +if which ssh >/dev/null 2>&1; then + echo "SSH is installed" + exit 1 +else + echo "SSH is not installed" +fi + +if lsb_release -a 2>/dev/null | grep -q -E "Debian|Ubuntu"; then + echo "Running Debian or Ubuntu" + apt-get install openssh-server + systemctl start sshd + +elif cat /etc/os-release 2>/dev/null | grep -q -i "alpine"; then + echo "Running Alpine" + + # Stop and remove Dropbear + rc-service dropbear stop + rc-update del dropbear + apk del dropbear* -f + + # Stop and remove SSHD + rc-service sshd stop + rc-update del sshd + apk del openssh* -f + + # Clean up Dropbear and SSH configurations + rm -rf /etc/dropbear + rm -rf /etc/ssh + rm /etc/init.d/ssh + + # Reboot now if needed + # reboot now + + # Install OpenSSH and necessary packages + apk add openssh gcompat libstdc++ curl bash git grep + apk add procps --no-cache + + # Start and add SSHD to startup + rc-service sshd start + rc-update add sshd + + # Update AllowTcpForwarding setting + sed -i 's/^#*AllowTcpForwarding.*/AllowTcpForwarding yes/' /etc/ssh/sshd_config + + # Update PermitTunnel setting + sed -i 's/^#*PermitTunnel.*/PermitTunnel yes/' /etc/ssh/sshd_config + + # Uncomment the line if needed (remove '#' at the beginning) + sed -i 's/^#PermitTunnel.*/PermitTunnel yes/' /etc/ssh/sshd_config + + # Restart the SSH service to apply the changes + /etc/init.d/sshd restart + +else + echo "Unknown distribution" + exit 1 +fi + +# Set PermitRootLogin to prohibit-password +sed -i 's/^#*PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config diff --git a/resources/scripts/install-docker.sh b/resources/scripts/install-docker.sh index 69b7f0b..4fed03b 100644 --- a/resources/scripts/install-docker.sh +++ b/resources/scripts/install-docker.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if which docker >/dev/null 2>&1; then echo "Docker is installed" exit 1