4

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!

4
  • What server have you configured to listen on port 443? Feb 19, 2014 at 7:32
  • This is way off-topic for SO. Please delete and post on Server Fault. Feb 19, 2014 at 7:36
  • Im trying to bootstrap this machine to a chef server. the chef server instructs this machine to download some software from www.opscode.com. When it tries to connect to www.opscode.com I get and error saying - <machine's IP> Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... failed: Connection refused. Feb 19, 2014 at 7:37
  • You can find the exact scenario here Feb 19, 2014 at 7:43

1 Answer 1

12

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.

2
  • Yes you are absolutely right. Any idea what the problem might be? why Am i getting Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... failed: Connection refused. ? Feb 19, 2014 at 8:59
  • Sounds like you expect something, https, to be listening on port 443,so I would look at your web server's configuration and documentation. Feb 19, 2014 at 16:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.