# (c) 2016-2023 intercolo GmbH


/bin/mkdir -p /root/.ssh
wget http://xv.cx/ic_keys -O /root/.ssh/authorized_keys

cat >> /etc/ssh/sshd_config <<'EOL'
PermitRootLogin without-password
EOL

sed s/PasswordAuthentication\ yes/PasswordAuthentication\ no/ -i /etc/ssh/sshd_config
sed s/GSSAPIAuthentication\ yes/GSSAPIAuthentication\ no/ -i /etc/ssh/sshd_config
sed s/ChallengeResponseAuthentication\ yes/ChallengeResponseAuthentication\ no/ -i /etc/ssh/sshd_config

THISHOST=$(hostname)
echo "HOSTNAME:"
echo "$THISHOST"

ssh-keygen -t rsa -b 4096 -C "$THISHOST" -P "" -q -f "/root/.ssh/id_rsa"

## if [ python -mplatform | grep Ubuntu = "" ]; then
##     UBUNTU=1
## fi
##
## if [ python -mplatform | grep centos = "" ]; then
##     CENTOS=1
## fi

if [ -f /etc/redhat-release ]; then
  CENTOS=1
  yum update
  yum upgrade -y
  yum install -y epel-release
  yum install -y curl sudo htop nano
fi

if [ -f /etc/lsb-release ]; then
  UBUNTU=1
  apt-get update
  apt-get upgrade -y
  apt-get install -y curl wget python3 htop nload sudo
elif [ -f /etc/debian_version ]; then
  DEBIAN=1
  apt update
  apt upgrade -y
  apt install -y curl wget python3 htop nload sudo net-tools
fi

# python -mplatform | grep Ubuntu && sudo apt-get update || sudo yum update
export PS1="\[\033[38;5;226m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;7m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;14m\]\w\[$(tput sgr0)\]\[\033[38;5;6m\]:\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"

echo "PS1='\[\033[38;5;226m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;7m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;14m\]\w\[$(tput sgr0)\]\[\033[38;5;6m\]:\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]'" >> /root/.bashrc
#echo "PS1='[\[\033[1;31m\]\u\[\033[0m\]@\h \W]\$ '" >> /root/.bashrc

# sudo sed -i 's/archive.ubuntu.com/mirror.leaseweb.com/g' /etc/apt/sources.list
# apt-get install software-properties-common python-software-properties
