Der SSL-VPN-Client von Sonicwall kann jetzt über Systemd verbunden und getrennt werden.
File: $HOME/.config/systemd/user/netextender.service
[Unit]
Description=SonicWall NetExtender VPN Client
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
ExecStart=%h/bin/netext
PIDFile=%h/.netext.pid
[Install]
WantedBy=default.target
File: $HOME/bin/netext
#!/bin/bash
PID=$HOME/.netext.pid
CONF=$HOME/.vpn
# Start netExtender
/usr/sbin/netExtender <$CONF &
echo $! > $PID
exit 0
Beschreiben Sie die folgenden Verbindungsinformationen in der Textdatei.
Beschreiben Sie die Verbindungsinformationen in $ HOME / .vpn
.
$ cat <<EOF > ~/vpn
vpn.example.com:4433
takeume2
hogehoge
LocalDomain
EOF
Berechtigungen festlegen.
$ chmod 0600 ~/vpn
Laden Sie Systemd neu, um es wiederzugeben.
$ systemctl --user daemon-reload
systemctl --user status netextender
: Statusprüfungsystemctl --user stop netextender
: Verbindung trennensystemctl --user start netextender
: Verbinden$ systemctl --user stop netextender
$ systemctl --user status netextender
● netextender.service - SonicWall NetExtender VPN Client
Loaded: loaded (/home/takeume2/.config/systemd/user/netextender.service; indirect; vendor preset: enabled)
Active: active (running) since Fri 2020-10-30 23:28:11 JST; 46min ago
Process: 9393 ExecStart=/home/takeume2/bin/netext (code=exited, status=0/SUCCESS)
Main PID: 9394 (netExtender)
CGroup: /user.slice/user-1000.slice/[email protected]/netextender.slice/netextender.service
├─9394 /usr/sbin/netExtender
├─9399 pppd call sslvpn mtu 1280 mru 1280
└─9466 /usr/sbin/nxMonitor
30. Oktober 23:28:10 lemur6 systemd[3608]: Client IP Address: 10.254.128.12
30. Oktober 23:28:10 lemur6 systemd[3608]: You now have access to the following 1 remote networks:
30. Oktober 23:28:10 lemur6 systemd[3608]: 10.0.0.0/255.0.0.0
30. Oktober 23:28:10 lemur6 systemd[3608]: NetExtender connected successfully. Type "Ctrl-c" to disconnect...
30. Oktober 23:28:11 lemur6 systemd[3608]: Started netExtender VPN Client
$ systemctl --user stop netextender
$ systemctl --user status netextender
● netextender.service - SonicWall NetExtender VPN Client
Loaded: loaded (/home/takeume2/.config/systemd/user/netextender.service; indirect; vendor preset: enabled)
Active: inactive (dead) since Sat 2020-10-31 00:19:30 JST; 16s ago
Process: 9393 ExecStart=/home/takeume2/bin/netext (code=exited, status=0/SUCCESS)
Main PID: 9394 (code=exited, status=0/SUCCESS)
31. Oktober 00:19:24 lemur6 pppd[9399]: Terminating on signal 15
31. Oktober 00:19:30 lemur6 pppd[9399]: Connection terminated.
31. Oktober 00:19:30 lemur6 pppd[9399]: Modem hangup
31. Oktober 00:19:30 lemur6 pppd[9399]: Exit.
31. Oktober 00:19:30 lemur6 nete[9393]: SSL VPN logging out...
31. Oktober 00:19:30 lemur6 nete[9393]: SSL VPN connection is terminated.
31. Oktober 00:19:30 lemur6 nete[9393]: Exiting NetExtender client
31. Oktober 00:19:30 lemur6 systemd[3608]: Stopped netExtender VPN Client
Recommended Posts