Skip to content

Instantly share code, notes, and snippets.

@rpromyshlennikov
Last active August 14, 2022 04:23
Show Gist options
  • Save rpromyshlennikov/9865b80680effbb85cf113bf83388d1e to your computer and use it in GitHub Desktop.
Save rpromyshlennikov/9865b80680effbb85cf113bf83388d1e to your computer and use it in GitHub Desktop.
3proxy setup

Create user to run 3proxy

sudo adduser --system --no-create-home --disabled-login --group proxy3

Clone and build

git clone git@github.com:z3APA3A/3proxy.git
cd 3proxy
make -f Makefile.Linux

Prepare dir for binaries

sudo mkdir /opt/3proxy
cp -rp ./src/3proxy /opt/3proxy/.
cp -rp ./src/mycrypt /opt/3proxy/.
chown -R proxy3:proxy3 /opt/3proxy

Prepare config and authN file

Options meanings you can find at https://3proxy.ru/howtoe.asp

username:CR:crypted password is value get from username and output of mycript utility made with 3proxy by make cmd.

mycrypt usage example, prepend it with username and ":" before inserting in auth file:

./mycrypt secretsalt secretpassword
CR:$1$secretsalt$VOZZ2bgH.tFneUqihDAwV/
sudo mkdir /etc/3proxy
sudo touch /etc/3proxy/3proxy.cfg
sudo touch /etc/3proxy/.proxyauth
chown -R proxy3:proxy3 /etc/3proxy

sudo echo "#Auth
auth strong
#auth file
users $/etc/3proxy/.proxyauth
#What and where
socks -n -p12864" > /etc/3proxy/3proxy.cfg

sudo echo "test2:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY49.
test3:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY48." > /etc/3proxy/.proxyauth

Setup a systemd unit

sudo echo "[Unit]
Description=3proxy proxyfying service
After=network.target

[Service]
ExecStart=/opt/3proxy/3proxy /etc/3proxy/3proxy.cfg
ExecStop=/bin/kill -s TERM $MAINPID
User=proxy3
Group=proxy3

[Install]
WantedBy=default.target" > /etc/systemd/system/3proxy.service

sudo systemctl daemon-reload
sudo systemctl enable 3proxy.service
sudo systemctl start 3proxy.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment