Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Brook proxy with SystemD on Ubuntu 16.04

Brook proxy with SystemD on Ubuntu 16.04

Download brook from https://github.com/txthinking/brook/releases

As of 2018-05-24 :

$ wget https://github.com/txthinking/brook/releases/download/v20180601/brook
$ sudo chmod 755 brook
$ sudo mv brook /usr/bin/
$ sudo nano /lib/systemd/system/brook.service

Paste following script (change port and password according to your need) :

[Unit]
Description=Brook proxy
Documentation=https://github.com/txthinking/brook
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/brook server -l :9999 -p YOURPASSWORD
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target

Run it as usual.

$ sudo systemctl enable brook
$ sudo systemctl start brook
$ sudo systemctl status brook

systemctl status brook
● brook.service - Brook proxy
   Loaded: loaded (/lib/systemd/system/brook.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-05-24 05:43:17 UTC; 3min 21s ago
     Docs: https://github.com/txthinking/brook
 Main PID: 20977 (brook)
    Tasks: 3
   Memory: 1.0M
      CPU: 8ms
   CGroup: /system.slice/brook.service
           └─20977 /usr/bin/brook server -l :9999 -p YOURPASSWORD

May 24 05:43:17 your.server.domain systemd[1]: Started Brook proxy.

Don't forget to set iptables rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.