2
votes

I am running an Amazon Linux image on EC2. However, I cannot open port 443 when I launch my twisted server.

I created a security group and verified that the instance was using it which allowed traffic on HTTPS. (HTTPS tcp 443 443 0.0.0.0/0).

Here is the output:

ERROR:root:Exception launching the json rpc server
Traceback (most recent call last):
  File "start_ipns_proxy.py", line 27, in launch_json_rpc
    RPC_SSL_CERTIFICATE_FILE))
  File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/posixbase.py", line 444, in listenSSL
    p.startListening()
  File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/tcp.py", line 857, in startListening
    raise CannotListenError, (self.interface, self.port, le)
CannotListenError: Couldn't listen on any:443: [Errno 13] Permission denied.

It was working just fine on my local box, and when I change the port to 80 I still have the issue (HTTP was also in my security group). I also rebooted the instance and no luck.

EDIT:

Here is my netstat output
[ec2-user@domU-12-31-38-04-1E-EC push_notify]$ sudo netstat -nupt -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1559/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1592/sendmail: acce 
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1428/dhclient       
udp        0      0 10.220.29.22:123            0.0.0.0:*                               1572/ntpd           
udp        0      0 127.0.0.1:123               0.0.0.0:*                               1572/ntpd           
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               1572/ntpd
2

2 Answers

3
votes

You might be running the program that uses port lower than 1024. Try running the program using root or sudo.

0
votes

Do you have another server on the machine already listening on port 443? It sounds to me like the port is opened by another process so your process can't access it.