Comments (3)
A bit more description of the problem along with a work-around:
Connect to blynk-cloud.com server:
const Auth = myAuthCodeString;
var options = {}; // no options needed to get default cert_path and server.crt
var blynk = new Blynk.Blynk(Auth, options);
In blynk-cloud.com case, blynk-nodejs.js
module's internal variables are as follows:
self.ca: [ '/path/to/blynk-library-js/certs/server.crt' ]
opts: {
"host": "blynk-cloud.com",
"port": 8441,
"servername": "blynk-cloud.com",
"rejectUnauthorized": false,
"family": 4,
"ca": [
{
"type": "Buffer",
"data": [
45,
45,
…, // remaining cert bytes
45,
10
]
}
]
Because the Blynk object calls tls.connect(opts, function() {…}
, the opts.ca
variable overrides the trusted CA certificates. (Incidentally, using self signed certificate for blynk-cloud.com seems less secure than it ought to be but that's another discussion.)
So, in the case of a blynk server running in your own domain using Let's Encrypt certificates there is no way to force Blynk object to call tls.connect()
with opts.ca === null
. In other words, there is no way to override the default CA override!
I have forked the library and have a workaround that modifies blynk-nodejs.js
module as follows:
if (self.ca) {
if (Buffer.isBuffer(options.ca)) {
opts.ca = options.ca;
} else {
opts.ca = self.ca.map(function(item){
return fs.readFileSync(item);
});
+ if (opts.ca[0].toString() === '') opts.ca = null; // added this line
}
}
To use the workaround you have to set options.certs_path = '/path/to/null/server.crt/file'
and place an empty file named 'server.crt' at that location. It's not pretty but it works.
from blynk-library-js.
Why is this issue not addressed in over a year? I have my own server and want to use SSL with lets encrypt certificates...
from blynk-library-js.
I am having this same issue, and I finally came across this. Thank you so much @guymcswain for the fix.
The app was able to connect, non-SSL was able to connect, everything else works just fine. The only thing that would not work was SSL from an RPi with this library.
That one line, along with adding the certs_path key (to /home/pi in my case) and "touch ~/server.crt" worked instantly.
This should be fixed by now - it's been almost 18 months, and it's been difficult to find the answer to this problem.
For potential finding by google scrapers: SSL not authorized when using Let's Encrypt on Blynk local server with blynk-library.js for nodejs
from blynk-library-js.
Related Issues (20)
- UTF8 values are not working. HOT 4
- Make an option to enable debug
- Fix to avoid disconnects when writing while not ready HOT 1
- OnOff GPIO read error for Raspberry Pi. HOT 1
- Auto-generate dist/blynk-espruino.js
- WidgetRTC? where isit ? HOT 1
- Espruino doesn't seems to work HOT 2
- Uncaught error on disconnect
- Lots of connect and disconnect, SSL not authorized, and crash HOT 5
- Application crashed: Cannot read property 'authorized' of null HOT 1
- digitalWrite GPIO pins with code HOT 2
- No longer connects HOT 1
- VM the host system is sleeping but still connect
- 'Blynk_App_Connected' event is not supported?
- Typenscript Blynk Definition
- SSL not authorized since yesterday... HOT 5
- is support Blynk.Edgent ?
- INVALID_TOKEN
- Library does not work at all with new version of Blynk (2.0)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynk-library-js.