Le client VPN SSL de Sonicwall peut maintenant être connecté et déconnecté 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
Décrivez les informations de connexion suivantes dans le fichier texte.
Décrivez les informations de connexion dans $ HOME / .vpn
.
$ cat <<EOF > ~/vpn
vpn.example.com:4433
takeume2
hogehoge
LocalDomain
EOF
Définissez les autorisations.
$ chmod 0600 ~/vpn
Rechargez Systemd pour le refléter.
$ systemctl --user daemon-reload
systemctl --user status netextender
: Vérification de l'étatsystemctl --user stop netextender
: Déconnectersystemctl --user start netextender
: Se connecter$ 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 octobre 23:28:10 lemur6 systemd[3608]: Client IP Address: 10.254.128.12
30 octobre 23:28:10 lemur6 systemd[3608]: You now have access to the following 1 remote networks:
30 octobre 23:28:10 lemur6 systemd[3608]: 10.0.0.0/255.0.0.0
30 octobre 23:28:10 lemur6 systemd[3608]: NetExtender connected successfully. Type "Ctrl-c" to disconnect...
30 octobre 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 octobre 00:19:24 lemur6 pppd[9399]: Terminating on signal 15
31 octobre 00:19:30 lemur6 pppd[9399]: Connection terminated.
31 octobre 00:19:30 lemur6 pppd[9399]: Modem hangup
31 octobre 00:19:30 lemur6 pppd[9399]: Exit.
31 octobre 00:19:30 lemur6 nete[9393]: SSL VPN logging out...
31 octobre 00:19:30 lemur6 nete[9393]: SSL VPN connection is terminated.
31 octobre 00:19:30 lemur6 nete[9393]: Exiting NetExtender client
31 octobre 00:19:30 lemur6 systemd[3608]: Stopped netExtender VPN Client
Recommended Posts