In order to manager in a easy way iptables on Debian machines please install iptables-persistent

apt install -y iptables-persistent
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

After we did added the required rules need to add the following in order to block.

##required to be added
iptables -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
iptables -A INPUT -j REJECT --reject-with icmp-proto-unreachable
iptables -P INPUT DROP

Once completed in order to save the updated rules please run the following command

dpkg-reconfigure iptables-persistent

PLEASE BE SURE TO HAVE OPENED THE SSH PORT YOU ARE LOGGED IN OR YOU WILL LOSE SESSIONS

To delete a rule please replace -A with -D

iptables -D INPUT -j REJECT --reject-with icmp-proto-unreachable

and than save the updated rules

dpkg-reconfigure iptables-persistent

Please note that adding new rules via iptables may end up after drop rules, so in order to fix this please open the file /etc/iptables/rules.v4 or /etc/iptables/rules.v6 and be sure to have the DROP rules last.