-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshadowsocks-rust-docker-init.sh
More file actions
45 lines (40 loc) · 1.13 KB
/
shadowsocks-rust-docker-init.sh
File metadata and controls
45 lines (40 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# init script for shadowsocks-rust with docker
# Variables
port=$1
password=$2
dns=$3
# Validate if all the variables are filled
if [ -z "$port" ] || [ -z "$password" ] || [ -z "$dns" ]
then
echo "Some variables were not filled. Example: sh shadowsocks-rust-docker-init.sh port password dns"
else
# Install docker
sudo apt update
sudo apt install docker.io -y
# Creating path for shadowsocks-rust-server at /etc/shadowsocks-rust-data/
mkdir /etc/shadowsocks-rust-data/
# Echoing config to /etc/shadowsocks-rust-data/
echo "
{
\"server\": \"0.0.0.0\",
\"server_port\": 8388,
\"password\": \"$password\",
\"method\": \"aes-256-gcm\",
\"mode\": \"tcp_only\",
\"protocol\": \"dns\",
\"local_address\": \"0.0.0.0\",
\"local_port\": 53,
\"local_dns_port\": 53,
\"remote_dns_address\": \"$dns\",
\"remote_dns_port\": 53,
\"no_delay\": true,
}
" >> /etc/shadowsocks-rust-data/config.json
docker run --name ssserver-rust \
--restart always \
-p $port:8388/tcp \
-p $port:8388/udp \
-v /etc/shadowsocks-rust-data/config.json:/etc/shadowsocks-rust/config.json \
-dit ghcr.io/shadowsocks/ssserver-rust:latest
fi