Sometime i am purchasing music on Google Music. Once i decided to download entire connection
and found that its not as easy as i exptected.
- With a browser you can download only album by album + it warns that download
counter is limited to 2 times only (WTF?!?)
- Recommended way to download is “Google Music Manager” which should do everything automatically.
Okay google, lets try to install it. It installs fine, but download failing completely. On the web i found
that it was that way > 1 year already! (e.g. see this thread.
Also i tried to use Google support and it was as useless as possible.
So there is nothing to do but to try to fix it myself.
Music Manager process name is
MusicManagerHelper. This is QT4 (!) application.
Output of the
lsof command shows that there is a log in the
Output shows that there is an error with certificate validation on every download attempt:
Failed to Verify Certificate: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.googleusercontent.com (unable to get local issuer certificate:0x00000000) [/Volumes/Android/buildbot/src/googleplex-android/jumper-stable/jumper/source/Shared/HttpClients/CurlHttpClientImpl.cpp:44 ::CurlSslVerifyCertificate()]
Ok, its better. Something i tried without any luck:
- Adding google certs to the system keychain with a
- Trying to find where its storing root certs (its compiled in)
- Trying to rebuild libQtNetwork 4 on OSX (seems to be completely broken with a recent compiler/sdk)
Finally, solving issue using LLDB
Using debugger i found that libQtNetwork contains statically compiled OpenSSL.
After all i been able to identify function responsible for the certificate validation – it is
Lets try to use
lldb to override it return value!
- Adding breakpoint with
breakpoint set -n ssl_verify_cert_chain --shlib libQtNetwork.4.dylibcommand.
- Attaching python script to the breakpoint:
breakpoint command add –script-type python
print "starting" thread = frame.GetThread() return_value = lldb.frame.GetValueForVariablePath("*self") thread.ReturnFromFrame(frame, return_value) print "ending" lldb.debugger.GetSelectedTarget().process.Continue() DONE
- Trying to download again. LLDB should print “starting” and “ending” on
any download and it finally works!
- Google is an Evil. I spent a lot of time to just download content i paid for! And support was completely useless.
- Google Music Manager, at least on OSX, is insecure, broken and outdated application.
- Putting root certificates to the bundle is a very poor coding style.
Not sure if it comes from QT or from Google itself, but doing that way is embedding timebomb to your app.
- Dtrace and LLDB are cool 🙂