Please anyone help i am getting TLS Error (Got TLS error trying to find package abc at https://pub.dev)
Its self-hosted on corporate environment where i use corporate proxy, and in function i am also adding proxy env variables too.
Python functions do work but this pub.dev dependencies gives me TLS error
Summary
Developers are facing TLS errors while building a Dart function with Dart pub get. To resolve this, they can use the `--root-certs-file` flag in the function's `appwrite.json` or have the certificate available at an HTTP endpoint for the init script to pull it from there during installation. Adding certificates to the `appwrite_certificates` volume will not work because it only holds certificates Appwrite serves, not those it recognizes. The discussion also involves issues with proxies and MITM (Man-in-the-Middle) attacks. Emphasis is placed on ensuring correct proxy configurations and understanding the implications of MITM in such instances
D5
Apr 4, 2024, 07:39
Does the instance have an internet connection?
Samiullah
Rank 2: Process
Apr 4, 2024, 07:41
Yes i have provided environment variables of corporate proxy in docker and in functions environment variables too.
Should i give u screenshots?
D5
Apr 4, 2024, 07:42
For now not needed. You ran docker compose up -d after updating the variables, right?
Samiullah
Rank 2: Process
Apr 4, 2024, 07:43
Yes
Samiullah
Rank 2: Process
Apr 4, 2024, 07:44
Btw in which containers should i exactly add proxy variables?
Samiullah
Rank 2: Process
Apr 5, 2024, 06:25
I hv set proxy on machine too and internet is working so no issues on host machine
ideclon
Quality
Apr 14, 2024, 19:25
Is your proxy doing some kind of MITM?
Samiullah
Rank 2: Process
Apr 14, 2024, 19:29
What does it mean? I hv no idea about MITM
ideclon
Quality
Apr 14, 2024, 19:37
MITM is Man-in-the-Middle. It's when something between you and the server (in this case, the proxy server) is looking at your SSL traffic. To do this, it needs the SSL session between you and itself to use it's own certificate, instead of a valid certificate your computer would recognise.
ideclon
Quality
Apr 14, 2024, 19:38
Does your org give you an SSL certificate you need to install on your devices to use them on the network?
Samiullah
Rank 2: Process
Apr 14, 2024, 19:39
I hv added certificates they gave me certificate nd I added it in the appwrite_certificates volume doesn't affected
ideclon
Quality
Apr 14, 2024, 19:40
The appwrite_certificates volume just holds certificates Appwrite serves, not certificates Appwrite will recognise.
Samiullah
Rank 2: Process
Apr 14, 2024, 19:40
So where should i add that?
ideclon
Quality
Apr 14, 2024, 19:41
I have no idea
Samiullah
Rank 2: Process
Apr 14, 2024, 19:41
Outside docker i already added that certificate and i can browse pub.dev
ideclon
Quality
Apr 14, 2024, 19:42
You'll need to have the runtime container trust the cert, somehow
Samiullah
Rank 2: Process
Apr 14, 2024, 19:42
I m stuck like more than 1 month no one is giving any solution i hv tried almost everything i can
Samiullah
Rank 2: Process
Apr 14, 2024, 19:43
I can't find how does appwrite build the runtime container such that i can add the certificate in the beginning everytime
ideclon
Quality
Apr 14, 2024, 19:45
On build, Appwrite runs whatever you set in the commands key for that function in your appwrite.json
Samiullah
Rank 2: Process
Apr 14, 2024, 19:46
Any idea how can I give the certificate in appwrite.json
ideclon
Quality
Apr 14, 2024, 19:48
You could either put it inside your Function, or you could have it available at a HTTP endpoint and have the init script pull it from there to install
Samiullah
Rank 2: Process
Apr 14, 2024, 19:50
Inside a function how is it possible, u mean i add that inside functions directory nd make a cmnd to copy that .cer file to the linux certification paths?
ideclon
Quality
Apr 14, 2024, 19:59
You'll probably need to convert it to a .crt, and then you should be able to put it into /usr/local/share/ca-certificates/, set permissions 644 and run update-ca-certificates.
ideclon
Quality
Apr 14, 2024, 20:00
Can you also try using the --root-certs-file flag like so - dart --root-certs-file=[CA.crt] pub ... ?