Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL Certificates not being trusted on unix environments #43

Open
replaysMike opened this issue Mar 29, 2022 · 5 comments
Open

Fix SSL Certificates not being trusted on unix environments #43

replaysMike opened this issue Mar 29, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@replaysMike
Copy link
Owner

I might need some help from the community on this one, as I've tried every way I could find in order to get a self-signed certificate to be trusted on ubuntu/linux. Firefox/Chrome still say the CA authority is not valid, and I'm not sure if there is something different about the certificate itself or the way browser certificate chains are validated on unix. Works fine on Windows.

I've tried the following:

sudo cp ./Certificates/Binner.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
sudo apt install libnss3-tools
pk12util -d sql:$HOME/.pki/nssdb -i ./Certificates/Binner.pfx
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n 'dev cert' -i ./Certificates/Binner.crt

and

apt-get install ca-certificates
sudo cp ./Certificates/Binner.crt /usr/share/ca-certificates
dpkg-reconfigure ca-certificates
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "Binner CA" -i ./Certificates/binner.crt
@replaysMike replaysMike added the enhancement New feature or request label Mar 29, 2022
@replaysMike replaysMike self-assigned this Mar 29, 2022
@kuifie210
Copy link

Hello ReplaysMike,

I've just installed the latest release of Binner.Web in my server and the program works fine!
What do you mean by "Firefox/Chrome still say the CA authority is not valid"?

I only got a warning about the self-signed certificate of my server. (Which is the default behaviour for a long time in Firefox)
Firefox let me choose to go away or make an exception for this certificate.

Also ran the install-certificate.sh command and it gives me the following output:

# ./install-certificate.sh
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping Binner.pem,it does not contain exactly one certificate or CRL
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

Adding debian:Binner.pem
done.
done.
Certificate was installed to trusted root at /usr/local/share/ca-certificates/Binner.crt

@replaysMike
Copy link
Owner Author

Hi @kuifie210 - yep the warning about the self signed certificate is the issue I’m noting in this ticket. On Windows I was able to add the cert to the trusted store and I don’t get any browser certificate validation warnings. On Unix environments however this process doesn’t seem to work as expected. Apparently it can vary with different Unix flavours and even vary among browsers.

You can of course just tell the browser to ignore the warning and all is good - as you saw with Firefox. Ideally however it would be nice to trust the certificate properly on install so that the warnings don’t come up and you get a nice little lock icon in the browser. My install script is supposed to be doing this by coping the certificate to ca-certificates folder, it just doesn’t work and you still get the warning.

@kuifie210
Copy link

Hi @replaysMike,

I'm sorry for my late response.
I think that it is only possible to have a valid certificate (and don't get the message in the browser) if the certificate is authorized by a external certification authority like letsencrypt. The problem with letsencrypt is the need of a domain name. Which is (I think) for most of the users to much hassle for their local workshop setup.

Another option is to import the certificate in every machine and/or browser you are using.
I've found some instructions on
https://develike.com/en/articles/adding-a-trusted-ssl-certificate-for-the-local-environment-in-apache-on-debian-ubuntu

At the moment I don't have the time to test this solution. But as far I can this solution should work for most of the users with linux server/client environments

@replaysMike
Copy link
Owner Author

Hi @kuifie210 thanks for the follow up. Yes the issue with self-signed localhost certificates is always about trusting the issuer. While it's certainly possible to script this on the Windows side (the Trusted root store is where you put them for the local computer to trust it) on Unix there are various ways to accomplish the same thing. It seems it varies quite a lot between different distros.

Thank's for the link you sent, hadn't seen that one. I'm going to try it out and if it works well, maybe I'll just distribute 2 different certificates as on the WIndows side I didn't generate it using openssl but rather through Powershell. There could very well be some subtle differences in how the certs are structured.

I'll keep you posted.

@mantered
Copy link

I'm getting this error in Chromium after a successful login,
Binner_linux-arm64-2.5.8 is running on Ubuntu 22.04, Raspberry Pi 4B and local Binner.db :

"An SSL certificate error occurred when fetching the script.",
"react_devtools_backend_compact.js:2367 Error during service worker registration: DOMException: Failed to register a ServiceWorker for scope ('https://localhost:8090/') with script ('https://localhost:8090/service-worker.js'): An SSL certificate error occurred when fetching the script."

I cannot delete any part from the inventory, this is the error I've got:

error

If I try to delete an image from Product Images, Pinout or Datasheet the X button doesn't show any dialog.
The delete dialog would show only when I'm uploading another image and I see in the background that the upload
was successful.
Could this be related to the ssl error ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants