Squid proxy 설정 - Squid proxy seoljeong

Skip to navigation Skip to main content

Utilities

  • Subscriptions
  • Downloads
  • Containers
  • Support Cases

Squid proxy 설정 - Squid proxy seoljeong

Infrastructure and Management

  • Red Hat Enterprise Linux
  • Red Hat Virtualization
  • Red Hat Identity Management
  • Red Hat Directory Server
  • Red Hat Certificate System
  • Red Hat Satellite
  • Red Hat Subscription Management
  • Red Hat Update Infrastructure
  • Red Hat Insights
  • Red Hat Ansible Automation Platform

Cloud Computing

  • Red Hat OpenShift
  • Red Hat CloudForms
  • Red Hat OpenStack Platform
  • Red Hat OpenShift Container Platform
  • Red Hat OpenShift Data Science
  • Red Hat OpenShift Online
  • Red Hat OpenShift Dedicated
  • Red Hat Advanced Cluster Security for Kubernetes
  • Red Hat Advanced Cluster Management for Kubernetes
  • Red Hat Quay
  • OpenShift Dev Spaces
  • Red Hat OpenShift Service on AWS

Storage

  • Red Hat Gluster Storage
  • Red Hat Hyperconverged Infrastructure
  • Red Hat Ceph Storage
  • Red Hat OpenShift Data Foundation

Runtimes

  • Red Hat Runtimes
  • Red Hat JBoss Enterprise Application Platform
  • Red Hat Data Grid
  • Red Hat JBoss Web Server
  • Red Hat Single Sign On
  • Red Hat support for Spring Boot
  • Red Hat build of Node.js
  • Red Hat build of Thorntail
  • Red Hat build of Eclipse Vert.x
  • Red Hat build of OpenJDK
  • Red Hat build of Quarkus

Integration and Automation

  • Red Hat Process Automation
  • Red Hat Process Automation Manager
  • Red Hat Decision Manager

All Products

Red Hat Training

A Red Hat training course is available for RHEL 8

Squid는 콘텐츠를 캐시하여 대역폭과 부하 웹 페이지를 더 빠르게 줄이는 프록시 서버입니다. 이 장에서는 HTTP, HTTPS 및 FTP 프로토콜에 대한 프록시로 Squid를 설정하는 방법과 인증 및 액세스 제한에 대해 설명합니다.

8.1. 인증 없이 캐싱 프록시로 Squid 설정

이 섹션에서는 인증 없이 캐싱 프록시로 Squid의 기본 구성에 대해 설명합니다. 이 절차에서는 IP 범위를 기반으로 프록시에 대한 액세스를 제한합니다.

사전 요구 사항

  • 이 절차에서는 /etc/squid/squid.conf 파일이 squid 패키지에서 제공하는 것으로 가정합니다. 이전에 이 파일을 편집한 경우 파일을 제거하고 패키지를 다시 설치합니다.

절차

  1. squid 패키지를 설치합니다.

    # yum install squid
  2. /etc/squid/squid.conf 파일을 편집합니다.

    1. 프록시를 사용할 수 있어야 하는 IP 범위와 일치하도록 localnet ACL(액세스 제어 목록)을 조정합니다.

      acl localnet src 192.0.2.0/24
      acl localnet 2001:db8:1::/64

      기본적으로 /etc/squid/squid.conf 파일에는 localnet ACL에 지정된 모든 IP 범위의 프록시를 사용할 수 있는 http_access allow localnet 규칙이 포함되어 있습니다. http_access allow localnet 규칙 전에 모든 localnet ACL을 지정해야 합니다.

      사용자 환경과 일치하지 않는 기존 acl localnet 항목을 모두 제거합니다.

    2. 다음 ACL은 기본 구성에 존재하며 HTTPS 프로토콜을 사용하는 포트로 443 을 정의합니다.

      acl SSL_ports port 443

      사용자가 다른 포트에서도 HTTPS 프로토콜을 사용할 수 있어야 하는 경우 다음 각 포트에 대한 ACL을 추가합니다.

      acl SSL_ports port port_number
    3. acl Safe_ports 규칙 목록을 업데이트하여 Squid가 연결을 설정할 수 있는 포트를 구성합니다. 예를 들어 프록시를 사용하여 클라이언트가 포트 21(FTP), 80(HTTP) 및 443(HTTPS)의 리소스에만 액세스할 수 있도록 구성하려면 구성의 다음 acl Safe_ports 문만 유지합니다.

      acl Safe_ports port 21
      acl Safe_ports port 80
      acl Safe_ports port 443

      기본적으로 구성에는 Safe_ports ACL에 정의되지 않은 포트에 대한 액세스 거부를 정의하는 http_access deny! Safe_ports 규칙이 포함됩니다.

    4. cache_dir 매개변수의 캐시 유형, 캐시 크기 및 추가 캐시 유형별 설정을 구성합니다.

      cache_dir ufs /var/spool/squid 10000 16 256

      다음 설정이 필요합니다.

      • squid는 ufs 캐시 유형을 사용합니다.
      • squid는 해당 캐시를 /var/spool/squid/ 디렉터리에 저장합니다.
      • 캐시가 10000 MB까지 증가합니다.
      • squid는 /var/spool/squid/ 디렉터리에 16 level-1 하위 디렉터리를 생성합니다.
      • squid는 각 level-1 디렉토리에 256 개의 하위 디렉터리를 생성합니다.

        cache_dir 지시문을 설정하지 않으면 Squid가 캐시를 메모리에 저장합니다.

  3. cache_dir 매개변수에서 /var/spool/squid/ 와 다른 캐시 디렉터리를 설정하는 경우:

    1. 캐시 디렉토리를 생성합니다.

      # mkdir -p path_to_cache_directory
    2. 캐시 디렉토리에 대한 권한을 구성합니다.

      # chown squid:squid path_to_cache_directory
    3. 강제 모드에서 SELinux를 실행하는 경우 캐시 디렉터리에 squid_cache_t 컨텍스트를 설정합니다.

      # semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?"
      # restorecon -Rv path_to_cache_directory

      시스템에서 semanage 유틸리티를 사용할 수 없는 경우 policycoreutils-python-utils 패키지를 설치합니다.

  4. 방화벽에서 3128 포트를 엽니다.

    # firewall-cmd --permanent --add-port=3128/tcp
    # firewall-cmd --reload
  5. squid 서비스를 활성화하고 시작합니다.

    # systemctl enable --now squid

검증 단계

프록시가 올바르게 작동하는지 확인하려면 curl 유틸리티를 사용하여 웹 페이지를 다운로드합니다.

# curl -O -L "https://www.redhat.com/index.html" -x "proxy.example.com:3128"

curl 에 오류가 표시되지 않고 index.html 파일이 현재 디렉터리로 다운로드된 경우 프록시가 작동합니다.

  1. Previous
  2. Next