My goal is to setup squid proxy to allow only certain git repositories to be accessible (path)
I configured Squid to to use SSL Bump to trace and allow some URLs based on paths , I need to allow git clone via SSH, my squid configuration is as follows
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
on windows I setup mingw with the following openssh client configuration
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
I am assuming that ~/.ssh/id_rsa is the github ssh key? is this configuration right or wrong? I don't want to put ssh keys of the proxy in client configurations
here is the output of my git ssh
ssh [email protected] -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
Add this line to config:
acl SSL_ports port 22
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With