Skip to content

Conversation

@felixhuettner
Copy link

TLS on the grpc api can be used for authentication purposes. Previously gobgpd would only load the certificates on startup. If the server certificate of gobgpd or the client CA file changed the user would need to restart gobgpd.
When using short lived certificates (e.g. a few days) for security purposes this requires regular restarts of the gobgp daemon.

In order to make using such short lived certificates easier we introduce the "--tls-reload-interval" command line option. If set then the certificates will be reloaded from disk after the reload interval expires.

TLS on the grpc api can be used for authentication purposes. Previously
gobgpd would only load the certificates on startup. If the server
certificate of gobgpd or the client CA file changed the user would need
to restart gobgpd.
When using short lived certificates (e.g. a few days) for security
purposes this requires regular restarts of the gobgp daemon.

In order to make using such short lived certificates easier we introduce
the "--tls-reload-interval" command line option. If set then the
certificates will be reloaded from disk after the reload interval
expires.

Signed-off-by: Felix Huettner <[email protected]>
@fujita
Copy link
Member

fujita commented Sep 23, 2025

This should be a new gRPC API?

@felixhuettner
Copy link
Author

I can also add this via gRPC if desired. Then i would add something like

rpc ReloadCertificates(ReloadCertificatesRequest) returns (ReloadCertificatesResponse);

where the request and response objects are empty.
I guess then also a cli command would be helpful.

The drawback i see here is that this requires grpc authentication to work. If e.g. the grpc server certificate expired and only afterwards the file is updated there is no way to recover from this. You would then need to restart gobgpd.

In case of the timing implementation (or also something like inotify if desired) such situations are automatically recovered.

Let me know what you prefer

@fujita
Copy link
Member

fujita commented Sep 23, 2025

The drawback i see here is that this requires grpc authentication to work. If e.g. the grpc server certificate expired and only afterwards the file is updated there is no way to recover from this. You would then need to restart gobgpd.

Good point.

In case of the timing implementation (or also something like inotify if desired) such situations are automatically recovered.

The idea of periodically checking feels to me like an outdated practice from ancient software, and I’d prefer to avoid it. fnotify seems somewhat better than that. I think it would be more desirable to make gobgp command support reload for consistency with other commands, but if we don’t use gRPC, then we’d have to implement notifications to the process via a Unix domain socket or signals, which doesn’t seem like a very good approach.

I have no good idea.

@felixhuettner
Copy link
Author

We could also combine the approaches:

  • Add a cli + gRPC command to reload the certificates, that allows to reload on a user defined change
  • Use fnotify to automatically reload on file changes

fnotify should here cover nearly all cases. However if you e.g. store your certificate on NFS (whyever you would do so) then you could still manually reload them.

Or the more simple version would be combining cli + gRPC and the timing approach. But other than being more simple it has no benefit from my perspective

@fujita
Copy link
Member

fujita commented Sep 23, 2025

Ok, let's go with the fnotify approach.

We can add a gRPC API for this in the future if it ever becomes necessary.

@felixhuettner
Copy link
Author

ok, sounds good. Then i'll update this PR when i am ready

@felixhuettner felixhuettner marked this pull request as draft September 23, 2025 15:20
@fujita
Copy link
Member

fujita commented Sep 23, 2025

Please also add documentation about gRPC and certificates.

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

Successfully merging this pull request may close these issues.

2 participants