[Q] Android + PHP + SSL issues - Android Q&A, Help & Troubleshooting

Hey Everyone,
I recently downloaded and installed "PHP for Android." I created a .php file that utilizes an SSL connection with port 2195. When I tried running it, I get the following error message:
HTML:
Error:14094410:SSL routines:func(148):reason(1040) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): Failed to enable crypto in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
This is my line 19:
"$apns = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);"
I researched what "reason(1040)" means, and supposedly it means that the port is closed. But what firewall is blocking it? The same exact script works when I execute it from my computer from the same wifi connection. Could it be a firewall inside the Android OS?
Any input will be greatly appreciated!!
Thanks!

Does anyone know?

Hey,
We also got that error with the iPhone Push service, and it was due to the certificate not being set correctly (actually the certificate file didn't exist).
I hope this solves your problem if you haven't solved it by now.
Regards,
Chris

Related

android app: network access for external programs

Dear All,
I am trying to develop an app which calls a external program (written in C) using Runtime.getRuntime().exec method. This program is basically an gstreamer based rtsp server and it works good if I run from the android command prompt. However, when I run the program from the app, I am getting the following error.
Failed to bind socket (Permission denied)
I had given the network access in my AndroidManifest.xml file.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
I also tried this
String cmd = "ping localhost";
Runtime.getRuntime().exec(cmd);
for which I got
ping: icmp open socket: Operation not permitted
I also tried to run an another program from an app (which shows an image on the android screen - surfaceflinger sink). So, I included android.permission.ACCESS_SURFACE_FLINGER in the manifest file. However, it wasn't able to display on surfaceflinger sink.
So, I have a feeling that these permissions are not passed on to these external programs. Is there a way to achieve this? I don't want to convert these 'C' based programs to Java. Can anyone please help me out.
Thanks,
Krishnan

[Q] Error in establishing openvpn connection on Toshiba Thrive (Android 3.2.1)

Hello All,
I have been searching for a solution to the below mentioned issue all over the net since last one month and finally referred to this forum by my vpn service provider 'cyberghostvpn'.
I am enclosing my config file (test.ovpn.txt), log file(log.txt) & sample password file for 'auth-user-pass' (pass.txt).
Following are the highlighted points regarding this issue :
While the same config file is working fine on my linux machine on android the same is stopping at the prompt "Enter Auth Username :". After entering username the connection sequence continues but the prompt "Enter Auth Password :" never comes like linux.
Hence my analysis is that the openvpn binary is unable to pass my the username-passowrd combination to my vpn server in the console input mode and an auth-failure control message is received shortly later terminating the connection.
If I pass the username-passord combination through the password file as 'auth-user-pass pass.txt' then also the same thing happens (an auth-failure control message is received terminating the connection).
In linux both of these methods are working successfully in establishing the connection proving that there is nothing wrong with cyberghostvpn.
One important point is though on android the openvpn binary is unable to read the config from the .ovpn file, it runs when the options are given as command line arguments as shown below and the enclosed log file is generated in this method.
# openvpn --client --ca ca.crt --cert my_user_name.crt --key my_user_name.key --remote ch.openvpn.cyberghostvpn.com 9081 ..........--tun-mtu 1500 --fragment 1300 --mssfix > log.txt
Anyone who can either help me resolving this issue or refer it to some expert developer on openvpn will be very much appreciated.
Kind regards,
kingsukm

[Q] MySQL on Webtop

Hi
I tried to install AMP(apache, mysql, php5) since I was interested on using Atrix as a web server.
Apache was success, but MySQL was failure. No MySQL, No PHP5(of course)
I tried force installing Busybox using dpkg expecting to be updated(version stayed same), removing and making directories that makes the problem, No luck.
I think it's related to my outdated Busybox(readlink?) There's too many problems here.
Lot of people just say "it's impossible" but why not? At least I want to know why it fails.
I have terminal log below. Sorry for bad, bad english.
Thanks
[email protected]:/$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
obconf leafpad lxde-common linux-libc-dev lxrandr pcmanfm lxde-core lxappearance gpicview libc6-dev lxpanel
lxde-settings-daemon xarchiver
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 120 not upgraded.
3 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up mysql-server-5.0 (5.1.30really5.0.75-0ubuntu10.5) ...
* Stopping MySQL database server mysqld [ OK ]
mkdir: cannot create directory `/var/log/mysql': No such file or directory
dpkg: error processing mysql-server-5.0 (--configure):
subprocess post-installation script returned error exit status 1
Setting up libapache2-mod-php5 (5.2.6.dfsg.1-3ubuntu4.6) ...
readlink: invalid option -- 'q'
BusyBox v1.10.2 (Ubuntu 1:1.10.2-2ubuntu7) multi-call binary
Usage: readlink [-f] FILE
Display the value of a symlink
Options:
-f Canonicalize by following all symlinks
ucf: Unable to determine The new file
dpkg: error processing libapache2-mod-php5 (--configure):
subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of php5-mysql:
php5-mysql depends on phpapi-20060613+lfs; however:
Package phpapi-20060613+lfs is not installed.
Package libapache2-mod-php5 which provides phpapi-20060613+lfs is not configured yet.
dpkg: error processing php5-mysql (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.0
libapache2-mod-php5
php5-mysql
E: Sub-process /usr/bin/dpkg returned an error code (1)
Click to expand...
Click to collapse
vctshim said:
Hi
I tried to install AMP(apache, mysql, php5) since I was interested on using Atrix as a web server.
Apache was success, but MySQL was failure. No MySQL, No PHP5(of course)
I tried force installing Busybox using dpkg expecting to be updated(version stayed same), removing and making directories that makes the problem, No luck.
I think it's related to my outdated Busybox(readlink?) There's too many problems here.
Lot of people just say "it's impossible" but why not? At least I want to know why it fails.
I have terminal log below. Sorry for bad, bad english.
Thanks
Click to expand...
Click to collapse
Hi, could you solve the issue? I wan to install it too, for my work.
Thanks!
douglasroos said:
Hi, could you solve the issue? I wan to install it too, for my work.
Thanks!
Click to expand...
Click to collapse
I found out it is impossible. Many repos are dead and crucially Ubuntu in this is outdated (without LTS)
I sold the Atrix and bought ARM-based Open PCs (e.g. Raspberry Pi, Cubieboard, Beaglebone Black, Udoo, etc..)
If you want low-power web server, this might be the way to go
(Ubuntu Phone might work but I'm not sure YET)

[Q] Make a private Caldav server work

Hi, I recently purchased the ZTE Open C and want to synchronize its calendar with my own Caldav server.
Firefox rejects the connection tough, because the server has an invalid (self signed) certificate.
So i tried adding my certificate to firefox.
I found this guide:
http : // wiki . mozfr . org / Adding_CA_to_FirefoxOS
(Sorry for inserted spaces, won't let me post a link in first post.)
However I fail in the very first steps.
Code:
adb shell ls /data/b2g/mozilla/
Returns: /data/b2g/mozilla/: Permission denied
This means I dont have reading rights in this directory.
How do I get those rights, or alternativeley is there a better way to achieve my Caldav-Server goal?
Mathews123 said:
Hi, I recently purchased the ZTE Open C and want to synchronize its calendar with my own Caldav server.
Firefox rejects the connection tough, because the server has an invalid (self signed) certificate.
So i tried adding my certificate to firefox.
I found this guide:
http : // wiki . mozfr . org / Adding_CA_to_FirefoxOS
(Sorry for inserted spaces, won't let me post a link in first post.)
However I fail in the very first steps.
Code:
adb shell ls /data/b2g/mozilla/
Returns: /data/b2g/mozilla/: Permission denied
This means I dont have reading rights in this directory.
How do I get those rights, or alternativeley is there a better way to achieve my Caldav-Server goal?
Click to expand...
Click to collapse
You cannot use that method unless your phone is rooted, BUT...
I had the same problem and solved it a lot easier. Just launch the browser and input your server's URL. Then you will be warned about the not valid cert, add a permanent exception and that's all, now calendars should sync over HTTPS.
BTW this worked for me until FFOS v1.4. Today I updated to FFOS 2.1 and this trick stopped working, so you have been warned.
Thank you for the suggestion.
I am not running v2.0, so I tried it.
I could add the certificate.
However, when trying to connect, I get:
"Unknown Error. Please try again later."
Any way to figure out what's wrong now?
Seems to be a problem with the server I used. (Baikal)
Using a different one (Owncloud - sadly quite a lot bigger), it works with your tip.
So thanks for the help.
to ged rid of the "unknown error" in Caldav (etc.?)
doragasu said:
I had the same problem and solved it a lot easier. Just launch the browser and input your server's URL. Then you will be warned about the not valid cert, add a permanent exception and that's all, now calendars should sync over HTTPS.
Click to expand...
Click to collapse
thank you so much :victory:

Certificate error when trying to establish email account connection

I am trying to connect an email app (AquaMail) on my phone (Sprint Samsung Note 4, stock rooted, Android OS 5.0.1) to my email server (IMAP) using SSL. When I try this, I get the following error message:
Incoming mail server (IMAP): Invalid security (SSL) certificate. java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
The server to which I am trying to connect is my own VPS. I do have a wild card certificate installed on the site and I believe it is installed properly. I say this because of the report I generated on www.ssllabs.com/ssltest:
Certificate: 100%
Protocol Support: 95%
Key Exchange: 90%
Cipher Strength: 90%
Two certification paths are shown: mail.mydomain.com -> StartCom Class 2 Primary Intermediate Server CA -> StartCom Certification Authority (one path shows this with SHA1withRSA and the other shows SHA256withRSA).
Looking at the Handshake Simulation section, it clearly shows that Android 5.0.0 functions properly, but is also shows that Java 7u25 has a 'protocol or cipher suite mismatch'. This same warning shows up for other, deprecated systems and is probably due to my having turned off older, insecure access protocols.
Can anyone suggest how to get this working properly? Yes, I could work around this by a) allowing all certificate or b) not using secure protocols; but neither of these are solutions.
Thank you for your help!

Categories

Resources