#!/bin/sh
# disable and reset ufw
sudo ufw reset --force
# deny everything
sudo ufw default deny
# allow remote ssh connection from host 1.2.3.4
sudo ufw allow proto tcp from 1.2.3.4 to any port 22
# allow remote ssh connection from host 1.2.3.5
sudo ufw allow proto tcp from 1.2.3.5 to any port 22
# trust remote ip 1.2.3.6
sudo ufw allow from 1.2.3.6
sudo ufw allow to 1.2.3.6
# allow https server port
sudo ufw allow proto tcp from any to any port 443
# allow tcp connection from 1.2.3.7 to port 6666
sudo ufw allow proto tcp from 1.2.3.7 to any port 6666
# enable ufw
sudo ufw enable
# list the rules
sudo ufw status verbose
No comments:
Post a Comment