mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
pre merge req changes
This commit is contained in:
@@ -1,25 +1,30 @@
|
||||
# Installing Service
|
||||
|
||||
## Server
|
||||
A service is a program that runs in the background outside the interactive control of system users. Services can also be automatically started on boot.
|
||||
|
||||
The folling steps assume that boringproxy is already installed on the server. If you haven't installed the server, follow [installation](https://boringproxy.io/installation/) instructions in the documentation.
|
||||
*The systemd service instructions were writen for Linux*
|
||||
|
||||
boringproxy needs to be installed in **/usr/local/bin/boringproxy** for the default service file to work, this location can be changed in the service file
|
||||
# Prerequisites
|
||||
|
||||
### Create boringproxy user & group
|
||||
The service will be run as user 'boringproxy'. Runnning the service as root is not recomended.
|
||||
## Install boringproxy
|
||||
The folling steps assume that boringproxy is already installed. If you haven't installed the server, follow [installation](https://boringproxy.io/installation/) instructions in the documentation.
|
||||
|
||||
Add user "boringproxy"
|
||||
Boringproxy needs to be installed in **/usr/local/bin/boringproxy** for the default service file to work. If you want to use another path, this can be changed in the service file.
|
||||
|
||||
## Create boringproxy user & group
|
||||
The service will be run as user *boringproxy*. Runnning the service as *root* is not recomended.
|
||||
|
||||
Add user *boringproxy*
|
||||
```bash
|
||||
useradd -s /bin/bash -d /home/boringproxy/ -m boringproxy;
|
||||
```
|
||||
|
||||
Add group "boringproxy"
|
||||
Add group *boringproxy*
|
||||
```bash
|
||||
groupadd boringproxy;
|
||||
```
|
||||
|
||||
Add user "boringproxy" to group "boringproxy"
|
||||
Add user *boringproxy* to group *boringproxy*
|
||||
```bash
|
||||
usermod -a -G boringproxy boringproxy
|
||||
```
|
||||
@@ -30,30 +35,44 @@ mkdir /home/boringproxy/.ssh
|
||||
chown boringproxy:boringproxy /home/boringproxy/.ssh
|
||||
```
|
||||
|
||||
### Download & edit service file
|
||||
## Server
|
||||
|
||||
Installing the service on a boringproxy server
|
||||
|
||||
### Download service file
|
||||
|
||||
Copy service file from GitHub
|
||||
```bash
|
||||
wget https://raw.githubusercontent.com/WGrobler/boringproxy/master/systemd/boringproxy-server.service
|
||||
wget https://raw.githubusercontent.com/boringproxy/boringproxy/master/systemd/boringproxy-server.service
|
||||
```
|
||||
|
||||
Edit service file to include your setup information
|
||||
### Edit service file to include your setup information
|
||||
|
||||
Default working directory is ***"/opt/boringproxy/"***, you can change this in the service file to another directory.
|
||||
Make sure the directory exists, otherwise create WorkingDirectory
|
||||
#### Working Directory
|
||||
|
||||
Default working directory is */opt/boringproxy/*, you can change this in the service file to another directory.
|
||||
|
||||
Create the directory if it does not alreay exists
|
||||
```bash
|
||||
mkdir -p /opt/boringproxy/
|
||||
```
|
||||
#### Boringproxy executable file path
|
||||
|
||||
Default location for your boringproxy executable file is ***"/usr/local/bin/boringproxy"***, you can change this in the service file to another path.
|
||||
Make sure the file exists, otherwise move file from the current directory to ***"/usr/local/bin/boringproxy"***
|
||||
Default location for your boringproxy executable file is */usr/local/bin/boringproxy*, you can change this in the service file to another path.
|
||||
|
||||
Move file from the downloaded directory to */usr/local/bin/boringproxy*
|
||||
```bash
|
||||
mv ./boringproxy /usr/local/bin/boringproxy
|
||||
```
|
||||
|
||||
#### ExecStart
|
||||
|
||||
Edit the service file and change *bp.example.com* to your admin-domain (the main domain configured in DNS).
|
||||
|
||||
|
||||
### Install service file to systemd
|
||||
|
||||
Copy service file to "/etc/systemd/system/"
|
||||
Copy service file to */etc/systemd/system/*
|
||||
```bash
|
||||
mv ./boringproxy-server.service /etc/systemd/system/
|
||||
```
|
||||
@@ -64,28 +83,37 @@ systemctl daemon-reload
|
||||
|
||||
### Manual start (once off only)
|
||||
When boringproxy start for the first time, it requires a manual input of your email address. This email address will be used when registering Certificates with Let's Encrypt.
|
||||
By stating the server manually, you can enter the required information and ensure the server is starting correctly under the new user.
|
||||
|
||||
To start the server, you will need to change the current directory to your WorkingDirectory (as indicated in your service file) and then run the ExecStart command (as indicated in your service file). If you made changes to the default WorkingDirectory or boringproxy executable file path, change the command below accordingly.
|
||||
Change the admin-domain in the command below to your admin-domain and enter your email address when prompted
|
||||
By stating the server manually, you can enter the required information and ensure the server is starting correctly under the new user.
|
||||
|
||||
To start the server, you will need to change the current directory to your WorkingDirectory (as indicated in your service file) and then run the ExecStart command (as indicated in your service file). If you made changes to the default WorkingDirectory or boringproxy executable file path, change the command below accordingly.
|
||||
|
||||
If no changes were made to the default paths, change the *admin-domain* in the command below to your *admin-domain* and enter your email address when prompted
|
||||
```bash
|
||||
runuser -l boringproxy -c 'cd /opt/boringproxy; /usr/local/bin/boringproxy server -admin-domain bp.example.com'
|
||||
```
|
||||
|
||||
If your server was successfully started, close the running process and start it again using the service. Since the process was started as a different user, you will have to kill the foreground process (***Ctrl + C***) as well as close the process started as user boringproxy. To kill all running processes for user boringproxy, use the command below:
|
||||
If your server was successfully started, close the running process and start it again using the service.
|
||||
|
||||
Since the process was started as a different user, you will have to kill the foreground process (***Ctrl + C***) as well as close the process started as user *boringproxy*.
|
||||
|
||||
To kill all running processes for user *boringproxy*, use the command below:
|
||||
```bash
|
||||
pkill -u boringproxy
|
||||
```
|
||||
|
||||
To check if boringproxy is still running, you can look if a process is listening on port 443 using:
|
||||
To check if **boringproxy** is still running, you can look if a process is listening on port 443 using:
|
||||
```bash
|
||||
netstat -tulpn | grep LISTEN | grep 443
|
||||
```
|
||||
If nothing is returned, no process is currently using port 443. Alternatively you will receive a result like:
|
||||
*tcp6 0 0 :::443 :::* LISTEN 9461/boringproxy*
|
||||
|
||||
*tcp6 0 0 :::443 ::: LISTEN 9461/boringproxy*
|
||||
|
||||
### Service commands
|
||||
|
||||
After the above steps are completed, you can execute the service by using the commands below.
|
||||
|
||||
Start your service
|
||||
```bash
|
||||
systemctl start boringproxy-server.service
|
||||
@@ -103,11 +131,78 @@ systemctl enable boringproxy-server.service
|
||||
|
||||
To disable your service on every reboot
|
||||
```bash
|
||||
systemctl disable boringproxy-server.service
|
||||
systemctl disable boringproxy-server.service
|
||||
```
|
||||
|
||||
## Client
|
||||
|
||||
Installing the service on a boringproxy client
|
||||
|
||||
### Download service file
|
||||
|
||||
Copy service file from GitHub
|
||||
```bash
|
||||
./boringproxy client -server bpdemo.brng.pro -token fKFIjefKDFLEFijKDFJKELJF -client-name demo-client -user demo-user
|
||||
wget https://raw.githubusercontent.com/boringproxy/boringproxy/master/systemd/boringproxy-client%40.service
|
||||
```
|
||||
|
||||
### Edit service file to include your setup information
|
||||
|
||||
#### Working Directory
|
||||
|
||||
Default working directory is */opt/boringproxy/*, you can change this in the service file to another directory.
|
||||
|
||||
Create the directory if it does not alreay exists
|
||||
```bash
|
||||
mkdir -p /opt/boringproxy/
|
||||
```
|
||||
#### Boringproxy executable file path
|
||||
|
||||
Default location for your boringproxy executable file is */usr/local/bin/boringproxy*, you can change this in the service file to another path.
|
||||
|
||||
Move file from the downloaded directory to */usr/local/bin/boringproxy*
|
||||
```bash
|
||||
mv ./boringproxy /usr/local/bin/boringproxy
|
||||
```
|
||||
|
||||
#### ExecStart
|
||||
|
||||
Edit the service file and change the folowing:
|
||||
- **bp.example.com** to your *admin-domain*
|
||||
- **your-bp-server-token** to your user token
|
||||
|
||||
|
||||
### Install service file to systemd
|
||||
|
||||
Copy service file to */etc/systemd/system/*
|
||||
*You can change your-server-name to any name you want to identify the server. This is usefull when connecting your client device to multiple servers using different client services.*
|
||||
```bash
|
||||
mv ./boringproxy-client@.service /etc/systemd/system/boringproxy-client@your-server-name.service
|
||||
```
|
||||
Reload the service files to include the new service.
|
||||
```bash
|
||||
systemctl daemon-reload
|
||||
```
|
||||
|
||||
### Service commands
|
||||
|
||||
After the above steps are completed, you can execute the service by using the commands below.
|
||||
|
||||
Start your service
|
||||
```bash
|
||||
systemctl start boringproxy-client@your-server-name.service
|
||||
```
|
||||
|
||||
To check the status of your service
|
||||
```bash
|
||||
systemctl status boringproxy-client@your-server-name.service
|
||||
```
|
||||
|
||||
To enable your service on every reboot
|
||||
```bash
|
||||
systemctl enable boringproxy-client@your-server-name.service
|
||||
```
|
||||
|
||||
To disable your service on every reboot
|
||||
```bash
|
||||
systemctl disable boringproxy-client@your-server-name.service
|
||||
```
|
||||
Reference in New Issue
Block a user