add ctl script
This commit is contained in:
@@ -10,7 +10,7 @@ common_ssh_cfg_path="${DIYVPN_SSH_CFG:-$script_dir/common_sshconfig}"
|
||||
diyvpn_cfg="${DIYVPN_CFG:-$HOME/.config/diyvpn/servers}"
|
||||
|
||||
generate() {
|
||||
local cfgpath name server_ssh_cfg idle_timeout listen_port
|
||||
local cfgpath name server_ssh_cfg idle_timeout listen_address
|
||||
cfgpath="$1"
|
||||
name=$(basename "$cfgpath" | tr -d '[:space:]')
|
||||
server_ssh_cfg="$cfgpath"/ssh_config # TODO validate
|
||||
@@ -18,7 +18,7 @@ generate() {
|
||||
source "$cfgpath/config.rc"
|
||||
|
||||
idle_timeout="${IDLE_TIMEOUT:-10min}"
|
||||
listen_port="${LISTEN_PORT:?LISTEN_PORT should be set}"
|
||||
listen_address="${LISTEN_ADDRESS:?LISTEN_ADDRESS should be set}"
|
||||
|
||||
cat >"$opdir/diyvpnssh-$name.service" <<-EOF
|
||||
[Unit]
|
||||
@@ -52,7 +52,7 @@ generate() {
|
||||
Description=Socket for diyvpn to server $name
|
||||
|
||||
[Socket]
|
||||
ListenStream=$listen_port
|
||||
ListenStream=$listen_address
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
||||
Reference in New Issue
Block a user