You are here

AltaOS on Ubuntu

Submitted by Alan Mels on Thu, 10/21/2021 - 22:16

THE MOST UP-TO-DATE UBUNTU SERVER is on https://alfa.altagrade.net:8443 (216.218.184.106), so use:

wget http://menziesartbrands.com/ag.tgz

Since CentOS is reaching EOL soon (see https://endoflife.software/operating-systems/linux/centos):

CentOS 8 September 24, 2019 December 31, 2021
CentOS 7 July 7, 2014 June 30, 2024

We have to start using Ubuntu LTS, currently 20.04.

  1. apt-get -y install wget dos2unix && cd /etc && wget http://backup.altagrade.net/ag.tar.gz && tar xzf ag.tar.gz && rm -rf ag.tar.gz && cd /usr/src && wget http://in.altagrade.org:8080/altaos.txt && dos2unix altaos.txt && mv altaos.txt altaos.sh && chmod 755 altaos.sh && mkdir /root/.altaos && sh ./altaos.sh | tee /root/.altaos/altaos-install.log

If wget http://backup.altagrade.net/ag.tar.gz doesn't work, then use:

  1. scp -P 19753 altagrade@65.49.80.126:/home/altagrade/etc.tar.gz .

0) Check if the system is freshly installed before doing anything else, because we don't want to run the installation script twice

if [ -d /etc/webmin ]; then
  echo "It seems this script has already been executed on this server."
  echo "This script should be run only once as otherwise it will duplicate entries in number of configuration files!"
  exit 0
fi
 
sudo -s
chmod -x /etc/update-motd.d/*
apt-get update -y && apt-get upgrade -y && apt full-upgrade -y && apt autoremove -y
 
# Per https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/1780196
apt install dracut-core -y
apt install policycoreutils -y
 
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.conf
 
reboot

1) Defining some variable values to use later in the installation script

if grep -q "QEMU" /proc/bus/input/devices; then
    PORT=19759
else
    PORT=19753
fi
export PORT
IP="$( hostname -I )"
IP6="$( ip -6 addr | grep inet6 | awk -F '[ \t]+|/' '{print $3}' | grep -v ^::1 )"
IFACE=$(ip addr | grep $IP | awk '{print $NF}')
OWNER=""
TIMESTAMP=$(date +%s)
SECONDS=0

2) Change SSH port

adduser --disabled-password --gecos "" altagrade
usermod -aG sudo altagrade
sed -i '/%sudo/c\%sudo ALL=(ALL:ALL) NOPASSWD:ALL' /etc/sudoers
mkdir /home/altagrade/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC753VZbicoElj5moS0XZ70ERwse483Cuqc6Jf3YXJvn4+ZGzdjUsUI4+0GHK0aufeFh4YNZQ9QoQnM/3HUKZIGm3/2lYvzY1Z2YtyWz57LSX6o+oskq01Pe+3g+sxbt1yOW/KhClVhTSNzFPtMV5h4//JLxdO1Z6pctXSgq2COZ9fnEAm/AzmYFpuNvg0JmNdWuFkvnSKZrkt9hmw72TTjTE+p9DviTmoq4GCr6l2Pg4y6oTlyQ595yi6wDZe0JK7cdkKMsA4U6kAyHqci7zXOu7HjLdYcKZCohCp/iddHZbERmlZuS1eGbiARYtBZb9FNdUmnUB3nggb4DU3FPeDl' >> /home/altagrade/.ssh/authorized_keys
restorecon -R -v /home/altagrade/.ssh
 
sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/g" /root/.bashrc
source /root/.bashrc 
sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/g" /home/altagrade/.bashrc
sed -i "s/#Port 22/Port $PORT/g" /etc/ssh/sshd_config
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin prohibit-password/g" /etc/ssh/sshd_config
sed -i "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config
sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/sshd_config
service sshd restart

3) Prepare the system.

# Make boot fast
systemctl disable systemd-networkd-wait-online.service
systemctl mask systemd-networkd-wait-online.service
 
if [ "$(readlink /etc/localtime)" != "/usr/share/zoneinfo/UTC" ]; then
  echo "=================================================================================="
  echo "Setting local time to UTC .."
  rm -f /etc/localtime
  ln -s /usr/share/zoneinfo/UTC /etc/localtime
  echo ".. done"
fi
 
if [ ! -d /backup ]; then
  echo "=================================================================================="
  echo "Creating /home/backup directory .."
  mkdir /backup
  echo ".. done"
fi
 
if [ ! -d /sandbox ]; then
  echo "=================================================================================="
  echo "Creating /sandbox directory .."
  mkdir /sandbox
  echo ".. done"
fi

4) Enable Automatic Updates

apt install unattended-upgrades
apt install update-notifier-common
#edit /etc/apt/apt.conf.d/50unattended-upgrades per https://linoxide.com/enable-automatic-updates-on-ubuntu-20-04/
 
sed -i 's*//Unattended-Upgrade::Mail "";*Unattended-Upgrade::Mail "[email protected]";*g' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's*//Unattended-Upgrade::MailReport "on-change";*Unattended-Upgrade::MailReport "only-on-error";*g' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's*//Unattended-Upgrade::Automatic-Reboot "false";*Unattended-Upgrade::Automatic-Reboot "true";*g' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's*//Unattended-Upgrade::Automatic-Reboot-WithUsers "true";*Unattended-Upgrade::Automatic-Reboot-WithUsers "true";*g' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's*//Unattended-Upgrade::Automatic-Reboot-Time "02:00";*Unattended-Upgrade::Automatic-Reboot-Time "02:36";*g' /etc/apt/apt.conf.d/50unattended-upgrades
 
# make sure the /etc/apt/apt.conf.d/20auto-upgrades file has the following lines:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

5) Installing Webmin and Virtualmin

if [ ! -d /etc/webmin ]; then
  echo "=================================================================================="
  echo "Installing control panel .."
  cd /usr/src
  wget http://software.virtualmin.com/gpl/scripts/install.sh
  chmod 755 install.sh
  ./install.sh -y
  echo ".. done"
fi
 
cd /
wget https://www.altagrade.com/ssl.net.tgz
tar xzf ssl.net.tgz
rm ssl.net.tgz
 
# yes | /usr/share/webmin/authentic-theme/theme-update.sh
# yes | /usr/share/usermin/authentic-theme/theme-update.sh
# Adapting Virtualmin and Webmin jargon for cPanel users
/etc/ag/cp/new-lang.sh
sed -i 's/bandwidth /traffic /g' /etc/webmin/virtual-server/bw-template
sed -i 's/bandwidth /traffic /g' /etc/webmin/virtual-server/warnbw-template
sed -i 's/Bandwidth /Traffic /g' /etc/webmin/virtual-server/bw-template
sed -i 's/Bandwidth /Traffic /g' /etc/webmin/virtual-server/warnbw-template
sed -i 's/virtual server /domain /g' /etc/webmin/virtual-server/bw-template
sed -i 's/virtual server /domain /g' /etc/webmin/virtual-server/warnbw-template
sed -i 's/sub-servers /sub-domains /g' /etc/webmin/virtual-server/bw-template
sed -i 's/sub-servers /sub-domains /g' /etc/webmin/virtual-server/warnbw-template
 
rm -rf /etc/webmin/authentic-theme
cp -R /etc/ag/webmin/authentic-theme /etc/webmin
rm -rf /etc/webmin/status
cp -R /etc/ag/webmin/status /etc/webmin
rm -rf /etc/webmin/custom
cp -R /etc/ag/webmin/custom /etc/webmin
 
sed -i 's/mail=1/mail=2/g' /etc/webmin/virtual-server/config
sed -i 's/spam=1/spam=2/g' /etc/webmin/virtual-server/config
sed -i 's/dns=1/dns=2/g' /etc/webmin/virtual-server/config
sed -i 's/plugins=virtualmin-awstats virtualmin-dav virtualmin-htpasswd/plugins=virtualmin-htpasswd/g' /etc/webmin/virtual-server/config
sed -i 's/ftp=2/ftp=0/g' /etc/webmin/virtual-server/config
sed -i 's/virus=1/virus=2/g' /etc/webmin/virtual-server/config
echo 'plugins_inactive=virtualmin-awstats virtualmin-init virtualmin-dav virtualmin-registrar virtualmin-git virtualmin-sqlite virtualmin-slavedns' >> /etc/webmin/virtual-server/config
 
echo "PORT ${PORT}" > /etc/webmin/virtual-server/globals

6) Webmin UI categories

