Last active
December 18, 2021 15:53
-
-
Save kerus1024/158c6c79400a177cb8487b239dc9e312 to your computer and use it in GitHub Desktop.
Setup mmproxy on Debian Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
apt install -y golang git | |
go get github.com/path-network/go-mmproxy | |
mkdir -p /svc/mmproxy | |
cp $HOME/go/bin/go-mmproxy /svc/mmproxy/ | |
cat > /svc/mmproxy/path-prefixes.txt << _ | |
127.0.0.0/8 | |
10.0.0.0/8 | |
172.16.0.0/12 | |
192.168.0.0/16 | |
_ | |
cat > /svc/mmproxy/setup-mmproxy.bash << _ | |
#!/bin/bash | |
ip rule add from 127.0.0.1/8 iif lo table 123 | |
ip route add local 0.0.0.0/0 dev lo table 123 | |
ip -6 rule add from ::1/128 iif lo table 123 | |
ip -6 route add local ::/0 dev lo table 123 | |
nohup /svc/mmproxy/go-mmproxy --allowed-subnets /svc/mmproxy/path-prefixes.txt -l 127.0.0.1:8443 -4 127.0.0.1:443 -v 0 > /dev/null 2>&1 & | |
_ | |
cat > /etc/systemd/system/mmproxy.service << _ | |
[Unit] | |
Description=Activate MMProxy Service | |
Wants=network.target | |
After=network.target | |
[Service] | |
Type=forking | |
User=root | |
Group=root | |
ExecStart=/svc/mmproxy/setup-mmproxy.bash | |
Restart=always | |
RestartSec=30s | |
[Install] | |
WantedBy=default.target | |
_ | |
chmod 755 /etc/systemd/system/mmproxy.service | |
chmod 755 /svc/mmproxy/setup-mmproxy.bash | |
systemctl enable mmproxy.service | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment