差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:squid [2024/04/12 16:42] – [使用 docker 方式] jonathantech:squid [2024/09/26 17:57] (目前版本) – 新增 0-Day Vulnerabilities 警告訊息 jonathan
行 1: 行 1:
 ====== Squid Proxy Server 安裝設定 ====== ====== Squid Proxy Server 安裝設定 ======
-====== 使用 docker 方式 ===== + 
-  * 採用 [[https://hub.docker.com/r/elestio/squid|elestio/squid 版本]] <cli>+<WRAP center round important 60%> 
 +  * 因為在 OpenVAS 主機弱掃會出現 **Squid Multiple 0-Day Vulnerabilities (Oct 2023)** 
 +  * 目前改用 [[tech/tinyproxy]] 來替代 Squid 
 +</WRAP> 
 + 
 +====== 使用 docker compose 方式 ===== 
 +  * 採用 [[https://hub.docker.com/r/ubuntu/squid|ubuntu/squid 版本]] <cli>
 vi docker-compose.yml vi docker-compose.yml
 </cli><file> </cli><file>
-version: '3' 
 services: services:
   squid:   squid:
-    image: elestio/squid:latest+    image: ubuntu/squid:latest
     hostname: squid     hostname: squid
-    environment:  +    container_name: squid 
-    #   SQUID_CONFIG_FILE=/etc/squid/squid.conf+    environment:  
 +      TZ=Asia/Taipei
     ports:     ports:
-    "3128:3128"+      - 3128:3128
     # volumes:     # volumes:
     #   - './conf/squid.conf:/etc/squid/squid.conf:ro'     #   - './conf/squid.conf:/etc/squid/squid.conf:ro'
行 20: 行 26:
 docker compose up -d docker compose up -d
 </cli> </cli>
-  * 採用 [[https://hub.docker.com/r/ubuntu/squid|Ubuntu/squid 版本]] <cli> +  - 將 squid.conf 掛出來進行後續設定編輯 <cli> 
-sudo docker run -d --restart=always --name squid-container -e TZ=UTC -p 3128:3128 ubuntu/squid:latest+mkdir -p conf 
 +docker cp squid:/etc/squid/squid.conf ./conf/
 </cli> </cli>
 +  - 修改 docker-compose.yml <file>
 +services:
 +  squid:
 +    image: ubuntu/squid:latest
 +    hostname: squid
 +    container_name: squid
 +    environment:
 +      - TZ=Asia/Taipei
 +    ports:
 +      - 3128:3128
 +    volumes:
 +      - './conf/squid.conf:/etc/squid/squid.conf:ro'
 +    #   - './conf/passwords:/etc/squid/passwords:ro'
 +    restart: always
 +</file>
 +  - 修改 squid.conf <cli>
 +vi ./conf/squid.conf</cli><file>
 +:
 +acl localnet src fe80::/10              # RFC 4291 link-local (directly plugged) machines
  
 +acl SSL_ports port 443 8006
 +acl Safe_ports port 8006        # PVE manager
 +acl Safe_ports port 80          # http
 +acl Safe_ports port 21          # ftp
 +acl Safe_ports port 443         # https
 +:
 +# For example, to allow access from your local networks, you may uncomment the
 +# following rule (and/or add rules that match your definition of "local"):
 +http_access allow localnet
 +:
 +</file>
 +  * 重新啟動 docker compose <cli>
 +docker compose restart
 +</cli>
  
 +==== Q1 : 如果要修改 container 內的 /etc/hosts ====
 +  * 參考 - https://stackoverflow.com/questions/74014600/custom-etc-hosts-file-in-dockerfile
 +  - 將 docker-compose.yml 內加上 extra_hosts:
 +  - 加上要指定的 hostname 與 IP 資訊 Exp. "www.ichiayi.com:192.168.11.133" "web.ichiayi.com:192.168.11.134"
 +  - 範例如下:<file>
 +services:
 +  squid:
 +    image: ubuntu/squid:latest
 +    hostname: squid
 +    container_name: squid
 +    environment:
 +      - TZ=Asia/Taipei
 +    extra_hosts:
 +      - "www.ichiayi.com:192.168.11.133" 
 +      - "web.ichiayi.com:192.168.11.134"
 +    ports:
 +      - 3128:3128
 +    volumes:
 +      - './conf/squid.conf:/etc/squid/squid.conf:ro'
 +    #   - './conf/passwords:/etc/squid/passwords:ro'
 +    restart: always
 +</file>
 +  - 重啟 docker compose <cli>
 +docker compose up -d
 +</cli>
  
  
- +====== 一般安裝程序 ======
- +
- +
- +
- +
-===== 一般安裝程序 =====+
 以下是在 CentOS 7 與 Ubuntu 20.04 底下安裝與設定 Squid Proxy Server 以下是在 CentOS 7 與 Ubuntu 20.04 底下安裝與設定 Squid Proxy Server
 ==== Ubuntu 20.04 ==== ==== Ubuntu 20.04 ====
  • tech/squid.1712911346.txt.gz
  • 上一次變更: 2024/04/12 16:42
  • jonathan