SonicWall's SSL VPN client can now be connected and disconnected via Systemd.
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
Write the following connection information in a text file.
Describe the connection information in $ HOME / .vpn
.
$ cat <<EOF > ~/vpn
vpn.example.com:4433
takeume2
hogehoge
LocalDomain
EOF
Set permissions.
$ chmod 0600 ~/vpn
Reload Systemd to reflect.
$ systemctl --user daemon-reload
systemctl --user status netextender
: Status checksystemctl --user stop netextender
: Disconnectsystemctl --user start netextender
: Connect$ 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
October 30 23:28:10 lemur6 systemd[3608]: Client IP Address: 10.254.128.12
October 30 23:28:10 lemur6 systemd[3608]: You now have access to the following 1 remote networks:
October 30 23:28:10 lemur6 systemd[3608]: 10.0.0.0/255.0.0.0
October 30 23:28:10 lemur6 systemd[3608]: NetExtender connected successfully. Type "Ctrl-c" to disconnect...
October 30 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)
October 31 00:19:24 lemur6 pppd[9399]: Terminating on signal 15
October 31 00:19:30 lemur6 pppd[9399]: Connection terminated.
October 31 00:19:30 lemur6 pppd[9399]: Modem hangup
October 31 00:19:30 lemur6 pppd[9399]: Exit.
October 31 00:19:30 lemur6 nete[9393]: SSL VPN logging out...
October 31 00:19:30 lemur6 nete[9393]: SSL VPN connection is terminated.
October 31 00:19:30 lemur6 nete[9393]: Exiting NetExtender client
October 31 00:19:30 lemur6 systemd[3608]: Stopped netExtender VPN Client
Recommended Posts