[LINUX] Use Sonicwall NetExtener with Systemd

SonicWall's SSL VPN client can now be connected and disconnected via Systemd.

Create a Unit file

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

Create a start script

File: $HOME/bin/netext

#!/bin/bash
PID=$HOME/.netext.pid
CONF=$HOME/.vpn

# Start netExtender
/usr/sbin/netExtender <$CONF &
echo $! > $PID
exit 0

Connection information

Write the following connection information in a text file.

  1. VPN server: port
  2. Username
  3. Password
  4. Domain

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

How to use

Connecting

$ 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

Disconnect

$ 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

Use Sonicwall NetExtener with Systemd
Use mecab-ipadic-neologd with igo-python
Use RTX 3090 with PyTorch
Use pipdeptree with virtualenv
[Python] Use JSON with Python
Use indicator with pd.merge
Use mecab with Python3
Use tensorboard with Chainer
Use pip with MSYS2
Use Python 3.8 with Anaconda
Use pyright with Spacemacs
Use python with docker
Use TypeScript with django-compressor
Use LESS with Django
Use MySQL with Django
Use Enums with SQLAlchemy
Use tensorboard with NNabla
Use GPS with Edison
Use nim with Jupyter
Use Trello API with python
Use shared memory with shared libraries
Use "$ in" operator with mongo-go-driver
Use custom tags with PyYAML
Use directional graphs with networkx
Use TensorFlow with Intellij IDEA
Use Twitter API with Python
Use pip with Jupyter Notebook
Use sqlite3 with NAO (Pepper)
Use sqlite load_extensions with Pyramid
Use Windows 10 fonts with WSL
Use chainer with Jetson TK1
Use SSL with Celery + Redis
Use Cython with Jupyter Notebook
Use WDC-433SU2M2 with Manjaro Linux
Use OpenBLAS with numpy, scipy
Use subsonic API with python3
Use prefetch_related conveniently with Django
Use AWS interpreter with Pycharm
Use Bokeh with IPython Notebook
Use Python-like range with Rust
Use MLflow with Databricks ④ --Call model -
Use pyright with CentOS7, emacs lsp-mode
Python: How to use async with
Use Azure SQL Database with SQLAlchemy
Use PointGrey camera with Python (PyCapture2)
Use vl53l0x with Raspberry Pi (python)
Use the preview feature with aws-cli
[Python] Use Basic/Digest authentication with Flask
Use markdown with jupyter notebook (with shortcut)
Use Python in pyenv with NeoVim
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
How to use FTP with Python
Use Windows 10 speech synthesis with Python
Use curl / jq library with Go
Use camera calibration file with OpenCvSharp4
Use MULTI_ORG function with re: dash
[Django] Use MessagePack with Django REST framework
Use OpenCV with Python 3 in Window
Use Logitech wireless mouse with Sparkylinux
Use PostgreSQL with Lambda (Python + psycopg2)
Use boto3 to mess with S3