Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open port 443 by adding a rule in iptables (Ubuntu) [closed]

Im new to ubuntu and using ubuntu server 12.04. When I run nmap localhost I get the following output :

Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
3306/tcp open  mysql

This means that port 443(https) is closed. I want to open it. So I did the following :

I ran the command

sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

And to persist the changes I saved the file using sudo sh -c "iptables-save > /etc/iptables.rules"

and then I added the following lines to etc/network/interfaces :

pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules

After rebooting my system I ran sudo iptables -L and the line

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https

was visible.

However now when I run nmap localhost I still dont see 443 as open.

Please help!

like image 644
Archit Arora Avatar asked Dec 16 '22 01:12

Archit Arora


1 Answers

I bet you have nothing listening to port 443 on your host. Try this: in one terminal run sudo nc -lk 443 and then run your nmap localhost. This may not have anything to do with an iptables firewall rule.

like image 163
Red Cricket Avatar answered Dec 17 '22 14:12

Red Cricket