[SOLVED] Trouble getting blynk-ser.sh to run (local server, Arduino with USB)

I’m working on trying to get my LED to blink on my Arduino with the blynk app. I have done this without a problem using the blynk.cc server. Now I’m trying to do it with a local blynk server. I have the server running; I can log in to the admin webpage; I can log in from the blynk iOS app. I have created a blynk project in the iOS blynk app with a single button to turn on and off the LED. I copy the auth token from this project and paste it into the appropriate area in the example blynk code (https://examples.blynk.cc/?board=Arduino%20Uno&shield=Serial%20or%20USB&example=GettingStarted%2FBlynkBlink) and then upload it to the Arduino over USB. Then I am running from terminal on my computer blynk-ser.sh. This is where I’m running into problems. I’ve tried lots of different settings, but what I think should be the right settings (sudo ./blynk-ser.sh -c /dev/tty.usbmodem1411 -b 9600 -s MY-SERVER.com -p 8441) (substituting in the url for my actual server of course ) gives the following error:

sudo ./blynk-ser.sh -c /dev/tty.usbmodem1411 -b 9600 -s MY-SERVER.com -p 8441
Resetting device /dev/tty.usbmodem1411...
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/tty.usbmodem1411,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:MY-SERVER.com:8441,cafile=/Users/david/Documents/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2017/07/04 10:22:02 socat[39224] N opening character device "/dev/tty.usbmodem1411" for reading and writing
2017/07/04 10:22:02 socat[39224] N opening connection to LEN=16 AF=2 47.222.187.173:8441
2017/07/04 10:22:02 socat[39224] N successfully connected from local address LEN=16 AF=2 192.168.1.100:60749
2017/07/04 10:22:02 socat[39224] E SSL_connect(): error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
2017/07/04 10:22:02 socat[39224] N exit(1)
Reconnecting in 3s...

I’ve also tried with -p 8443 (same error), -p 8441 (gives the error that socket closed by peer), and -p 8080 (which seems to work, says successfully connected, but in the blynk app on iOS it still says “Arduino UNO is offline”.

It looks like the problem is with the server certificate. I’ve tried this with my server.properties file listing certificates that I made with letsencrypt (which work fine to load the admin webpage for the local blynk server); and I’ve tried it with server.properties not listing anything (so that the local blynk server says it will use it’s own certs) and I get the same problem either way when running blynk-ser.sh.

I’m running a dietpi blynk installation on a raspberry pi 3 if it makes any difference. My blynkserver is running using the following command: /usr/bin/java -jar /etc/blynkserver/server.jar -serverConfig /mnt/dietpi_userdata/blynk/server.properties -dataFolder /mnt/dietpi_userdata/blynk/data/

I’m sure I’m missing something simple but can’t seem to figure it out. Thanks so much for your help!

Hello. Nice description. When you generated certificates for local server you have to change this line in blynk-ser.sh

and point it to fullchain.crt generated by the server. Hope this helps.

P. S. This is in case you got Let’s Encrypt certificates and not embedded.

@vshymanskyy by the way - do we need CLNT_CERT?

That did it! Yes! Thanks for saving me from hours of trying to figure this out :grinning:

By the way, I left CLNT_CERT unchanged and it works fine.

1 Like