grpc / grpc/grpc-java

[netty] Refuse connections from certain clients (based on IP)

Aperta
#11,221 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

Hello there. I have a need to block certain clients from establishing a connection to the server (i.e. at the moment of tls handshake, based on their ip address)
I know a `ServerInterceptor` would work here, but I don't really want to make redundant checks every time a client executes a rpc

So far I've managed to proceed with proxy `X509ExtendedTrustManager` - I am able to close any inbound/outbound traffic during tls handshake.
But I am unable to retrieve ip address of the client from `SSLEngine` (`peerhost`/`peerport` is set to null there).
A little bit of debugging and I see that `io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators.ServerTlsHandler.handlerAdded()` instantiates a new `SSLEngine` without setting `peerhost`/`peerport`, though it has access to `channel` (which contains `remoteAddress`) from `ChannelHandlerContext` (curious whether it was done intentionally, if not and this is the only option I have left then I'm more than willing to make contribution to address it)

So, at this point I'm out of ideas what to do. Could anyone please guide me what my options are?
Thanks

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators.ServerTlsHandler.handlerAdded(), quindi esamina come viene creato il suo SSLEngine e come ChannelHandlerContext espone remoteAddress. Esamina l’interazione tra X509ExtendedTrustManager e SSLEngine descritta nell’issue. Il lavoro è completato quando viene stabilito se il filtraggio IP a livello di connessione durante TLS è supportato e, se una modifica è appropriata, quando questa viene coperta con un test mirato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
networking, security
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.