gobgp icon indicating copy to clipboard operation
gobgp copied to clipboard

Proposal to bind gRPC API to localhost by default

Open pavel-odintsov opened this issue 2 years ago • 2 comments

Hello!

I just pulled latest gRPC 3.15.0 and noticed that it binds gRPC to 0.0.0.0 / :: by default and exposes API to wild world of the Internet:

tcp6       0      0 :::50051                :::*                    LISTEN      3234326/./gobgpd    

As you can see I did not use any arguments or options for it. I'm pretty sure that majority of new deployments starts similar way and they will be vulnerable to attacks and will be insecure by default.

We discussed this issue while ago and it was partially addressed here by providing command line argument to specify API bind host (--api-hosts="::1"): https://github.com/osrg/gobgp/issues/796

In this PR I changed default wildcard bind to :: which listens on all available interfaces to more specific IPv6 localhost ::1 which makes GoBGP secure by default.

Some may argue that not all servers have IPv6 connectivity but IPv6 localhost is available on all modern distributions.

Thank you!

pavel-odintsov avatar Jun 30 '23 15:06 pavel-odintsov

This is a big change since GoBGP accepts any from day one. But I guess that the more secure default configuration is better. So I could merge this with the major version updated. I guess that you need to fix some tests since they depend on this behavior.

fujita avatar Jul 01 '23 01:07 fujita

Query: how to correctly specify binding to both ::1 and 127.0.0.1?

Systems where IPv6 is disabled via net.ipv6.conf.all.disable_ipv6=1 won't have ::1

robbat2 avatar Jan 29 '24 18:01 robbat2