OpenShift Node.js CERT_UNTRUSTED - node.js

Note: this has nothing to do with NPM (which is what comes up the most when googling this error):
I have a Node server which is trying to make https calls to a IIS/.Net server. My understanding is that when my Node server is playing the part of the "client" I don't need to attach any certificates to the options (var Request = Https.request(Options, function(Response) { ... }); ), however, recently when the IIS/.Net server updated its certificates, Node started throwing CERT_UNTRUSTED errors.
The obvious culprit is the IIS.Net server and/or its certificates, however, that server can be successfully reached by non-Node servers (or fiddler, for example).
The other oddity is that all this code was working fine till the certificates on the IIs.Net server expired and were reset.
Thanks in advance!

I got this to work using the answer found at a similar post:
Unable to verify leaf signature
Still not sure why renewing the certificates caused this to happen, but either way, the ssl-root-cas/latest module did the trick.

Related

Nginx:504 Gateway Timeout

I am using Nginx as my https server to serve my http content from my node server.
I am also hosting my server on google cloud.
I have been keep getting a 504 Gateway Timeout Error; So I wonder if it is because I didnt set my upstream server (node server) 8080 port open. Then it works. Not so sure if it is the correct way to do it
But then I kept looking other docs or tutorial online. I never see people configure in such way to connect to node server. They mainly only left the port 80 opened. So I wondered if my config in server block causing the 504 gateway problem
----------second update
this is my setting, and the default_server is written by default
but i always see doc have included a variable - server_name ; Actually I dont quite understand this varibale. May I know should I consider it or not for later use, although it works now
Aside, I got an
Server Error from my app.
FetchError: request to https://34.96.213.54:443/search/guest2 failed, reason: self-signed certificate
Why is that it works on chrome,although I get that api directly and postman successfully.
third updated------
About self-signed certificate: You need to buy one or using a free service like https://letsencrypt.org .Beside that your questions are so basic so you have to research more on nginx docs (http://nginx.org/en/docs/http/server_names.html)

Problem with OpenSSL on Catalina using node.js [duplicate]

I'm using the node-request module, regularly sending GET requests to a set of URLs and, sometimes, getting the error below on some sites.
Error: 29472:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:683
The problem is that I don't get this error always or always on the some URLs, just sometimes. Also, it can't be ignored with "strictSSL: false".
I have read that this can be related to me sending SSL requests with the wrong protocol (SSLv2, SSLv3, TLS..). But this doesn't explain why it happens irregularly.
Btw, I'm running nodejs on a Win 2008 server.
Any help is appreciated.
You will get such error message when you request HTTPS resource via wrong port, such as 80. So please make sure you specified right port, 443, in the Request options.
This was totally my bad.
I was using standard node http.request on a part of the code which should be sending requests to only http adresses. Seems like the db had a single https address which was queried with a random interval.
Simply, I was trying to send a http request to https.
I got this error because I was using require('https') where I should have been using require('http').
Some of the sites are speaking SSLv2, or at least sending an SSLv2 server-hello, and your client doesn't speak, or isn't configured to speak, SSLv2. You need to make a policy decision here. SSLv2 should have vanished from the face of the earth years ago, and sites that still use it are insecure. However, if you gotta talk to them, you just have to enable it at your end, if you can. I would complain to the site owners though if you can.
I had this problem (403 error for each package) and I found nothing great in the internet to solve it.
My .npmrc file inside my user folder was wrong and misunderstood.
I changed this npmrc line from
proxy=http://XX.XX.XXX.XXX:XXX/
to :
proxy = XX.XX.XXX.XXX:XXXX
var https = require('https');
https.globalAgent.options.secureProtocol = 'SSLv3_method';
I got this error while connecting to Amazon RDS. I checked the server status 50% of CPU usage while it was a development server and no one is using it.
It was working before, and nothing in the connection configuration has changed.
Rebooting the server fixed the issue for me.
So in Short,
vi ~/.proxy_info
export http_proxy=<username>:<password>#<proxy>:8080
export https_proxy=<username>:<password>#<proxy>:8080
source ~/.proxy_info
Hope this helps someone in hurry :)
in my case (the website SSL uses ev curves) the issue with the SSL was solved by adding this option ecdhCurve: 'P-521:P-384:P-256'
request({ url,
agentOptions: { ecdhCurve: 'P-521:P-384:P-256', }
}, (err,res,body) => {
...
JFYI, maybe this will help someone
I got this error, while using it on my rocketchat to communicate with my gitlab via enterprise proxy,
Because, was using the https://:8080 but actually, it worked for http://:8080

NodeJS Not Receiving BigCommerce Webhooks

During development, I tunnelled all the my product/created and product/updated post requests through ngrok to my localhost and everything was working fine, but once in awhile I noticed it might miss a hook and not receive it, but this problem happens almost all the time in production for me on both my stores.
The moment I switched everything to production, I deleted the old hooks, re registered them using the live domain, and when I request a list of registered web hooks, I can see that they are active from the "is_active" flags. But for some weird reason, when I go through the same workflow as I did during development, I don't see any of the post requests being received by my server at all, but once in awhile, I might see 1 get received and my server will do its thing with that hook.
I thought it might have had something to do with my SSL/TLS setup, so I went to https://www.ssllabs.com/ to do a quick test. Everything was graded A, the only thing that I noticed was that my certificate #2 or my CA bundle was not trusted for whatever the reason. So I actually removed the CA cert from my server and only used my RSA/Cert instead for the credentials. However, in another PHP app that we made for BigCommerce, it is using the same type of certificate generated as the one that I'm using right now through LetsEncrypt, and in that PHP app all the hooks are received properly.
Given all this, I still can't seem to quite pinpoint where the problem lies. When I tunnelled everything through NGROK, I registered the hooks to the https url given to me, https://xxxx.ngrok.io -> localhost. Then on my node server, I created a server using http instead of https to avoid 502 bad gateway conflicts. So the only differences is me switching from using ngrok to my own https using https.createserver.
Any ideas on what the problem might be?
https
.createServer(
{
key: app.get('RSA_KEY'),
cert: app.get('SSL_CRT'),
ca: app.get('SSL_CA')
},
app
)
.listen(HTTPS_PORT, async function() {
... some code
})
app is express.router()

Node.js https does not work in Cloud9

I can create an http server and it works fine, but as soon as I try to use https instead, the server runs without errors but I cannot connect to it at all.
HTTP (working):
http.createServer(app).listen(process.env.PORT, process.env.IP);
HTTPS (not working):
var options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt')
};
https.createServer(options, app).listen(process.env.PORT, process.env.IP);
There are no errors in either method, but when I use HTTPS, there is no response when visiting the webpage and the server acts like it's not even receiving a request. Is there something wrong with the port I'm using from the Cloud9 environment? I have tried for hours to figure out what the problem is but haven't made any progress, hopefully someone can help out.
I'm afraid HTTPS will currently not work on Cloud9, as this requires the usage of other ports that are currently not opened for security reasons. We're working on a solution for this, but this will not be available on the short term yet.
For now, I recommend using two sets of configuration for development and production environments: the development environment can then just use HTTP, and production environments can use HTTPS.
Please keep an eye on our Twitter feed and blog for updates on this!

SocketIO4NET with SSL

Getting "error initializing handshake" with the SocketIO4Net library when I try to connect using my https node/socket.io connection over SSL. Is SSL/WSS supported with SocketIO4Net?
SocketIO4Net with plain http works, and standard Socket.IO in JavaScript over plain http and over https SSL works. But not SocketIO4Net with SSL, yet. Must be missing something, but challenge debugging this one.
The source seems to indicate the message "Error Initializing handshake" means it's missing the socket id when it tries to connect to the node/socket server. Any ideas?
Got SocketIO4Net to work with SSL too. Needed to import the Self-Signed Cert into the Cert Auth chain on our QA middleware box that was running SocketIO4Net and calling our node server. Works great now!

Resources