Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daphne always listening on 0.0.0.0 (-b ignored) #384

Closed
datavisyn-ro-v opened this issue Sep 27, 2021 · 1 comment
Closed

daphne always listening on 0.0.0.0 (-b ignored) #384

datavisyn-ro-v opened this issue Sep 27, 2021 · 1 comment

Comments

@datavisyn-ro-v
Copy link

(docs)
I start daphne like:

bin/daphne \
  -b 127.0.0.1 -e ssl:8001:privateKey=/.../cert.pem:certKey=/opt.../privkey.pem \
  NewRweb.asgi:application

but daphne keeps listeinig on 0.0.0.0:

2021-09-13 13:39:45,785 daphne.cli   INFO     Starting server at ssl:8001:privateKey=/.../cert.pem:certKey=.../privkey.pem, tcp:port=8000:interface=127.0.0.1
2021-09-13 13:39:45,786 daphne.server INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2021-09-13 13:39:45,786 daphne.server INFO     Configuring endpoint ssl:8001:privateKey=/.../cert.pem:certKey=/.../privkey.pem
2021-09-13 13:39:45,791 daphne.server INFO     Listening on TCP address 0.0.0.0:8001
2021-09-13 13:39:45,791 daphne.server INFO     Configuring endpoint tcp:port=8000:interface=127.0.0.1
2021-09-13 13:39:45,791 daphne.server INFO     Listening on TCP address 127.0.0.1:8000

and

# netstat -putan|grep 8001
tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      11161/python

how can I restrictc daphne to localhost?

my daphne version is
python 3.8.2
daphne 3.0.1
channels 3.0.2

@apollo13
Copy link
Member

Hi @datavisyn-ro-v, -b only affects the default port. If you also pass in -e you have to explicitly specify the interface like this:

-e ssl:8001:interface=127.0.0.1:privateKey=key.pem:certKey=cert.pem 

Then the output while be:

2021-12-12 20:20:07,452 INFO     Starting server at ssl:8001:interface=127.0.0.1:privateKey=key.pem:certKey=cert.pem, tcp:port=8000:interface=127.0.0.1
2021-12-12 20:20:07,452 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2021-12-12 20:20:07,453 INFO     Configuring endpoint ssl:8001:interface=127.0.0.1:privateKey=key.pem:certKey=cert.pem
2021-12-12 20:20:07,455 INFO     Listening on TCP address 127.0.0.1:8001
2021-12-12 20:20:07,455 INFO     Configuring endpoint tcp:port=8000:interface=127.0.0.1
2021-12-12 20:20:07,455 INFO     Listening on TCP address 127.0.0.1:8000

@carltongibson carltongibson closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants