I am using MobileFirst version 6.3.0 and I am trying to setup MobileFirst server to run in only https mode. Essentially, this means I need to have a self signed certificate generated on the server side and also have the certificate installed on my Android device for the app to work.
I have setup MobileFirst server to run only on port 10443 and am able to see that the chrome browser (from my android device) is able to access https://<server>:10443/worklightconsole
without warning me about accessing an untrusted website [I take this as confirmation that the certificate was installed properly on the mobile device]. However, I see that the android app I generated from MobileFirst is not able to connect to the server (I don't think this is a connectivity issue because when I build the app to use http://<server>:10080
, the app works well. It only fails when I rebuild the app to use https://<server>:10443
.
I followed the instructions as mentioned in the MFP documentation to create a self-signed certificate [http://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.installconfig.doc/admin/t_updating_keystore_liberty.html?lang=en]
Let me detail out the exact steps I followed:
Server side changes:
- Remove httpPort="10080" from server.xml so that the server runs only on port 10443
- Create a self-signed certificate for the server. I used openssl to generate a self-signed certificate. First, create certificate and private key files with the command "openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt"
- Next, create a keystore file that zips the certificate and key into one file with the command "openssl pkcs12 -export -in certificate.crt -inkey privateKey.key -out server.p12 -passout pass:passServerP12 -passin pass:passServer"
- Configure mfp server to use the new keystore I generated above. Essentially, copy the server.p12 file to "MobileFirstServerConfig\servers\worklight\resources\security" under the workspace directory
- Remove (or comment out)
<keyStore id="defaultKeyStore" password="worklight"/>
in server.xml - Ensure that
<feature>ssl-1.0</feature>
is set under<featureManager>
Add the following lines
<ssl id="mySSLSettings" keyStoreRef="myKeyStore"/> <keyStore id="myKeyStore" location="server.p12" password="passServerP12" type="PKCS12"/> <sslDefault sslRef="mySSLSettings"/>
- Build the mobile app with build settings set to
https://<server>:10443
and deploy it in mfp server
Mobile device side changes:
- Download the certificate (certificate.crt generated above) onto the mobile device. Install the file and accept the certificate on the device.
- Ensure that this certificate is now trusted by the mobile device and the browsers by accessing
https://<server>:10443/worklightconsole
on the chrome browser. This step proceeded to my according to the screenshots shown here: http://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSHS8R_6.3.0/com.ibm.worklight.installconfig.doc/admin/t_installing_root_CA_android.html . - Download the app onto the device and it should start contacting the server at
https://<server>:10443
.
While step 2 above worked for me well, step 3 is where things are not working. Essentially, the chrome browser is picking up the certificate, while the mobile app is not.
Is there something I need to do while building the mobile app in Eclipse so that it will pick up trusted (and self-signed) certificates from the android device?