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

Ability to ignore hosts based on CONNECT request. #32

Closed
readefine opened this issue Sep 29, 2018 · 2 comments
Closed

Ability to ignore hosts based on CONNECT request. #32

readefine opened this issue Sep 29, 2018 · 2 comments
Labels

Comments

@readefine
Copy link

readefine commented Sep 29, 2018

Hello,

I have implemented the MITM as your example shows.
I have implemented a HttpFiltersSourceAdapter that has the method filterRequest.
I was hoping that returning null from the method would stop the filtering for certain hosts like appl/facebook. But i think the impersonation phase is still used when exchanging certificates.

How do I ignore hosts for use with apps that do their own SSL handshaking?

I have tried to make an alternative to the CertificateSniffing MitmManager. But i could not find a way to avoid returning a SSLEngine and thus skipping the interference.

So for some domains i would like the proxy to act as transparent.

@readefine
Copy link
Author

readefine commented Sep 29, 2018

I have used a number of HttpProxyServer instances, some transparent, some MITM to redirect traffic based on hostname. Using the ChainedProxyManager i can get it to work.

So my transparent proxy runs on 8080 and the MITM on 8081 and some hostnames are chained to FALLBACK_TO_DIRECT_CONNECTION, while others are passed to 8081 using the ChainedProxyAdapter.

Still i would like to ignore hosts from consideration. So some hosts should be considered as transparent. But other hosts can be filtered.

@ganskef
Copy link
Owner

ganskef commented Sep 22, 2019

I'm using this method HttpFiltersSourceAdapter.filterRequest(HttpRequest, ChannelHandlerContext) too. This is the right location to make host/URL based decisions. You have to return an HttpFilters implementation like an HttpFiltersAdapter which contains a lot of hooks. This is the place to do nothing, modify the pipeline like add/remove inflater or aggregator, modify/create response contents, perhaps handle the handshake. Its up to you to have different filters to chose in the filters source. In my use case, an offline proxy, I use 6 filters using the clientToProxyRequest(HttpObject) method to answer responses or returning null to pass unmodified processing, additionally serverToProxyResponse(HttpObject) to write the contents in the cache. I'm not familiar with your conditions, sorry. You have to dig into LittleProxy and Netty. Anyway I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants