unable to verify the first certificate - Nestjs - nestjs

I am calling an external Get method and getting this error "unable to verify the first certificate". How can I resolve it with Nestjs?

Pay the SSL certificate on the endpoint? Call http instead of https? Probably not a good question to ask here tbh

Related

How to Add certificate verification in python 3 on Ubuntu

I am trying to use hash-buster and making requests from my server to database's of hash-buster.
and each time I get this error:
Hash function : MD5
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning
I am new in python 3 also in Ubuntu(19.04). Please help me about adding certificate in my server, actually I need a step by step guide to install and activate it (or whatever).
I found my certifications in my server: (etc/ssl/certs/ca-certificates.crt). Is it possible to use my own certifications?
I hope my questions is clear, please feel free to ask me questions to make it clearer.
I am trying to use hash-buster....
I'm assuming that you mean this project.
... Unverified HTTPS request is being made. Adding
certificate verification is strongly advised. ...
The code contains the following line, which probably is the reason for this warning:
response = requests.get('https://www.nitrxgen.net/md5db/' + hashvalue, verify=False).text
So it is explicitly disabling certificate validation here with verify=False. Given that there are other HTTPS requests in the code and this one is the only one with certificate validation disabled, it is likely to work around a problem with the site.
And, the SSLLabs report for www.nitrxgen.net shows that that the site is not properly configured:
This server's certificate chain is incomplete. Grade capped to B.
This incomplete certificate chain causes requests to fail. To work around the broken site one need to either import the missing chain certificate in the trust store or have it explicitly trusted by the code.
Since there are many similar questions already I don't want to repeat all the details. See for example Python requests SSL error - certificate verify failed
, Python Requests getting SSLerror, SSL error with Python requests despite up-to-date dependencies for more.

self signed certificate error on electron js

I am making an app for my own use, when I try to post JSON to my PHP server at example.com, I get the following error:
Uncaught Error: self signed certificate error
I tried the following code and it works:
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0
but I believe this approach is dangerous. What is the safe way to solve this error? I tried googling but did not find anything useful or maybe because I am a beginner I did not understand it.
I assume your self signed cert is on example.com and wherever your posting from doesn't trust it.
You may want to check out this answer for how to create and use self signed certs from iOS, Android, and a browser.

Correct way to handle "Unable to Get Local Issuer Certificate" in an electron app

A node/electron app gets deployed on the end user's machine. It tries to make an HTTPS request to a server. Depending on the user's network setup, this may work fine, or Node may throw the error "Unable to Get Local Issuer Certificate". As far as I understand, this happens when the client is behind a proxy with SSL interception or something similar.
I know SO and github are full of questions like this. But the only generic "solution" I could find is breaking SSL entirely either at process level:
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0
or at request level:
rejectUnauthorized: "false"
There's also the option to somehow specify the correct certificate when making the HTTP request. But it seems to almost require custom setup for every user and I haven't found any examples of doing it in a generic way.
1. Why is this issue specific to Node apps, while every other app on the computer works fine?
2. Can it be fixed in a general and cross-platform way?

Node-RED and nodemailer - Error: unable to verify the first certificate

I am trying to make something very basic work and it just isn't working for me. I have a simple Node-RED flow with an inject input node and an email output node:
The properties of the email node look like this:
The error says:
"7/28/2017, 11:43:28 AM node: fname.lname#company.com
msg : error
"Error: unable to verify the first certificate"
I am able to manually send unauthenticated email through this server via telnet. Even if I enter account creds it gives me the same "Error: unable to verify the first certificate".
Am I missing something simple?
I don't have enough reputation to write a comment, but i am adding this line for the previous reply, somebody might need it,
to bypass this error in Node.js program, type:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
The problem is that the mail server you are connecting to is using SSL and the certificate it is supplying is not signed by one of the trusted CA's built into the Node.JS implementation you are using.
I'm guessing it's a self signed certificate.
The Error says that Node.JS can not verify the first certificate in the presented chain.
My best guess is that Nodemailer (which is used under the covers by the email node) is seeing the STARTTLS option listed when it sends the EHLO command as it starts the connection to the mail server and is trying to upgrade the connection to one that is secure.
While I really wouldn't normally recommend this, you can turn off Node.JS's cert checking by exporting the following environment variable before starting Node-RED:
NODE_TLS_REJECT_UNAUTHORIZED=0
This turns off ALL certificate checking, so you are open to man in the middle attacks for any TLS/SSL connection made from Node-RED.
The real solution here is to get a proper certificate for the mail server, maybe something from the letsencrypt project especially if this mail server is internet facing in any way.

How google found that the request is tampered or being interrupted

I started fiddler and when I tried to access google.com , I got the below error
It was able to find that, the request is coming from an untrusted tool or something like that. Can anyone please explain how they are doing it or any hint about it, so that, we could apply for our web sites.
Once I closed the fiddler, it started working fine again.
Thanks in advance
Jonathon
It's all explained in the "what does it mean" section: Fiddler has send your browser its own SSL certificate to be able to intercept the request (it –more or less– decrypts it using its certificate, then re-encrypts it using Google's one).
Chrome comes preloaded with public keys that it expects to see in the certificate chain for web sites, including of course google.* ones, so it can detect that Fiddler's certificate is not one coming from Google.
See http://blog.stalkr.net/2011/08/hsts-preloading-public-key-pinning-and.html

Resources