Skip to content

Instantly share code, notes, and snippets.

@lechugalf
Created October 10, 2019 06:47
Show Gist options
  • Save lechugalf/dad3015560f9ac68d1caa0897a0cee03 to your computer and use it in GitHub Desktop.
Save lechugalf/dad3015560f9ac68d1caa0897a0cee03 to your computer and use it in GitHub Desktop.
Practica UFW
# Allowing ssh connection and manage of utility
# ip host 192.168.1.97
# ip vm 192.168.1.121
# services running in vm:
# - mongodb
# - mqtt server
# install ssh
sudo apt-get install openssh-server -y
# check service is up
sudo systemctl status ssh
# enable ssh service
sudo service ssh restart
# See port status
nmap [ip][host][domain]
nmap [ip][host][domain] -p [port] | grep -i tcp
# UFW status
sudo ufw status verbose
# set up basic UFW rules
sudo ufw deny incoming
sudo ufw default allow outgoing
# Defining allow rules
sudo ufw allow [service][port]
sudo ufw allow ssh
sudo ufw allow service
sudo ufw allow from [ip] to any port 22
sudo delete allow ..
# Enable UFW
sudo ufw enable
# test connection
ssh [user]@[ip][hostname]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment