Skip to content

okhlynov/docker-openvpn-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Squid Proxy with OpenVPN

Overview

This project sets up a Squid proxy server that routes traffic through an OpenVPN client. It allows you to route your traffic through a VPN for added privacy and security.

Prerequisites

  • Docker
  • Docker Compose
  • An OpenVPN configuration file (client.ovpn) should be in the $project_root/local directory.

Usage

  1. Place your OpenVPN configuration file (client.ovpn) in the $project_root/local directory. Note: The CONFIG_FILE environment variable specifies the OpenVPN configuration file to use (e.g., client.ovpn). If this variable is not set, the container will automatically select a random .conf or .ovpn file from the /config directory using the following command:

    config_file=$(find /config -name '*.conf' -o -name '*.ovpn' 2> /dev/null | sort | shuf -n 1)

    To unser this variable edit the docker-compose.yaml

  2. Build and start the services:

    docker compose build   
    docker compose up -d

Usage

  1. Set your proxy settings to http://localhost:3128.
  2. Verify the proxy is working:
    curl --proxy http://localhost:3128 http://ifconfig.co

Troubleshooting

  • Check the logs for the OpenVPN client and Squid:
    docker logs openvpn-client
    docker logs squid

use flag -f to monitor logs like this docker logs -f openvpn-client

  • Ensure DNS resolution works inside the OpenVPN container:
    docker exec -it openvpn-client ping ifconfig.co

Stopping the Services

To stop the services, run: sh docker compose down

About

OpenVPN and Proxy pair

Topics

Resources

Stars

Watchers

Forks

Languages

  • Shell 72.0%
  • Dockerfile 28.0%