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!

Archit Arora
  • 2,508
  • 7
  • 43
  • 69
  • What server have you configured to listen on port 443? – Douglas Leeder Feb 19 '14 at 07:32
  • This is _way_ off-topic for SO. Please delete and post on [sf]. – Jim Garrison Feb 19 '14 at 07: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 - Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... failed: Connection refused. – Archit Arora Feb 19 '14 at 07:37
  • You can find the exact scenario [here](http://stackoverflow.com/questions/21871964/bootstrapping-issues-in-chef) – Archit Arora Feb 19 '14 at 07:43

1 Answers1

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.

Red Cricket
  • 9,762
  • 21
  • 81
  • 166
  • 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. ? – Archit Arora Feb 19 '14 at 08: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. – Red Cricket Feb 19 '14 at 16:44