Назад | Перейти на главную страницу

Установка Squid по умолчанию не прослушивает порт 3128

Невозможно установить Squid по умолчанию, прослушивая его порт по умолчанию tcp / 3128.

Squid версии 3.5.27, работающий на Ubuntu 18.04.4 LTS

Настроить

apt install squid -y
service squid start

Конфигурация по умолчанию

root@proxy:/etc/squid# cat /etc/squid/squid.conf | grep -v ^# | grep -v ^$
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
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access deny all
http_port 3128
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 (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .               0       20%     4320

Прослушивание портов

root@proxy:~# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      31074/sshd
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      9102/systemd-resolv
udp        0      0 0.0.0.0:43440           0.0.0.0:*                           30521/(squid-1)
udp        0      0 127.0.0.53:53           0.0.0.0:*                           9102/systemd-resolv
udp        0      0 0.0.0.0:68              0.0.0.0:*                           9094/systemd-networ
udp6       0      0 :::47733                :::*                                30521/(squid-1)

Устранение неполадок, часть 1

Таким образом, установка по умолчанию не работает, я добавляю несколько новых портов 3129, 3130, 3131 с множеством общих опций.

root@proxy:/etc/squid# cat /etc/squid/squid.conf | grep -v ^# | grep -v ^$
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
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access deny all
http_port 3128
http_port 3129 transparent
http_port 0.0.0.0:3130
http_port 0.0.0.0:3131 transparent
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 (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .               0       20%     4320

Устранение неполадок прослушивающих портов

root@proxy:~# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      31074/sshd
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      9102/systemd-resolv
udp        0      0 0.0.0.0:57748           0.0.0.0:*                           30521/(squid-1)
udp        0      0 127.0.0.53:53           0.0.0.0:*                           9102/systemd-resolv
udp        0      0 0.0.0.0:68              0.0.0.0:*                           9094/systemd-networ
udp6       0      0 :::53094                :::*                                30521/(squid-1)

Устранение неполадок, часть 2

Предыдущий был неудачным, поэтому запустить squid на переднем плане и указать точный измененный файл конфигурации

root@proxy:/etc/squid# service squid stop && pkill squid && sleep 1 && squid -N -d 9 -f /etc/squid/squid.conf
2020/06/05 06:55:27| Set Current Directory to /var/spool/squid
2020/06/05 06:55:27| Starting Squid Cache version 3.5.27 for x86_64-pc-linux-gnu...
2020/06/05 06:55:27| Service Name: squid
2020/06/05 06:55:27| Process ID 4430
2020/06/05 06:55:27| Process Roles: master worker
2020/06/05 06:55:27| With 1024 file descriptors available
2020/06/05 06:55:27| Initializing IP Cache...
2020/06/05 06:55:27| DNS Socket created at [::], FD 9
2020/06/05 06:55:27| DNS Socket created at 0.0.0.0, FD 10
2020/06/05 06:55:27| Adding nameserver 127.0.0.53 from /etc/resolv.conf
2020/06/05 06:55:27| Adding domain members.linode.com from /etc/resolv.conf
2020/06/05 06:55:27| Logfile: opening log daemon:/var/log/squid/access.log
2020/06/05 06:55:27| Logfile Daemon: opening log /var/log/squid/access.log
2020/06/05 06:55:27| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2020/06/05 06:55:27| Store logging disabled
2020/06/05 06:55:27| Swap maxSize 0 + 262144 KB, estimated 20164 objects
2020/06/05 06:55:27| Target number of buckets: 1008
2020/06/05 06:55:27| Using 8192 Store buckets
2020/06/05 06:55:27| Max Mem  size: 262144 KB
2020/06/05 06:55:27| Max Swap size: 0 KB
2020/06/05 06:55:27| Using Least Load store dir selection
2020/06/05 06:55:27| Set Current Directory to /var/spool/squid
2020/06/05 06:55:27| Finished loading MIME types and icons.
2020/06/05 06:55:27| HTCP Disabled.

Устранение неполадок прослушивающих портов

root@proxy:~# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      31074/sshd
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      9102/systemd-resolv
udp        0      0 0.0.0.0:52552           0.0.0.0:*                           30521/(squid-1)
udp        0      0 127.0.0.53:53           0.0.0.0:*                           9102/systemd-resolv
udp        0      0 0.0.0.0:68              0.0.0.0:*                           9094/systemd-networ
udp6       0      0 :::56473                :::*                                30521/(squid-1)

Все еще не слушаю tcp / 3128, tcp / 3129, tcp / 3130, tcp / 3131.

Неудачный.