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

listen only on specific IP address #49

Closed
cyayon opened this issue Jan 29, 2016 · 10 comments
Closed

listen only on specific IP address #49

cyayon opened this issue Jan 29, 2016 · 10 comments

Comments

@cyayon
Copy link

cyayon commented Jan 29, 2016

Could it be possible to only listen on a specified IP address (like tcp port parameter) ?

thanks.

@ktsaou
Copy link
Member

ktsaou commented Jan 29, 2016

netdata needs some work in order to:

  1. Accept one or more IPv4 and/or IPv6 IP:PORT pairs to listen to.
  2. Possibly limit its access to specific clients (IPs, subnets).

These are not in my priority list (I have to spend some time learning how to do them properly).

If however, you (or anyone else) can provide a pull request, I'll be glad to merge it.

For the moment, you can limit it with a firewall / iptables statements. If you need such iptables statements, I can provide these to you.

@cyayon
Copy link
Author

cyayon commented Jan 29, 2016

Ok, thanks for your answer, it was just a suggestion ...
At the moment, i use iptables rule too.

I am not a good C programmer, but perhaps, i could try to submit you a patch to limit listening on an Ip address (at least IPv4).

@jameshhx
Copy link

I've been able to limit the address upon which at least the IPv4 server listens upon, by editing src/web_server.c, to name.sin_addr.s_addr = htonl (INADDR_LOOPBACK);.

I'll do some tinkering over the next few days, and see if I can get a PR in for this.

@ktsaou
Copy link
Member

ktsaou commented Mar 30, 2016

Perfect!

@herrernst
Copy link

If your host has IPv6, you probably also have to change in6addr_any to in6addr_loopback.

@ktsaou
Copy link
Member

ktsaou commented Apr 4, 2016

Just added this feature.
a44f489

Please test.
The configuration file now has the option bind socket to IP in section [global].

@ktsaou ktsaou added the fixed label Apr 4, 2016
@herrernst
Copy link

Works for my (I specify 127.0.0.1 and it only listens on this). You just can't listen on localhost4 and localhost6 at the same time, but that doesn't matter for me.
Thank you!

@ktsaou
Copy link
Member

ktsaou commented Apr 4, 2016

I think that when you listen on ::1 it also listens on 127.0.0.1.
But no the other way around.

At least on my tests...

@herrernst
Copy link

You're right, thanks!

@ktsaou
Copy link
Member

ktsaou commented Apr 5, 2016

ok, I close this.

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

4 participants