如何让 squid 代理接受自签名证书?

如何让 squid 代理接受自签名证书?

我有一个用例,我必须在 Squid 中接受自签名证书。端点是使用自签名证书的 Kubernetes 集群。集群将根据需要使用不同的自签名证书重新创建,因此需要使用正则表达式、首选方式或全局方式接受它们以进行测试。

当前 Squid 版本为 6.0.0,使用以下标志进行编译:

Squid Cache: Version 6.0.0-VCS                                                                                                                                             
Service Name: squid                                                                                                                                                        
                                                                                                                                                                           
This binary uses OpenSSL 1.1.1  11 Sep 2018. For legal restrictions on distribution see https://www.openssl.org/source/license.html                                        
                                                                                                                                                                           
configure options:  '--prefix=/apps/squid' '--enable-icap-client' '--enable-ssl' '--with-openssl' '--enable-ssl-crtd' '--enable-security-cert-generators=file' '--enable-au
th' '--with-default-user=proxy'                                                                                                                                            

在我的测试中我使用了 ssl_bump 配置和 tls_outgoing_options:

http_port 8080 ssl-bump cert=/apps/squid/etc/ssl_cert/CA_crt.pem key=/apps/squid/etc/ssl_cert/CA_key.pem generate-host-certificates=on dynamic_cert_mem_cache_size=4MB 
sslcrtd_program /apps/squid/libexec/security_file_certgen -s /apps/squid/var/logs/ssl_db -M 4MB
sslcrtd_children 5
ssl_bump bump all
sslproxy_cert_error allow all
tls_outgoing_options options=ALL flags=DONT_VERIFY_PEER,DONT_VERIFY_DOMAIN

但我能取得的最好结果是_curl: (51) SSL: no alternative certificate subject name matches target host name

或者没有 ssl_bump

http_port 8080 ssl-bump cert=/apps/squid/etc/ssl_cert/CA_crt.pem key=/apps/squid/etc/ssl_cert/CA_key.pem generate-host-certificates=on dynamic_cert_mem_cache_size=4MB
sslcrtd_program /apps/squid/libexec/security_file_certgen -s /apps/squid/var/logs/ssl_db -M 4MB
sslcrtd_children 5
sslproxy_cert_error allow all
tls_outgoing_options options=ALL flags=DONT_VERIFY_PEER,DONT_VERIFY_DOMAIN

我明白了curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to

今天我需要 K8S 端点,但明天可能是任何其他端点,因此可能需要让 squid 创建欺骗 CN 的连接。

相关内容