proxy-manager/README.md
2023-04-25 22:23:31 +03:00

1.1 KiB
Raw Permalink Blame History

PMGR

pmgr is wrapper utility for systemd to manage user services for prox ies. See example for SSH SOCKS-proxy below.

Installation

Just place pmgr into your PATH.

install -m755 pmgr ~/.local/bin/pmgr

Usage example

For SSH SOCKS-proxy create template user unit ~/.config/systemd/user/ssh-proxy@.service with contents:

[Unit]
Description=SSH tunnel to %I
After=network.target

[Service]
Environment="LOCAL_ADDR=localhost"
EnvironmentFile=%h/.config/pmgr/ssh-proxy@%i
ExecStart=/usr/bin/ssh -NT \
   -o ServerAliveInterval=60 \
   -o ExitOnForwardFailure=yes \
   -D ${LOCAL_ADDR}:${LOCAL_PORT} ${TARGET}
RestartSec=5
Restart=always

[Install]
WantedBy=default.target

Create environment file ~/.config/pmgr/environment/ssh-proxy@myserver with contents:

TARGET=user@myserver
LOCAL_ADDR=127.0.0.1
LOCAL_PORT=1080

myserver may be a domain name, SSH Hostname (set in ~/.ssh/config) or IP address of remote server.

Now you can enable your proxy with systemctl:

systemctl --user start ssh-proxy@myserver

With pmgr:

pmgr -e ssh-proxy@myserver

Proxy usage:

curl --proxy socks5h://localhost:1080 eth0.me