[LINUX] The story that I set transparent proxy and it worked for some reason without a certificate

This post Squid proxy - a short guide (forward & transparent proxy examples, SSL bumping, links to guides) -Reddit After setting transparent proxy with Squid referring to the above, it worked without adding the self-signed root certificate.

environment

PC: ThinkPad T490 Arch Linux Proxy with authentication Required environment Bringing HTTP Proxy built on Azure with SSH port forwarding Wi-Fi is skipped with create_ap, and smartphones use Drony to enable applications that do not support HTTP Proxy to communicate via Proxy.

From Manipulating Multiple Proxy with Squid -Qiita

Configuration file

Squid configuration file with proxy.server.jp: 8080 (provisional) and 0.0.0.0:8888 as parents:

/etc/squid/squid.conf


#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
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 SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
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

#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager

on_unsupported_protocol tunnel all
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

cache_peer proxy.server.jp parent 8080 0 no-query no-netdb-exchange no-digest login=USER:PASS
proxy-only
cache_peer 0.0.0.0    parent 8888 0 no-query no-netdb-exchange no-digest default

acl sorting time SMTWHF 1:00-6:00
acl blacklist dstdomain "/usr/local/etc/squid/blacklist"
acl blog url_regex blog
acl blacklist_day dstdomain "/usr/local/etc/squid/blacklist_day"

acl status http_status !200

http_port 7080 intercept
https_port 7443 intercept ssl-bump \
 generate-host-certificates=on \
 dynamic_cert_mem_cache_size=4MB \
 cert=/etc/squid/cert/myCA.pem \
 key=/etc/squid/cert/myCA.pem

acl step1 at_step SslBump1
acl step2 at_step SslBump2
acl step3 at_step SslBump3

#ssl_bump peek step1    # <- enabling this breaks it
ssl_bump stare step2
ssl_bump bump step3
# Uncommenting this may also break bumping.
#ssl_bump bump all
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
http_access allow all


# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3354
icp_port 0

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/cache/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/cache/squid

#
# Add any of your own refresh_pattern entries above these.
#
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

#Set if there is a sub Proxy

#Direct access to local network segments without going through the parent proxy
acl developersegments1 dst 192.168.0.0/24
always_direct allow developersegments1

never_direct allow all

#Do not cache
cache deny all

#cache_peer_access proxy.server.jp deny sorting
cache_peer_access proxy.server.jp deny blacklist sorting
cache_peer_access proxy.server.jp deny blog sorting
cache_peer_access proxy.server.jp deny blacklist_day
cache_peer_access proxy.server.jp deny status

Settings added with iptables A terminal (smartphone) is connected to ap0

iptables -t nat -A PREROUTING -i ap0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 7080
iptables -t nat -A PREROUTING -i ap0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 7443

Reason

_ ** † Under investigation of cause † ** _

Recommended Posts

The story that I set transparent proxy and it worked for some reason without a certificate
A story that I was very convinced when I wrote the code for the Monty Hall problem and calculated the winning percentage
A story that makes it easy to estimate the living area using Elasticsearch and Python
I made a tool that makes it convenient to set parameters for machine learning models.
I made a chatbot with Tensor2Tensor and this time it worked
It seems that some RHEL will be free with a big boo for the end of CentOS
I set the environment variable with Docker and displayed it in Python
I thought it would be slow to use a for statement in NumPy, but that wasn't the case.
I created a Slack bot that confirms and notifies AWS Lambda of the expiration date of an SSL certificate
The story of IPv6 address that I want to keep at a minimum
The story of making a box that interconnects Pepper's AL Memory and MQTT
Somehow the code I wrote worked and I was impressed, so I will post it
Note that I understand the least squares algorithm. And I wrote it in Python.
I bought Sipeed Lichee Zero so I set it up for the time being
Looking back on the machine learning competition that I worked on for the first time
[Python] A program that finds the minimum and maximum values without using methods
A story about cross-compiling a python package for AWS Lambda and deploying it serverless
I set up TensowFlow and was addicted to it, so make a note
I made a tool in Python that right-clicks an Excel file and divides it into files for each sheet.