Compare commits
No commits in common. "32afd217a9979394fd3e95b81b1fba30c0592ad2" and "d187f35993a5ee01863b62b217efe89e3a3d6bcc" have entirely different histories.
32afd217a9
...
d187f35993
@ -12,12 +12,6 @@ sudo su -c "bash <(wget -qO- https://git.myspace.nu/MySpace/Docs/raw/branch/mast
|
||||
sudo su -c "bash <(wget -qO- https://git.myspace.nu/MySpace/Docs/raw/branch/master/BashScripts/install-mysql.sh)"
|
||||
```
|
||||
|
||||
## Install UFW (and disable iptables)
|
||||
|
||||
```bash
|
||||
sudo su -c "bash <(wget -qO- https://git.myspace.nu/MySpace/Docs/raw/branch/master/BashScripts/install-ufw.sh)"
|
||||
```
|
||||
|
||||
## Install Bind
|
||||
|
||||
```bash
|
||||
|
@ -9,7 +9,7 @@ mkdir /home/$REALUSER/www 2>>install.log &
|
||||
|
||||
#apt install docker.io
|
||||
|
||||
apt update -qq 2>>install.log
|
||||
# apt update 2>>install.log &&
|
||||
apt install apache2 -y 2>>install.log &&
|
||||
apt install samba -y 2>>install.log &&
|
||||
|
||||
|
@ -6,33 +6,33 @@ if [[ $EUID -ne 0 ]]; then
|
||||
fi
|
||||
REALUSER=$(logname)
|
||||
|
||||
apt update -qq 2>>install.log
|
||||
apt update 2>>install.log
|
||||
|
||||
ufw status >/dev/null 2>&1 || (
|
||||
if ! ufw status | grep -q 'Status: active'; then
|
||||
echo "Installing UFW..."
|
||||
apt install ufw -y 2>>install.log
|
||||
ufw default allow outgoing 2>>install.log
|
||||
ufw default deny incoming 2>>install.log
|
||||
ufw allow ssh 2>>install.log
|
||||
apt install ufw -y 2>>install.log &&
|
||||
ufw default allow outgoing 2>>install.log &&
|
||||
ufw default deny incoming 2>>install.log &&
|
||||
ufw allow ssh 2>>install.log &&
|
||||
ufw enable 2>>install.log
|
||||
)
|
||||
nslookup 127.0.0.1 >/dev/null 2>&1 || (
|
||||
fi
|
||||
if nslookup 127.0.0.1 | grep -q 'command not found'; then
|
||||
echo "Installing DNS utils..."
|
||||
apt install dnsutils -y 2>>install.log
|
||||
)
|
||||
named -v >/dev/null 2>&1 || (
|
||||
apt install dnsutils 2>>install.log
|
||||
fi
|
||||
if ! named -v | grep -q 'BIND'; then
|
||||
echo "Installing BIND9..."
|
||||
apt install bind9 -y 2>>install.log &&
|
||||
ufw allow Bind9 2>>install.log &&
|
||||
ufw allow Bind9 -y 2>>install.log &&
|
||||
nslookup google.com 127.0.0.1
|
||||
)
|
||||
fi
|
||||
if ! grep -q "listen-on {" "/etc/bind/named.conf.options"; then
|
||||
sed -i -e 's/^};/\tlisten-on { any; };\n};/mig' /etc/bind/named.conf.options
|
||||
fi
|
||||
if ! grep -q "allow-query" "/etc/bind/named.conf.options"; then
|
||||
sed -i -e 's/^};/\tallow-query { any; };\n};/mig' /etc/bind/named.conf.options
|
||||
fi
|
||||
if ! grep -q "forwarders { 1" "/etc/bind/named.conf.options"; then
|
||||
if ! grep -q "\tforwarders {" "/etc/bind/named.conf.options"; then
|
||||
sed -i -e 's/^};/\tforwarders { 1.1.1.1; 8.8.8.8; 8.8.4.4; };\n};/mig' /etc/bind/named.conf.options
|
||||
fi
|
||||
named-checkconf && systemctl restart bind9
|
||||
|
@ -20,10 +20,10 @@ fi
|
||||
read -e -p "Enter desired root password:" ROOTPASSWORD
|
||||
if mysql -e "SELECT user,host FROM mysql.user WHERE host = '192.168.%.%';" | grep -q 'root'; then
|
||||
echo "Altering root user with password $ROOTPASSWORD"
|
||||
mysql -e "ALTER USER 'root'@'192.168.%.%' IDENTIFIED WITH mysql_native_password BY '$ROOTPASSWORD';"
|
||||
mysql -e "ALTER USER 'root'@'192.168.%.%' IDENTIFIED BY '$ROOTPASSWORD';"
|
||||
else
|
||||
echo "Adding root user with password $ROOTPASSWORD"
|
||||
mysql -e "CREATE USER 'root'@'192.168.%.%' IDENTIFIED WITH mysql_native_password BY '$ROOTPASSWORD';"
|
||||
mysql -e "CREATE USER 'root'@'192.168.%.%' IDENTIFIED BY '$ROOTPASSWORD';"
|
||||
fi
|
||||
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%.%' WITH GRANT OPTION;"
|
||||
mysql -e "FLUSH PRIVILEGES;"
|
||||
|
@ -8,8 +8,6 @@ if [[ $EUID -ne 0 ]]; then
|
||||
fi
|
||||
REALUSER=$(logname)
|
||||
|
||||
apt update -qq 2>>install.log
|
||||
|
||||
IP=$(ip route get 8.8.8.8 | sed -n '/src/{s/.*src *\([^ ]*\).*/\1/p;q}')
|
||||
GATEWAY=$(/sbin/ip route | awk '/default/ { print $3 }')
|
||||
OS_VERSION=$(grep -oP 'VERSION_ID="\K[\d.]+' /etc/os-release)
|
||||
|
@ -1,41 +0,0 @@
|
||||
# Install using: sudo su -c "bash <(wget -qO- /url/to/install-ufw.sh)"
|
||||
|
||||
# Make sure script is ran as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
exec sudo /bin/bash "$0" "$@"
|
||||
fi
|
||||
REALUSER=$(logname)
|
||||
|
||||
apt update -qq 2>>install.log
|
||||
|
||||
iptables --list >/dev/null 2>&1 && (
|
||||
echo "Disabling iptables..."
|
||||
# Accept all traffic first to avoid ssh lockdown via iptables firewall rules #
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -P FORWARD ACCEPT
|
||||
iptables -P OUTPUT ACCEPT
|
||||
# Flush All Iptables Chains/Firewall rules #
|
||||
iptables -F
|
||||
# Delete all Iptables Chains #
|
||||
iptables -X
|
||||
# Flush all counters too #
|
||||
iptables -Z
|
||||
# Flush and delete all nat and mangle #
|
||||
iptables -t nat -F
|
||||
iptables -t nat -X
|
||||
iptables -t mangle -F
|
||||
iptables -t mangle -X
|
||||
iptables -t raw -F
|
||||
iptables -t raw -X
|
||||
)
|
||||
|
||||
ufw status >/dev/null 2>&1 || (
|
||||
echo "Installing UFW..."
|
||||
apt install ufw -y 2>>install.log
|
||||
ufw default allow outgoing 2>>install.log
|
||||
ufw default deny incoming 2>>install.log
|
||||
ufw allow ssh 2>>install.log
|
||||
ufw enable 2>>install.log
|
||||
)
|
||||
|
||||
echo 'Installation complete'
|
Loading…
x
Reference in New Issue
Block a user