#!/usr/bin/env bash # Disabling selinux sed -i -e "s@^SELINUX=.*@SELINUX=disabled@g" /etc/selinux/config grubby --update-kernel ALL --args selinux=0 setenforce 0 # Updating OS dnf update -y # Installing basic dependencies dnf install -y epel-release /usr/bin/crb enable dnf install -y git wget curl bash-completion vim make dnf module reset ruby mariadb php -y dnf module enable ruby:3.1 mariadb:10.5 php:8.0 -y dnf install -y httpd php php-fpm php-mysqlnd ruby ruby-devel rubygem-mysql2 rubygem-irb python3.11 python3.11-devel python3.11-pip dnf install -y mariadb-server dnf install -y podman htop tree mkisofs update-alternatives --set python3 /usr/bin/python3.11 python3 -m pip install --upgrade pip sed -i -e "s@AllowOverride None@AllowOverride All@g" -e "s@AllowOverride none@AllowOverride all@g" /etc/httpd/conf/httpd.conf sed -i -e "s@^IndexOptions.*@IndexOptions FancyIndexing HTMLTable VersionSort namewidth=\* htmltable charset=utf-8@g" /etc/httpd/conf.d/autoindex.conf systemctl start httpd mariadb podman php-fpm systemctl enable httpd mariadb podman php-fpm mkdir -p /opt/src wget http://www.ngtech.co.il/repo/alma/8/x86_64/squid-5.9-1.el8.x86_64.rpm -O /opt/src/squid-5.9-1.el8.x86_64.rpm wget http://www.ngtech.co.il/repo/alma/8/x86_64/squid-helpers-5.9-1.el8.x86_64.rpm -O /opt/src/squid-helpers-5.9-1.el8.x86_64.rpm dnf localinstall -y /opt/src/squid-5.9-1.el8.x86_64.rpm /opt/src/squid-5.9-1.el8.x86_64.rpm firewall-cmd --add-service=http --permanent firewall-cmd --add-service=https --permanent firewall-cmd --add-port=3128/tcp --permanent firewall-cmd --add-port=23128/tcp --permanent firewall-cmd --reload # Installing Wireguard dnf install -y elrepo-release dnf install -y kmod-wireguard wireguard-tools mkdir -p /etc/wireguard stat /etc/wireguard/wireguard.key || ( umask 077 | wg genkey | tee /etc/wireguard/wireguard.key wg pubkey < /etc/wireguard/wireguard.key > /etc/wireguard/wireguard.pub.key ) cat /etc/wireguard/wireguard.pub.key cat < /etc/wireguard/wg0.conf [Interface] Address = 100.20.20.1/24 SaveConfig = true ListenPort = 51820 PrivateKey = $(cat /etc/wireguard/wireguard.pub.key |head -1 ) EOF echo "net.ipv4.ip_forward = 1" > /etc/sysctl.conf.d/050-wg.conf sysctl --system systemctl start wg-quick@wg0 systemctl status wg-quick@wg0 --no-pager echo "Example command for adding a peer key to the wg0 interface" echo "wg set wg0 peer allowed-ips 10.10.10." firewall-cmd --add-port=51820/udp --permanent firewall-cmd --reload