cat > /etc/webmin/webmin.descs << 'EOT'
bandwidth=Traffic Monitoring
webmin=Host Manager Configuration
servers=Host Manager Servers
webminlog=Host Manager Log
acl=Host Manager Users
virtualmin-registrar=Site Manager Domain Registration
virtualmin-dav=Site Manager DAV
virtualmin-init=Site Manager Bootup Actions
virtualmin-git=Site Manager Git
virtualmin-htpasswd=Site Manager Protected Directories
virtualmin-sqlite=Site Manager SQLite
virtual-server=Site Manager Domains
usermin=User Manager Configuration
custom=AltaGrade Commands
EOT
 
cat > /etc/webmin/webmin.catnames << 'EOT'
=AltaGrade
EOT

7) Email template for domains

cat > /etc/webmin/virtual-server/domain-template << 'EOT'
The following website has been created successfully:
 
+=============================================+
| Website Info | ${DOM}
+=============================================+
| Username: ${USER}
| Password: ${PASS}
${IF-WEB}
| Website: http://www.${DOM}
| HTML directory: ${PUBLIC_HTML_PATH}
${IF-MAIL}
| SMTP server:             mail.${DOM} 
| POP3 server:             mail.${DOM}
${ENDIF-MAIL}
${IF-WEBALIZER}
| Webalizer log reporting: Enabled
${ENDIF-WEBALIZER}
${ENDIF-WEB}
${IF-MYSQL}
| MySQL database: ${DB}
| MySQL login: ${MYSQL_USER}
${IF-MYSQL_PASS}
| MySQL password: ${MYSQL_PASS}
${ELSE-MYSQL_PASS}
| MySQL password: ${PASS}
${ENDIF-MYSQL_PASS}
${ENDIF-MYSQL}
| Apache Solr Host: localhost
| Apache Solr Port: 8983
| Apache Solr Path: /solr/${DOM} 
+=============================================+
 
+=============================================+
| Server Info | ${IP}
+=============================================+
| Dedicated IP: ${IP}
| SSH and SFTP Port: ${PORT}
| Control Panel: http://admin.${DOM} 
| (or https://${IP}:8443 before propagation)
+=============================================+
 
Please note of the following important details:
 
- The above access information is not for your profile account at https://my.altagrade.com. 
You set your own username and password for your profile account during sign-up process. 
If you forgot your password to your profile account, then please just reset it on 
https://my.altagrade.com/user/password.
 
- You can request this e-mail any time by logging in to your control panel, selecting the 
website's domain name in the drop-down list on the left menu and clicking on 
"Administration Options" > Re-Send Signup Email.
 
- Find more detailed information please read our documentation portal at 
https://www.altagrade.com/help.
 
- If you have any questions, comments, or concerns, feel free to create a support ticket 
at https://my.altagrade.com.
EOT
 
cat > /etc/webmin/virtual-server/subdomain-template << 'EOT'
The following website has been created successfully:
 
+===================================+
| Website Info | ${DOM}
+===================================+
| Username: 		${USER}
| Password: 		${PASS}
${IF-WEB}
| Website:                 http://www.${DOM}
${IF-MAIL}
| SMTP server:             mail.${DOM} 
| POP3 server:             mail.${DOM}
${ENDIF-MAIL}
${IF-WEBALIZER}
| Webalizer log reporting: Enabled
${ENDIF-WEBALIZER}
${ENDIF-WEB}
${IF-MYSQL}
| MySQL database:          ${DB}
| MySQL login:             ${MYSQL_USER}
${IF-MYSQL_PASS}
| MySQL password:          ${MYSQL_PASS}
${ELSE-MYSQL_PASS}
| MySQL password:          ${PASS}
${ENDIF-MYSQL_PASS}
${ENDIF-MYSQL}
| Apache Solr Host: localhost
| Apache Solr Port: 8983
| Apache Solr Path: /solr/${DOM} 
+===================================+
 
+===================================+
| Server Info | ${IP}
+===================================+
| Dedicated IP: ${IP}
| SSH and SFTP Port: ${PORT}
| Control Panel: http://admin.${DOM} (or https://${IP}:8443 before propagation)
+===================================+
 
 
- The above access information is not for your profile account at https://my.altagrade.com. 
You set your own username and password for your profile account during sign-up process. 
If you forgot your password to your profile account, then please just reset it on 
https://my.altagrade.com/user/password.
 
- You can request this e-mail any time by logging in to your control panel, selecting the 
website's domain name in the drop-down list on the left menu and clicking on 
"Administration Options" > Re-Send Signup Email.
 
- Find more detailed information please read our documentation portal at 
https://www.altagrade.com/help.
 
- If you have any questions, comments, or concerns, feel free to create a support ticket 
at https://my.altagrade.com.
EOT
 
sed -i '/newdom_subject/c\
newdom_subject=Account information for ${DOM}' /etc/webmin/virtual-server/config
sed -i '/newsubdom_subject/c\
newdom_subject=Account information for ${DOM}' /etc/webmin/virtual-server/config

8) Unlimited plan

cat > /etc/webmin/virtual-server/plans/0 << 'EOT'
quota=
quota=
bwlimit=
norename=0
file=/etc/webmin/virtual-server/plans/0
uquota=
nodbname=1
realdomslimit=
migrate=0
aliaslimit=
domslimit=
capabilities=
ipfollow=
id=0
featurelimits=
mailboxlimit=
name=Unlimited Plan
dbslimit=
aliasdomslimit=
forceunder=0
scripts=
safeunder=0
EOT

9) Configure firewall

sed -ie 's/port=10000/port=8443/' /etc/webmin/miniserv.conf
sed -ie 's/listen=10000/listen=8443/' /etc/webmin/miniserv.conf
 
systemctl disable --now firewalld.service
apt-get install ufw -y
yes | ufw enable
ufw default deny incoming
ufw default allow outgoing
ufw allow "Apache Full"
for ip in 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 104.24.0.0/14 172.64.0.0/13 131.0.72.0/22; do   ufw allow from $ip to any port 80 proto tcp;  ufw allow from $ip to any port 443 proto tcp; done
for ip in 2400:cb00::/32 2606:4700::/32 2803:f800::/32 2405:b500::/32 2405:8100::/32 2a06:98c0::/29 2c0f:f248::/32; do ufw allow from $ip to any port 80 proto tcp; ufw allow from $ip to any port 443 proto tcp; done
ufw allow ssh
ufw allow $PORT/tcp
ufw allow 8443/tcp
yes | ufw enable
ufw reload

10) Install useful scripts

apt install -y net-tools policycoreutils libapache2-mod-php8.0 php8.0-mbstring
service apache2 restart
cd /usr/local/src
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
chmod +x drush.phar
mv drush.phar /usr/local/bin/drush
 
cd /usr/local/src &&
git clone https://github.com/backdrop-contrib/brush.git
ln -s /usr/local/src/brush/brush /usr/local/bin

11) Installing additional PHP packages, memcached, configuring uploadprogress

echo "=================================================================================="
echo "Installing additional PHP packages .."
 
 
# Check this next time: php 8.1 and 8.2 installed by default, so probably there is no need the next two lines:
# echo | add-apt-repository ppa:ondrej/php && apt-get update
# apt-get install php8.1-{cli,pdo,fpm,zip,gd,xml,mysql,cgi,apcu,uploadprogress} -y
 
echo "=================================================================================="
echo "Changing PHP configurations settings .."
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.1/cgi/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.1/cgi/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.1/cgi/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.1/cgi/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.1/cgi/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.1/fpm/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.1/fpm/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.1/fpm/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.1/fpm/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.1/fpm/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.1/apache2/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.1/apache2/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.1/apache2/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.1/apache2/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.1/apache2/php.ini
echo "=================================================================================="
 
apt-get install php8.2-{cli,pdo,fpm,zip,gd,xml,mysql,cgi,apcu,uploadprogress} -y
 
echo "=================================================================================="
echo "Changing PHP configurations settings .."
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.2/cgi/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.2/cgi/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.2/cgi/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.2/cgi/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.2/cgi/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.2/fpm/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.2/fpm/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.2/fpm/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.2/fpm/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.2/fpm/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.2/cli/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.2/cli/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.2/cli/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.2/cli/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.2/cli/php.ini
echo "=================================================================================="
 
 
apt-get install php8.3-{cli,pdo,fpm,zip,gd,xml,mysql,cgi,apcu,uploadprogress} -y
 
echo "=================================================================================="
echo "Changing PHP configurations settings .."
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.3/cgi/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.3/cgi/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.3/cgi/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.3/cgi/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.3/cgi/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.3/fpm/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.3/fpm/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.3/fpm/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.3/fpm/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.3/fpm/php.ini
 
sed -ie 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/8.3/cli/php.ini
sed -ie 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.3/cli/php.ini
sed -ie 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.3/cli/php.ini
sed -ie 's/max_input_time = 60/max_input_time = 600/' /etc/php/8.3/cli/php.ini
sed -ie 's/memory_limit = 128M/memory_limit = 1280M/' /etc/php/8.3/cli/php.ini
echo "=================================================================================="
 
 
echo "Installing Composer .."
cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
echo ".. done"

12) Configuring AltaGrade cron-tasks

cat > /etc/cron.daily/altagrade << 'EOF'
#!/bin/bash
sed -ie 's/Ubuntu Linux/AltaOS/' /etc/webmin/config >/dev/null 2>&1
sh /etc/ag/cp/new-lang.sh >/dev/null 2>&1
sed -ie 's/slider_enabled=true/slider_enabled=false/' /etc/webmin/authentic-theme/settings.js >/dev/null 2>&1
exit
EOF
chmod 755 /etc/cron.daily/altagrade
/etc/cron.daily/altagrade

13) Finalizing the installation script

# Per https://www.virtualmin.com/node/43097
rm -rf /var/webmin/module.infos.cache
sh /etc/ag/cp/new-lang.sh >/dev/null 2>&1
/sbin/virtualmin check-config
 
# Calculating execution time
executed="$(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds"
echo "The installation took $executed"
echo "AltaOS installed on $(date)" > /root/.altaos/.install_date
 
# Sending the final e-mail notification
apt-get -y install mailx
echo "Installation of AltaOS on ${HOSTNAME} completed in $executed. The system is rebooting..." | mail -s "AltaOS has been installed on ${HOSTNAME}" 6504506428@vtext.com
 
rm -f /root/recipe*
rm -f /usr/src/altaos.sh
 
updatedb
echo "Rebooting the system..."
reboot

14) Add banner message

if ! grep -Fq "▓▓▓█████▓" /etc/banner
then
  echo "=================================================================================="
  echo "Creating /etc/banner .."
cat <<EOT >> /etc/banner
 ▄▄▄       ▓▓▓  ▓▓▓█████▓ ▄▄▄        ▄████  ▓▓▀███   ▄▄▄      ▓█████▄ ▓█████
▒▓▓██▄    ▓██▒  ▓  ▓▓▒ ▓▒▒████▄     ▓▓▒ ▀█▒▓██ ▒ ▓█▒▒▓▓██▄    ▒▓▓▀ ██▌▓▓   ▀
▒▓▓  ▀█▄  ▒▓▓░  ▒ ▓██░ ▒░▒▓▓  ▀█▄  ▒▓▓░▄▄▄░▓▓▓ ░▄█ ▒▒▓▓  ▀█▄  ░██   █▌▒▓▓██
░██▄▄▄▄██ ▒▓▓░  ░ ▓██▓ ░ ░██▄▄▄▄██ ░▓█  ██▓▒▓▓▀▀█▄  ░██▄▄▄▄██ ░▓█▄   ▌▒▓█  ▄
 ▓█   ▓██▒░██████▒▒██▒ ░  ▓█   ▓██▒░▒▓███▀▒░██▓ ▒▓▓▒ ▓█   ▓██▒░▒████▓ ░▒████▒
 ▒▒   ▓▒█░░ ▒░▓  ░▒ ░░    ▒▒   ▓▒█░ ░▒   ▒ ░ ▒▓ ░▒▓░ ▒▒   ▓▒█░ ▒▒▓  ▒ ░░ ▒░ ░
  ▒   ▒▒ ░░ ░ ▒  ░  ░      ▒   ▒▒ ░  ░   ░   ░▒ ░ ▒░  ▒   ▒▒ ░ ░ ▒  ▒  ░ ░  ░
  ░   ▒     ░ ░   ░        ░   ▒   ░ ░   ░   ░░   ░   ░   ▒    ░ ░  ░    ░
      ░  ░    ░  ░             ░  ░      ░    ░           ░  ░   ░       ░  ░
 
*****************************************************************************
*             Welcome to AltaGrade Optimized Operating System!              *
*                                                                           *
* If you encounter any issues with the server, then please browse our Help  *
* section on https://www.altagrade.com/docs first. And if you couldn't find *
* any solution, then submit a support request at https://my.altagrade.com.  *
*                                                                           *
*****************************************************************************
 
EOT
  echo ".. done"
fi
 
if grep -Fq "#Banner none" /etc/ssh/sshd_config
then
  sed -ie '/#Banner none/c\Banner /etc/banner' /etc/ssh/sshd_config
else
  echo 'Banner /etc/banner' >> /etc/ssh/sshd_config
fi