Skip to content

Commit

Permalink
Fixed Android 5+ using Netty 4.1.0.CR2-SNAPSHOT documented.
Browse files Browse the repository at this point in the history
  • Loading branch information
ganskef committed Feb 7, 2016
1 parent 4aced85 commit 8fb7c92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ like this in your `FiltersSource` implementation:

### Workarounds for Known Problems

* HTTPS fails with Exception: Handshake has already been started on Android Version 5+ (https://github.com/netty/netty/issues/4718). It's possible to use the Netty 4.1 branch (4.1.0.CR1-SNAPSHOT) with one line commented out: https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1266. This is not perfect, but it works with Android 5.0, 5.1, and 6.0.
* HTTPS fails with Exception: Handshake has already been started on Android Version 5+ (https://github.com/netty/netty/issues/4718). It's fixed with [PR #4767](https://github.com/netty/netty/pull/4764). Using Netty 4.1.0.CR2-SNAPSHOT MITM works well with Android 5.0, 5.1, and 6.0, just as Java platforms too.

* Connection failure with some HTTPS sites like https://www.archlinux.org/ for example. You have to use [Java Cryptography Extension](http://en.wikipedia.org/wiki/Java_Cryptography_Extension) to fix it.
```
Expand Down

5 comments on commit 8fb7c92

@karthikarunach
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
Iam trying to port littleproxy-mitm to my Samsung Galaxy S5 android phone. I had used below code configurations

  1. LittleProxy-mitm latest release
  2. io netty version - 4.0.34.Final
  3. My client code looks like below
    try {
    // Create an SSLContext that uses our TrustManager
    SSLContext context = SSLContext.getInstance("TLS");
    TrustManager[] trustManagers = InsecureTrustManagerFactory.INSTANCE
    .getTrustManagers();
    context.init(null, trustManagers, null);
                 // Tell the URLConnection to use a SocketFactory from our SSLContext
                URL url = new            URL("https://www.google.com");
                HttpsURLConnection urlConnection = (HttpsURLConnection)url.
                        openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888))); //Updated littleproxy-mitim default proxy server to listen to port - 8888
                urlConnection.setSSLSocketFactory(context.getSocketFactory());
                urlConnection.connect();
            }
            catch (Exception ex)
            {
                Log.e(TAG,"Failed to establish SSL connection to server: "+ ex.toString());

            }

Error Faced - Iam getting a gateway timeout error..When i checked pcap logs, client hello , server hello negotiations are happening. Also observed that some fields in client hello request are not populated(like Extension-Server). I included littleproxy-mitm pem as user trusted certificate

Can you pls let me know if any additional configuration has to be included to make it work on Android phone?

@ganskef
Copy link
Owner Author

@ganskef ganskef commented on 8fb7c92 Feb 29, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthikarunach
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Frank
Thx for your suggestion..
I used Netty 4.1.0.CR3 and bouncycastle 1.54 on my Samsung S5. But still iam getting the gateway timeout error. Is there any additional 3rd party library dependancy involved here?

Request sent out
CONNECT www.google.com:443 HTTP/1.1
Host: www.google.com
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0; SM-G900I Build/LRX21T)
content-length: 0
Via: 1.1 localhost

Response Received
HTTP/1.1 504 Gateway Timeout
Content-Length: 15
Content-Type: text/html; charset=UTF-8

@ganskef
Copy link
Owner Author

@ganskef ganskef commented on 8fb7c92 Mar 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthikarunach it works for me with bcprov-jdk15on-1.51.jar, bcpkix-jdk15on-1.51.jar and Netty 4.1.0.CR3 on some Android 4 ... 6 devices.

Hmm, please answer:

@ganskef
Copy link
Owner Author

@ganskef ganskef commented on 8fb7c92 Mar 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never used an URLConnection based client on Android. I'm using a Mozilla browser which provides the possibility to set the proxy settings and to import a pem file by an add-on.
You could try to set withAllowLocalOnly(false) in the Bootstrap and use the proxy with an external client.
I use logback-android-classic-1.1.1-2.jar, logback-android-core-1.1.1-2.jar to get log files.

Please sign in to comment.