Deployment guide

3proxy

Overview

3proxy is a small, fast proxy server that speaks HTTP, HTTPS and SOCKS from a single lightweight daemon. It lets you route outbound web traffic through one controlled gateway, with access control lists, per-user authentication and detailed logging.

This SecureAnyCloud image runs 3proxy 0.9.7 on Ubuntu 24.04 on Azure. It is built from pinned upstream source and is locked down by default. Every VM generates its own proxy credentials on first boot. 3proxy runs as the unprivileged proxy3 user and enforces auth strong, so the proxy is never an open relay.

What you get:

  • 3proxy 0.9.7 built from the pinned upstream source (github.com/z3APA3A/3proxy tag 0.9.7), so the exact version is reproducible and no third-party package repository is present on the running VM
  • 3proxy running under systemd (3proxy.service) as the unprivileged proxy3 user
  • An HTTP/HTTPS forward proxy on TCP 3128 and a SOCKS4/5 proxy on TCP 1080
  • No default credentials: a fresh proxy username and password generated on the first boot of every VM, with the password stored as a crypt hash in /etc/3proxy/passwd and the plaintext written to /root/3proxy-credentials.txt (mode 0600, root only)
  • Connection details documented in /root/3proxy-credentials.txt for you to read after first boot
  • Mandatory proxy authentication (auth strong): anonymous or wrong-credential requests are rejected with HTTP 407
  • A secure default access control list that allows authenticated clients on loopback and RFC1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) only, with a deny-all default
  • The CONNECT method limited to TLS ports (443, 563), so the proxy cannot be used to tunnel to arbitrary ports such as mail relays
  • Unattended security upgrades to keep the base OS patched

You widen access to your own client ranges with one configuration edit (see Step 9). The CONNECT restriction to TLS ports stays in place.

Prerequisites

You need an active Azure subscription, an SSH public key, and a VNet with a subnet in the target region. Your subscription must also be subscribed to the 3proxy listing on the Azure Marketplace.

Configure the Network Security Group (NSG) to allow TCP 22 for administration. For the clients that will use the proxy, also allow TCP 3128 (HTTP/HTTPS proxy) and/or TCP 1080 (SOCKS).

Recommended virtual machine size: Standard_B2s (2 vCPU, 4 GB RAM) for a small proxy. For higher throughput, use Standard_D2s_v5 or larger.

1

Deploy from the Azure Portal

Search the Marketplace for 3proxy, select the SecureAnyCloud publisher, and click Create.

Configure the Network Security Group to allow TCP 3128 (and/or TCP 1080 for SOCKS) from your client networks. Allow TCP 22 for administration.

2

Deploy from the Azure CLI

RG="proxy-prod"; LOCATION="eastus"; VM_NAME="proxy1" IMAGE_URN="sac1647283583153:3proxy-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION"
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:3proxy-ubuntu-24-04:default:latest
az vm create \
  --resource-group "$RG" --name "$VM_NAME" \
  --image "$IMAGE_URN" \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values "$SSH_KEY" \
  --public-ip-sku Standard
az vm open-port --resource-group "$RG" --name "$VM_NAME" --port 3128 --priority 1001
az vm open-port --resource-group "$RG" --name "$VM_NAME" --port 22 --priority 1002
3

Read the first-boot credentials

On first boot the image generates a fresh proxy username and password, writes the crypt hash to /etc/3proxy/passwd, starts 3proxy, and writes /root/3proxy-credentials.txt. This completes within a few seconds.

SSH in as azureuser and read the details:

sudo cat /root/3proxy-credentials.txt
4

Confirm the service is running

Check that 3proxy.service is running under systemd as the unprivileged proxy3 user. Then use ss to confirm the HTTP/HTTPS proxy is listening on :3128 and the SOCKS proxy on :1080.

systemctl is-active 3proxy.service ps -o user= -C 3proxy | head -1 ss -tlnp | grep -E ':3128 |:1080 '
5

Verify that authentication is required

The proxy rejects anonymous and wrong-credential requests with HTTP 407, and accepts the correct per-VM credentials. Read your credentials from the file into shell variables, then run the round trip.

These commands run on the VM against loopback. From a remote client, replace 127.0.0.1 with the VM address and connect from an allowed range.

PROXY_USER=$(sudo grep '^PROXY_USERNAME=' /root/3proxy-credentials.txt | cut -d= -f2-)
PROXY_PASS=$(sudo grep '^PROXY_PASSWORD=' /root/3proxy-credentials.txt | cut -d= -f2-)
echo -n 'anonymous : HTTP '; curl -s -o /dev/null -w '%{http_code}\n' -m 15 -x http://127.0.0.1:3128 http://example.com
echo -n 'wrong password : HTTP '; curl -s -o /dev/null -w '%{http_code}\n' -m 15 -x "http://$PROXY_USER:wrong@127.0.0.1:3128" http://example.com
echo -n 'authenticated : HTTP '; curl -s -o /dev/null -w '%{http_code}\n' -m 25 -x "http://$PROXY_USER:$PROXY_PASS@127.0.0.1:3128" http://example.com
6

Proxy HTTPS and use the SOCKS port

Send an HTTPS request and a SOCKS request with the same credentials. HTTPS requests are tunnelled with the CONNECT method to TLS port 443, and the SOCKS proxy listens on port 1080.

PROXY_USER=$(sudo grep '^PROXY_USERNAME=' /root/3proxy-credentials.txt | cut -d= -f2-)
PROXY_PASS=$(sudo grep '^PROXY_PASSWORD=' /root/3proxy-credentials.txt | cut -d= -f2-)
# HTTPS through the HTTP proxy (CONNECT to 443)
curl -s -o /dev/null -w 'https via 3128 : HTTP %{http_code}\n' -m 25 -x "http://$PROXY_USER:$PROXY_PASS@127.0.0.1:3128" https://example.com
# SOCKS5 on port 1080 curl -s -o /dev/null -w 'https via socks: HTTP %{http_code}\n' -m 25 --socks5-hostname "$PROXY_USER:$PROXY_PASS@127.0.0.1:1080" https://example.com
7

Review the secure-by-default configuration

Print the configuration to review it. It ships mandatory authentication (auth strong) and an access control list that allows authenticated clients from loopback and RFC1918 private ranges only. It also sets a deny * default and restricts CONNECT to TLS ports.

grep -vE '^\s*#|^\s*$' /etc/3proxy/3proxy.cfg
8

Confirm no default credentials ship

The image ships no default or shared credentials. Check the file permissions: the credentials file is 0600 root:root, and the proxy passwd file stores a crypt hash rather than the plaintext password.

sudo stat -c '%n %a %U:%G' /root/3proxy-credentials.txt
sudo stat -c '%n %a %U:%G' /etc/3proxy/passwd
sudo sed -E 's/(:CR:.{6}).*/\1********/' /etc/3proxy/passwd
9

Allow your own remote clients

By default only loopback and RFC1918 private ranges are allowed. Remote clients on the public internet are denied even with valid credentials.

To allow a client range, add an allow line above the final deny * in /etc/3proxy/3proxy.cfg and reload the service. Replace <your-mgmt-cidr> with your own client network:

sudo sed -i '/^deny \*/i allow * <your-mgmt-cidr>' /etc/3proxy/3proxy.cfg
sudo systemctl reload 3proxy

Keep the deny * line last so that anything not explicitly allowed is refused.

10

Add another proxy user

Users are stored with crypt-hashed passwords. Generate the hash with openssl passwd, append a user:CR:<hash> line to /etc/3proxy/passwd, then reload. Replace <new-password> with a strong password:

HASH=$(openssl passwd -1 '<new-password>')
echo "teammate:CR:$HASH" | sudo tee -a /etc/3proxy/passwd >/dev/null
sudo systemctl reload 3proxy
11

Configure a client to use the proxy

From a client machine on an allowed range, point your tools at the proxy. Read the username and password from /root/3proxy-credentials.txt, and replace <public-ip> with your VM's public IP. For example, with curl:

curl -x http://<public-ip>:3128 -U 'PROXY_USERNAME:PROXY_PASSWORD' https://ifconfig.me

Alternatively, set the standard environment variables so that most command-line tools use the proxy:

export http_proxy="http://PROXY_USERNAME:PROXY_PASSWORD@<public-ip>:3128"
export https_proxy="$http_proxy"

Replace PROXY_USERNAME and PROXY_PASSWORD with the values from /root/3proxy-credentials.txt.

12

Security recommendations

Restrict the NSG. Allow TCP 3128 (and 1080 for SOCKS) only from the client networks that need the proxy. Allow TCP 22 for administration only.

Keep authentication mandatory. The image ships auth strong. Never remove it, or the proxy becomes an open relay.

Scope the access control list. Add only the specific client ranges you need above the final deny *. Do not use allow * from any source.

Keep CONNECT restricted to TLS ports so the proxy cannot be abused to tunnel to mail or arbitrary ports.

Rotate credentials by editing /etc/3proxy/passwd and reloading. The plaintext of the original per-VM password lives only in /root/3proxy-credentials.txt.

Keep the OS patched. Unattended security upgrades remain enabled on the running VM.

13

Support and Licensing

3proxy is developed by the 3proxy project and distributed under the 3proxy Public License Agreement, a permissive BSD-style licence. The software is additionally available under the Apache 2.0, GPL and LGPL licences at your option. This image builds the unmodified upstream 3proxy 0.9.7 source.

SecureAnyCloud provides the packaging, the secure default configuration, the per-VM credential automation, security patching, and 24/7 support with a guaranteed 24-hour response SLA.

SecureAnyCloud is not affiliated with or endorsed by the 3proxy project. 3proxy is a mark of its respective owner and is used here only to identify the software.

Deploy on Azure

Find 3proxy Proxy Server on Ubuntu 24.04 LTS on the Azure Marketplace, published by SecureAnyCloud. Deploy from the Portal or the Azure CLI as shown above.

Need Help?

Email sales@secureanycloud.com for deployment help, configuration questions or licensing enquiries.

Deploy on Azure

Launch 3proxy 0.9.7 on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure