Skip to content

Instantly share code, notes, and snippets.

@kerus1024
Created June 17, 2023 07:57
Show Gist options
  • Save kerus1024/e163fa452b8b39193408a29c9361c73e to your computer and use it in GitHub Desktop.
Save kerus1024/e163fa452b8b39193408a29c9361c73e to your computer and use it in GitHub Desktop.
Setup go-mmproxy
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 <<EOF
127.0.0.0/8
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
EOF
cat > /svc/mmproxy/setup-mmproxy.bash <<EOF
#!/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
pkill -9 go-mmproxy
nohup /svc/mmproxy/go-mmproxy --allowed-subnets /svc/mmproxy/path-prefixes.txt -l 127.0.0.1:443 -4 127.0.0.1:8443 -v 0 > /dev/null 2>&1 &
EOF
cat > /etc/systemd/system/mmproxy.service <<EOF
[Unit]
Description=MMProxy Service
[Service]
Type=simple
ExecStart=/bin/bash /svc/mmproxy/setup-mmproxy.bash
[Install]
WantedBy=network-online.target
EOF
systemctl enable mmproxy.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment