Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ufw firewall & ssh in iptables #233

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions iptables
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ iptables -A INPUT -i eth0 -p tcp --dport 902 -j REJECT --reject-with icmp-port-u
# icmp-admin-prohibited
# tcp-reset

# To only allow ssh on the server and block all other ports
ThirdScript marked this conversation as resolved.
Show resolved Hide resolved
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
ThirdScript marked this conversation as resolved.
Show resolved Hide resolved

# To add a comment to a rule:
iptables ... -m comment --comment "This rule is here for this reason"

Expand Down
29 changes: 29 additions & 0 deletions ufw
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# To check the status of the firewall:
ufw status

# To check the status with more details:
ufw status verbose

# To allow a port on the firewall by its name:
ufw allow <port-name>
ThirdScript marked this conversation as resolved.
Show resolved Hide resolved
ufw allow http
ufw allow https
ufw allow ssh
ufw allow ftp

# To allow a port on the firewall by its number:
ufw allow <port-number>
ufw allow 5432

# To delete an allowed port rule on the firewall:
ufw delete allow 5432

# To block a port on the firewall:
ufw deny 21

# To enable the firewall and activate the rules:
ufw enable

# To disable the firewall and deactivate the rules:
ufw disable