使用SSH通过带有SSL凸起的Squid连接到Git



我的目标是设置squid代理,只允许某些git存储库可以访问(路径(

我将Squid配置为使用SSL Bump来跟踪并允许一些基于路径的URL,我需要允许通过SSH进行git克隆,我的Squid的配置如下

http_access allow all
acl localnet src 0.0.0.1-0.255.255.255  # RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8     # RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10      # RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16     # RFC 3927 link-local (directly plugged) machines
acl localnet src 172.16.0.0/12      # RFC 1918 local private network (LAN)
acl localnet src 192.168.0.0/16     # RFC 1918 local private network (LAN)
acl localnet src fc00::/7           # RFC 4193 local private network range
acl localnet src fe80::/10          # RFC 4291 link-local (directly plugged) machines
acl whitelist url_regex "/etc/squid/whitelist.txt"
acl SSL_ports port 443
acl SSL_ports port 22
acl Safe_ports port 80      # http
acl Safe_ports port 21      # ftp
acl Safe_ports port 22          # ssh
acl Safe_ports port 443     # https
acl ssh_port port 22 # ssh
http_access allow ssh_port
acl Safe_ports port 70      # gopher
acl Safe_ports port 210     # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280     # http-mgmt
acl Safe_ports port 488     # gss-http
acl Safe_ports port 591     # filemaker
acl Safe_ports port 777     # multiling http
acl CONNECT method CONNECT
acl all src 0.0.0.0/0
http_access allow all
http_access allow ssh_port
http_access deny CONNECT !SSL_ports
http_access deny all
http_port 3128 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/myCA.pem  options=NO_SSLv2
sslcrtd_program /usr/local/squid/libexec/security_file_certgen -s /var/lib/ssl_db -M 4MB
always_direct allow all
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all
ssl_bump splice all
coredump_dir /var/spool/squid
refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern -i (/cgi-bin/|?) 0 0%  0
refresh_pattern .       0   20% 4320
sslproxy_cert_error allow all
sslproxy_flags DONT_VERIFY_PEER
strip_query_terms off
coredump_dir /var/spool/squid
refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern -i (/cgi-bin/|?) 0 0%  0
refresh_pattern .       0   20% 4320

在windows上,我使用以下openssh客户端配置设置了mingw

Host github.com
ServerAliveInterval 60
IdentitiesOnly yes
ProxyCommand /usr/bin/corkscrew 192.10.2.84 3128 %h %p ~/.ssh/id_rsa
IdentityFile   ~/.ssh/id_rsa
User           github
ForwardAgent   yes

我假设~/.ssh/id_rssa是github-ssh密钥?这种配置是对的还是错的?我不想把代理的ssh密钥放在客户端配置中

这是我的git-ssh-的输出

ssh git@github.com -Tvvv
OpenSSH_8.5p1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/developer/.ssh/config
debug1: /home/developer/.ssh/config line 1: Applying options for github.com
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/developer/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/developer/.ssh/known_hosts2'
debug1: Executing proxy command: exec /usr/bin/corkscrew 172.16.2.84 3128 github.com 22 ~/.ssh/id_rsa
debug1: identity file /home/developer/.ssh/id_rsa type 0
debug1: identity file /home/developer/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.5
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

将此行添加到配置:

acl SSL_ports port 22

最新更新