dotnet / dotnet/dev-proxy

Automate configuring Dev Proxy certificate on Linux

Đang mở
#601 11 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
831
Fork
89
Merge trung bình
12 giờ 1 phút
Pull request đã merge (30 ngày)
23

Mô tả

### Description

Hey everyone,

I've been trying to get devproxy to work on Linux for HTTPS proxying, but I'm hitting a wall.
It works fine with HTTP, and on Windows, it's working as per the documentation.
However, when I switch to Linux, HTTPS isn't cooperating.

I even tried exporting the Windows certificate and adding it to the trusted root certificates on Linux, but no luck there.

I've checked the docs, but I can't seem to find a fix. Any help or advice would be greatly appreciated!

I tried on Ubuntu app (Windows 11 pro wsl2)
I tried on Ubuntu 18.04
I tried on a Docker container based on Ubuntu 22.04

Thanks!

### Expected behaviour

The devproxy binary should register a root certificate when --install-cert is used

### Actual behaviour

Any attempt to access a website through the proxy with HTTPS results with an error.

### Steps to reproduce

Install dev proxy on a Linux (ubuntu) environment following documented instructions.
```
cd ~/devproxy
./devproxy --install-cert --log-level trace
```
Output is:
```
Loading plugin RetryAfterPlugin from: /home/patrick/devproxy/plugins/dev-proxy-plugins.dll
Loading plugin GenericRandomErrorPlugin from: /home/patrick/devproxy/plugins/dev-proxy-plugins.dll
8 error responses loaded from /home/patrick/devproxy/devproxy-errors.json
Listening on 127.0.0.1:8000...
WARNING: Configure your operating system to use this proxy's port and address [127.0.0.1:8000](http://127.0.0.1:8000/)
Press CTRL+C to stop Dev Proxy

```
Open another terminal and try this:

```
wget -e use_proxy=yes -e https_proxy=https://127.0.0.1:8000/ https://jsonplaceholder.typicode.com/posts

```

The output:

```
Connecting to 127.0.0.1:8000... connected.
ERROR: cannot verify [jsonplaceholder.typicode.com](http://jsonplaceholder.typicode.com/)'s certificate, issued by ‘CN=Dev Proxy CA’:
Unable to locally verify the issuer's authority.
To connect to [jsonplaceholder.typicode.com](http://jsonplaceholder.typicode.com/) insecurely, use `--no-check-certificate'.
```

If we follow recommendation and add --no-check-certificate, it works

```
request GET https://jsonplaceholder.typicode.com/posts
api ╭ Passed through
╰ GET https://jsonplaceholder.typicode.com/posts
```

### Dev Proxy Version

0.15.0

### Operating system (environment)

Linux

### Shell

bash

### Configuration file

{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.15.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
},
{
"name": "GenericRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "genericRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://jsonplaceholder.typicode.com/*"
],
"genericRandomErrorPlugin": {
"errorsFile": "devproxy-errors.json"
},
"rate": 50,
"labelMode": "text",
"logLevel": "information",
"newVersionNotification": "stable"
}

### Additional Info

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện quy trình đã được ghi lại `./devproxy --install-cert --log-level trace` trên Linux và so sánh với hành vi trên Windows được mô tả trong issue. Kiểm tra cách entry point `--install-cert` xử lý việc tin cậy chứng chỉ, sau đó xác minh việc hoàn tất bằng yêu cầu HTTPS `wget` được cung cấp mà không có `--no-check-certificate`.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp
Lĩnh vực
cli, security
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.