Remove installing ufw
This commit is contained in:
@ -35,7 +35,7 @@ apt-get upgrade -y
|
|||||||
|
|
||||||
# Install OpenVPN and required packages
|
# Install OpenVPN and required packages
|
||||||
echo "Installing OpenVPN and required packages..."
|
echo "Installing OpenVPN and required packages..."
|
||||||
apt-get install -y openvpn easy-rsa ufw
|
apt-get install -y openvpn easy-rsa
|
||||||
|
|
||||||
# Create directory for OpenVPN
|
# Create directory for OpenVPN
|
||||||
echo "Creating OpenVPN directory..."
|
echo "Creating OpenVPN directory..."
|
||||||
@ -112,8 +112,13 @@ sysctl --system
|
|||||||
|
|
||||||
# Configure firewall
|
# Configure firewall
|
||||||
echo "Configuring firewall..."
|
echo "Configuring firewall..."
|
||||||
ufw allow 1194/udp
|
# Allow OpenVPN and SSH traffic
|
||||||
ufw allow OpenSSH
|
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
|
||||||
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||||
|
# Allow established connections
|
||||||
|
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||||
|
# Allow loopback interface
|
||||||
|
iptables -A INPUT -i lo -j ACCEPT
|
||||||
|
|
||||||
# Set up NAT for VPN clients
|
# Set up NAT for VPN clients
|
||||||
echo "Setting up NAT for VPN clients..."
|
echo "Setting up NAT for VPN clients..."
|
||||||
@ -131,12 +136,12 @@ echo "Making NAT rules persistent..."
|
|||||||
apt-get install -y iptables-persistent
|
apt-get install -y iptables-persistent
|
||||||
echo "y" | netfilter-persistent save
|
echo "y" | netfilter-persistent save
|
||||||
|
|
||||||
echo "y" | ufw enable
|
# Start and enable OpenVPN service
|
||||||
|
echo "Starting and enabling OpenVPN service..."
|
||||||
# Start OpenVPN service
|
systemctl daemon-reload
|
||||||
echo "Starting OpenVPN service..."
|
|
||||||
systemctl start openvpn@server
|
|
||||||
systemctl enable openvpn@server
|
systemctl enable openvpn@server
|
||||||
|
systemctl restart openvpn@server
|
||||||
|
sleep 2
|
||||||
|
|
||||||
# Verify the service is running
|
# Verify the service is running
|
||||||
echo "Verifying OpenVPN service status..."
|
echo "Verifying OpenVPN service status..."
|
||||||
|
|||||||
Reference in New Issue
Block a user