[google-appengine] Using AppCfg to update the app behind an authenticated proxy

127 views
Skip to first unread message

Piwaï

unread,
Apr 22, 2010, 6:38:27 AM4/22/10
to Google App Engine
Hello !

I have been looking through the web for quite some time, tried a lot
of things and didn't find any working solution to my problem, so I
wish someone here will have a solution for me :-) !

I am trying to deploy a GAE Java app, and I am going through a
corporate proxy, which requires authentication.

The proxy config looks like this :

user : DOMAIN\username
password : pass
http proxy : proxy_http.something.com:8000
https proxy : proxy_https.something.com:8000

I read this : http://code.google.com/appengine/docs/java/tools/uploadinganapp.html#Using_an_HTTP_Proxy

=> The values for --http_proxy and --proxy_https must match
"proxy_http.something.com:8000", and does not work when matching
"http://DOMAIN\username:pass@proxy_http.something.com:8000" =>
(unknown host)

I tried to set the proxy informations by modifying appcfg.cmd and
adding some java proxy arguments :

-Dhttp.proxyHost="http://DOMAIN
\username:pass@proxy_http.something.com" -Dhttp.proxyPort=8000
-Dhttps.proxyHost="http://DOMAIN
\username:pass@proxy_https.something.com" -Dhttps.proxyPort=8000

=> still unknown host error.

I also tried this :

-Dhttp.proxyHost="proxy_http.something.com" -Dhttp.proxyPort=8000
-Dhttp.proxyUser="DOMAIN\username" -Dhttp.proxyPassword=pass
-Dhttps.proxyHost="proxy_https.something.com" -Dhttps.proxyPort=8000
-Dhttps.proxyUser="DOMAIN\username" -Dhttps.proxyPassword=pass

The host is resolved but then it tries to use the proxy and gets an
Authentication failure exception.

Then I tried to call AppCfg.main myself, and the the proxy and Proxy
auth in the JVM prior to calling it :

public class Test {

public static void main(String[] args) {

Authenticator.setDefault(new ProxyAuthenticator("DOMAIN\
\username", "pass"));

System.setProperty("http.proxyHost",
"proxy_https.something.com");
System.setProperty("http.proxyPort", "8000");
System.setProperty("https.proxyHost",
"proxy_https.something.com");
System.setProperty("https.proxyPort", "8000");

String[] appArgs = { "update", "PATH TO MY WAR FOLDER" };

AppCfg.main(appArgs);
}

static class ProxyAuthenticator extends Authenticator {

private String user, password;

public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}

@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user,
password.toCharArray());
}
}

}

However, I still get the Authentication failure exception. Here is the
stacktrace :

Unable to update:
java.io.IOException: Authentication failure
at
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:
1402)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
168)
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:
836)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:
230)
at
com.google.appengine.tools.admin.ServerConnection.connect(ServerConnection.java:
340)
at
com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java:
133)
at
com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java:
82)
at
com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java:
559)
at
com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java:
376)
at
com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:
111)
at
com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:
56)
at com.google.appengine.tools.admin.AppCfg
$UpdateAction.execute(AppCfg.java:527)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:130)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:58)
at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54)
at com.googlecode.android_frameworks.server.Test.main(Test.java:20)
com.google.appengine.tools.admin.AdminException: Unable to update app:
Authentication failure
at
com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:
62)
at com.google.appengine.tools.admin.AppCfg
$UpdateAction.execute(AppCfg.java:527)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:130)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:58)
at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54)
at com.googlecode.android_frameworks.server.Test.main(Test.java:20)
Caused by: java.io.IOException: Authentication failure
at
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:
1402)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
168)
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:
836)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:
230)
at
com.google.appengine.tools.admin.ServerConnection.connect(ServerConnection.java:
340)
at
com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java:
133)
at
com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java:
82)
at
com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java:
559)
at
com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java:
376)
at
com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:
111)
at
com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:
56)
... 5 more

Seems that GAE uses a
sun.net.www.protocol.https.HttpsURLConnectionImpl, and it doesn't seem
to take the Authenticator into account.

Has anyone already achieved to upload java gae applications through an
authenticated proxy ? Any hint would be great !

Also, are the sources available ? I might soon try to retro-engineer
the com.google.appengine.tools.admin classes to understand how it
deploys the whole stuff...

Cheers,
Piwaï

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

Piwaï

unread,
Apr 23, 2010, 5:01:17 AM4/23/10
to Google App Engine
For the records : I have finally been able to deploy using a trick : I
used a local unauthenticated proxy to the corporate authenticated
proxy ;-) !

I installed "Charles Proxy", run it, configured the "External Proxy
Settings" part with my Auth informations. Then I configure appcfg
script to connect to the local proxy (localhost:8888). And voila, it
works !

On Apr 22, 12:38 pm, Piwaï <py.ri...@gmail.com> wrote:
> Hello !
>
> I have been looking through the web for quite some time, tried a lot
> of things and didn't find any working solution to my problem, so I
> wish someone here will have a solution for me :-) !
>
> I am trying to deploy a GAE Java app, and I am going through a
> corporate proxy, which requires authentication.
>
> The proxy config looks like this :
>
> user : DOMAIN\username
> password : pass
> http proxy : proxy_http.something.com:8000
> https proxy : proxy_https.something.com:8000
>
> I read this :http://code.google.com/appengine/docs/java/tools/uploadinganapp.html#...
> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Abstrac...
> 168)
>         at
> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection...
> 836)
>         at
> sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLCon...
> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Abstrac...
> 168)
>         at
> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection...
> 836)
>         at
> sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLCon...
Reply all
Reply to author
Forward
0 new messages