zhonger/squid

By zhonger

Updated almost 3 years ago

Image

158

Project to deploy Squid with docker

Introduction

Install and run an Squid instance with docker.

You can use LDAP authentication or like an open proxy

By default, if you don't set environment variable, Squid is on open proxy mode

Deploy witch CLI

Deploy Squid on open proxy mode

docker run --name squid --hostname squid -p 3128:3128 -d diouxx/squid

Deploy Squid with LDAP Authentication

LDAP
docker run --name squid --hostname squid -e LDAP_ENABLE=true -e LDAP_HOST=yourldap.domain.com -e LDAP_PORT=389 -e LDAP_BindDN="cn=admin,dc=yourdomain,dc=com" -e LDAP_BindPass="********" -e LDAP_DN="ou=Users,dc=yourdomain,dc=com" -e LDAP_ATTRIBUT="uid=%s" -e PROXY_NAME="Proxy Display Name" -p 3128:3128 -d diouxx/squid
LDAPS
docker run --name squid --hostname squid -e LDAP_ENABLE=true -e LDAP_HOST=yourldap.domain.com -e LDAP_PORT=636 -e LDAP_BindDN="cn=admin,dc=yourdomain,dc=com" -e LDAP_BindPass="********" -e LDAP_DN="ou=Users,dc=yourdomain,dc=com" -e LDAP_ATTRIBUT="uid=%s" -e PROXY_NAME="Proxy Display Name" -p 3128:3128 -d diouxx/squid

Deploy with docker-compose

You can deploy squid docker with docker-compose.

Deploy Squid on open proxy mode

version: '3.2'

services: 
  squid:
    image: zhonger/squid
    container_name: squid
    hostname: squid
    ports:
      - "3128:3128"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    restart: always

Deploy Squid with LDAP Authentication

LDAP
version: '3.2'

services: 
  squid:
    image: zhonger/squid
    container_name: squid
    hostname: squid
    ports:
      - "3128:3128"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment: 
      - LDAP_ENABLE=true
      - LDAP_HOST=yourldap.domain.com
      - LDAP_PORT=389
      - LDAP_BindDN="cn=admin,dc=yourdomain,dc=com"
      - LDAP_BindPass="********"
      - LDAP_DN="ou=Users,dc=yourdomain,dc=com"
      - LDAP_ATTRIBUT="uid=%s"
      - PROXY_NAME="Proxy Display Name"
    restart: always
LDAPS
version: '3.2'

services: 
  squid:
    image: zhonger/squid
    container_name: squid
    hostname: squid
    ports:
      - "3128:3128"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment: 
      - LDAP_ENABLE=true
      - LDAP_HOST=yourldap.domain.com
      - LDAP_PORT=636
      - LDAP_BindDN="cn=admin,dc=yourdomain,dc=com"
      - LDAP_BindPass="********"
      - LDAP_DN="ou=Users,dc=yourdomain,dc=com"
      - LDAP_ATTRIBUT="uid=%s"
      - PROXY_NAME="Proxy Display Name"
    restart: always

To deploy, just run the following command on the same directory as file

docker-compose up -d

Environment varibales

LDAP_ENABLE

It use to enable LDAP Authentication. By default, it is set to false To enable, just set to true

LDAP_ENABLE=true

LDAP_HOST

Only use if LDAP_ENABLE is set to true

Specifies the LDAP host to contact for authentication. In the form of DNS names or IP addresses

LDAP_HOST=yourldap.domain.com

LDAP_PORT

Only use if LDAP_ENABLE is set to true

Specifies the LDAP server port. By convention :

  • 389 to LDAP
  • 636 to LDAPS
LDAP_PORT=636

LDAP_BindDN

Only use if LDAP_ENABLE is set to true

Specifies the LDAP administrator username.

LDAP_BindDN="cn=admin,dc=yourdomain,dc=com"

LDAP_BindPass

Only use if LDAP_ENABLE is set to true

Specifies the LDAP administrator password.

LDAP_BindPass="********"

LDAP_DN

Only use if LDAP_ENABLE is set to true

Specifies Distinguish Name where user is registered

LDAP_DN="ou=Users,dc=yourdomain,dc=com"

LDAP_ATTRIBUT

Only use if LDAP_ENABLE is set to true

Specifies LDAP attribut for users authentication

LDAP_ATTRIBUT="uid=%s"

PROXY_NAME

Only use if LDAP_ENABLE is set to true

Set Display Name for your proxy

PROXY_NAME="Your Proxy Display Name"

Docker Pull Command

docker pull zhonger/squid