justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.93k stars 612 forks source link

Cant load certificate as a service #738

Open yuvalpikel opened 4 years ago

yuvalpikel commented 4 years ago

Hi I am using the Web Proxy as a service to decrypt https but i am getting this error : [1/23/2020 12:57:28 PM]Unhandled Exception in ProxyServer, Exception = System.Exception: Failed to make system trust root certificate for Root\CurrentUser store location. You may need admin rights. ---> System.Security.Cryptography.CryptographicException: The request is not supported.

at System.Security.Cryptography.X509Certificates.X509Store.Add(X509Certificate2 certificate) at Titanium.Web.Proxy.Network.CertificateManager.installCertificate(StoreName storeName, StoreLocation storeLocation) --- End of inner exception stack trace --- [1/23/2020 12:57:28 PM]Unhandled Exception in ProxyServer, Exception = System.Exception: Failed to make system trust root certificate for Root\CurrentUser store location. You may need admin rights. ---> System.Security.Cryptography.CryptographicException: The request is not supported.

at System.Security.Cryptography.X509Certificates.X509Store.Add(X509Certificate2 certificate) at Titanium.Web.Proxy.Network.CertificateManager.installCertificate(StoreName storeName, StoreLocation storeLocation) --- End of inner exception stack trace ---

How can i fix it ?

honfika commented 4 years ago

does your service has an admin right?

1st solution is to give them admin 2nd: trust the certificate manually

yuvalpikel commented 4 years ago

Thanks ,

  1. My service run as a local system , is that enough?
  2. How can it be achieved (Sorry , i am not familiar with it)

On Thu, Jan 23, 2020 at 1:26 PM honfika notifications@github.com wrote:

does your service has an admin right?

1st solution is to give them admin 2nd: trust the certificate manually

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/justcoding121/Titanium-Web-Proxy/issues/738?email_source=notifications&email_token=AHWDTARRJAJQMYJFSNIZTXTQ7F5FJA5CNFSM4KKUQZN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJXBVPY#issuecomment-577641151, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWDTAVV7BJVN3LJFDS3LTDQ7F5FJANCNFSM4KKUQZNQ .

honfika commented 4 years ago

1: I thought it is enough, but I never tried to run in a service... maybe somebody else can answer.

2: https://success.outsystems.com/Support/Enterprise_Customers/Installation/Install_a_trusted_root_CA__or_self-signed_certificate

sideup66 commented 4 years ago

Hi, I ran into this problem myself experimenting wih a service. In my application, its going to need to have the cert pre installed as i do not think it will be good user design to ask the user every time the proxy starts....easiest way to clear this is to install the cert into your root certificate folder as the computer account, then launch your proxy. When it does the user certificate check, even if the certificate is not installed, it will not matter, as it is registered to the system, which supercedes any user configured settings.

yuvalpikel commented 4 years ago

Thanks man.. I will try it Have you used any special methods with the proxy in order to work as a service?

On Sat, Feb 1, 2020 at 10:38 PM sideup66 notifications@github.com wrote:

Hi, I ran into this problem myself experimenting wih a service. In my application, its going to need to have the cert pre installed as i do not think it will be good user design to ask the user every time the proxy starts....easiest way to clear this is to install the cert into your root certificate folder as the computer account, then launch your proxy. When it does the user certificate check, even if the certificate is not installed, it will not matter, as it is registered to the system, which supercedes any user configured settings.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/justcoding121/Titanium-Web-Proxy/issues/738?email_source=notifications&email_token=AHWDTAU2FZNSNJRG65BVKTLRAXMTRA5CNFSM4KKUQZN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRGDDI#issuecomment-581067149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWDTAVRE42IKPTAHJJMJHLRAXMTRANCNFSM4KKUQZNQ .

yuvalpikel commented 4 years ago

image

After i've loaded the root certificate it is still not working .. Can you look at the image to make sure i did it right ?

sideup66 commented 4 years ago

Hi, yes, looks like your cert is in the right place. Sorry for late reply. I have not been able to run it as a service so far. let me know if you have any development

nkochnev commented 4 years ago

I have started windows service via my domain account. It's bad decision, but it works