Skip to content

Allow running sniproxy as a gateway #6

@grzech0

Description

@grzech0

root@dev4-20-tunapi:/usr/local/bin# ./sniproxy --dns-redirect-ipv4-to=127.0.0.1 --tls-port=3133 --http-port=3134 --forward-proxy=http://192.168.118.21:3128
2023/10/10 11:04:19 [info] cmd: run sniproxy with the following configuration:
{
"DNSListenAddress": "0.0.0.0",
"DNSPort": 53,
"DNSUpstream": "8.8.8.8",
"DNSRedirectIPV4To": "127.0.0.1",
"DNSRedirectIPV6To": "",
"DNSRedirectRules": [
"*"
],
"DNSDropRules": null,
"HTTPListenAddress": "0.0.0.0",
"HTTPPort": 3134,
"TLSListenAddress": "0.0.0.0",
"TLSPort": 3133,
"BandwidthRate": 0,
"BandwidthRules": {},
"ForwardProxy": "http://192.168.118.21:3128",
"ForwardRules": null,
"BlockRules": null,
"DropRules": null,
"Verbose": false,
"LogOutput": ""
}

grk@dev4-20-tunapi:~$ curl -Iv https://193.109.212.15 -k

  • Trying 193.109.212.15:443...
  • Connected to 193.109.212.15 (193.109.212.15) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt
  • CApath: /etc/ssl/certs
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 193.109.212.15:443
  • Closing connection 0
    curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 193.109.212.15:443

in sniproxy terminal output
...
2023/10/10 11:07:41 [info] sniproxy: [4] start tunneling to :443
2023/10/10 11:08:05 [info] sniproxy: [5] start tunneling to mail.google.com:443
...

in upstream squid access.log
...
1696928862.134 1 192.168.118.11 NONE/400 3861 CONNECT :443 - HIER_NONE/- text/html
1696928899.311 240197 192.168.118.11 TCP_TUNNEL/200 2748 CONNECT mail.google.com:443 - HIER_DIRECT/216.58.215.69 -
...

looks like fallback to TCP destination IP doesn't work properly, when in https connection there is no SNI field
when SNI field is present (https://mail.google.com) sniproxy works properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions