Remove installing ufw
This commit is contained in:
@ -35,7 +35,7 @@ apt-get upgrade -y
|
||||
|
||||
# Install 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
|
||||
echo "Creating OpenVPN directory..."
|
||||
@ -112,8 +112,13 @@ sysctl --system
|
||||
|
||||
# Configure firewall
|
||||
echo "Configuring firewall..."
|
||||
ufw allow 1194/udp
|
||||
ufw allow OpenSSH
|
||||
# Allow OpenVPN and SSH traffic
|
||||
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
|
||||
echo "Setting up NAT for VPN clients..."
|
||||
@ -131,12 +136,12 @@ echo "Making NAT rules persistent..."
|
||||
apt-get install -y iptables-persistent
|
||||
echo "y" | netfilter-persistent save
|
||||
|
||||
echo "y" | ufw enable
|
||||
|
||||
# Start OpenVPN service
|
||||
echo "Starting OpenVPN service..."
|
||||
systemctl start openvpn@server
|
||||
# Start and enable OpenVPN service
|
||||
echo "Starting and enabling OpenVPN service..."
|
||||
systemctl daemon-reload
|
||||
systemctl enable openvpn@server
|
||||
systemctl restart openvpn@server
|
||||
sleep 2
|
||||
|
||||
# Verify the service is running
|
||||
echo "Verifying OpenVPN service status..."
|
||||
|
||||
Reference in New Issue
Block a user