Files
winget.pro/run/sslproxy
Farhan Alvi 19e4d1e048 Fix wrong paths in sslproxy.py
Thank you @farhansolodev for the PR!
2023-12-29 15:57:46 +01:00
..
2023-11-14 16:35:17 +08:00
2023-12-29 15:57:46 +01:00

SSL Proxy

winget only allows https:// sources. In production, you will have a web server such as Nginx that accepts https:// requests and forwards them to the winget.pro Python server.

The files in this directory provide a mini web server that can accept https:// requests and forwards them to a winget.pro instance that does not support https://. This is useful for development and testing.

Install the self-signed SSL certificate

The implementation here requires us to have a self-signed SSL certificate for localhost. localhost.pfx can be used for this purpose. It was created from these instructions. To install it, issue the following in a Powershell Admin prompt:

$password=ConvertTo-SecureString "12345" -asplaintext -force
Import-PfxCertificate -FilePath localhost.pfx Cert:\LocalMachine\My -Password $password -Exportable
Import-Certificate -FilePath localhost.cert -CertStoreLocation Cert:\CurrentUser\Root

To remove it later, run mmc, click File/Add or Remove Snap-in then Certificates/Add/My User account then Finish and again for Computer account. Then click OK. Then delete localhost expiring 2041 from Current User/Personal, Current User/Trusted Root Certification Authorities, and Local Computer/Personal.

Run the SSL proxy

Once you have installed the self-signed SSL certificate above, you can run the following command to start the SSL proxy:

python sslproxy.py

By default, this accepts SSL requests on port 8443 and forwards them to localhost on port 8000. You can use command-line arguments to change these parameters:

python sslproxy.py <local_port> <dest_host> <dest_port>