2023-04-25 22:19:13 +03:00
|
|
|
.\" vim: set filetype=groff:
|
2023-07-01 16:35:23 +03:00
|
|
|
.TH PMGR 1 "2023-04-25" "pmgr 0.0.2"
|
2023-04-25 22:19:13 +03:00
|
|
|
.SH NAME
|
|
|
|
pmgr - proxy manager based on systemd user units.
|
|
|
|
|
|
|
|
.SH SYNOPSYS
|
|
|
|
.SY pmrg
|
|
|
|
.OP \-ledrsjoRaAhv
|
|
|
|
[\fIservice\fR]
|
|
|
|
.YS
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
|
|
|
pmgr is wrapper utility for systemd to manage user services for proxies.
|
|
|
|
See example for SSH SOCKS-proxy in EXAMPLES section below.
|
|
|
|
|
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
|
|
|
.B \-l
|
|
|
|
list proxies
|
|
|
|
.TP
|
|
|
|
.B \-e \fIservice\fR
|
|
|
|
enable (start) proxy
|
|
|
|
.TP
|
|
|
|
.B \-d \fIservice\fR
|
|
|
|
disable (stop) proxy
|
|
|
|
.TP
|
|
|
|
.B \-r \fIservice\fR
|
|
|
|
restart proxy
|
|
|
|
.TP
|
|
|
|
.B \-s \fIservice\fR
|
|
|
|
show proxy status
|
|
|
|
.TP
|
|
|
|
.B \-j \fIservice\fR
|
|
|
|
view proxy logs
|
|
|
|
.TP
|
|
|
|
.B \-o
|
|
|
|
print PMGR_ENV_DIR
|
|
|
|
.TP
|
|
|
|
.B \-R
|
|
|
|
run systemctl --user daemon-reload
|
|
|
|
.TP
|
|
|
|
.B \-a \fIservice\fR
|
|
|
|
add to autostart
|
|
|
|
.TP
|
|
|
|
.B \-A \fIservice\fR
|
|
|
|
remove from autostart
|
|
|
|
.TP
|
|
|
|
.B \-h
|
|
|
|
print this help message and exit
|
|
|
|
.TP
|
|
|
|
.B \-v
|
|
|
|
print version and exit
|
|
|
|
|
|
|
|
.SH ENVIRONMENT
|
|
|
|
.TP
|
|
|
|
.B PMGR_WORKDIR
|
|
|
|
Working directory. Deafult is ~/.config/pmgr
|
|
|
|
.TP
|
|
|
|
.B PMGR_ENV_DIR
|
|
|
|
Directory for systemd environment files, depends on PMGR_WORKDIR by default.
|
|
|
|
Default is $PMGR_WORKDIR/environment
|
|
|
|
|
|
|
|
.SH EXAMPLES
|
|
|
|
.PP
|
|
|
|
For SSH SOCKS-proxy create template user unit
|
|
|
|
~/.config/systemd/user/ssh-proxy@.service with contents:
|
|
|
|
.PP
|
|
|
|
.in +4n
|
|
|
|
.EX
|
|
|
|
[Unit]
|
|
|
|
Description=SSH tunnel to %I
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Environment="LOCAL_ADDR=localhost"
|
2023-04-25 22:23:31 +03:00
|
|
|
EnvironmentFile=%h/.config/pmgr/ssh-proxy@%i
|
2023-04-25 22:19:13 +03:00
|
|
|
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
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
Create environment file
|
|
|
|
~/.config/pmgr/environment/ssh-proxy@myserver with contents:
|
|
|
|
.PP
|
|
|
|
.in +4n
|
|
|
|
.EX
|
|
|
|
TARGET=user@myserver
|
|
|
|
LOCAL_ADDR=127.0.0.1
|
|
|
|
LOCAL_PORT=1080
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
.PP
|
2023-04-25 22:23:31 +03:00
|
|
|
\fImyserver\fR may be a domain name, SSH Hostname (set in ~/.ssh/config)
|
2023-04-25 22:19:13 +03:00
|
|
|
or IP address of remote server.
|
|
|
|
|
|
|
|
Now you can enable your proxy with systemctl:
|
|
|
|
.PP
|
|
|
|
.in +4n
|
|
|
|
.EX
|
|
|
|
systemctl --user start ssh-proxy@myserver
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
With pmgr:
|
|
|
|
.PP
|
|
|
|
.in +4n
|
|
|
|
.EX
|
|
|
|
pmgr -e ssh-proxy@myserver
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
.PP
|
|
|
|
.BR systemctl (1),
|
|
|
|
.BR journalctl (1),
|
|
|
|
.BR systemd.special (7),
|
|
|
|
.PP
|
|
|
|
https://wiki.archlinux.org/title/systemd/User
|