Category Archives: Howto Tutorials (EN)

Knowledge Network for Tutorials, Howto’s, Workaround, DevOps Code for Professionals.

How to use FortiClient VPN Post Login Script

Run FortiClient SSL VPN Scripts from CLI

How to use the FortiClient SSL VPN from the Windows command line, and apply from batch scripts. The FortiClient, available for FortiGate for all known operating systems, download from the Fortinet Support section. In addition to the FortiClient 6.4.2.1580 for Windows used here also the FortiClientTools 6.0.9.0277.

FortiClient VPN Windows  Installation
FortiClient VPN

After the FortiClient is installed, we leave the VPN configuration left blank. Now the FortiClientTools are unpacked into a directory, of interest is the folder contents of SSLVPNcmdline, here the file FortiSSLVPNclient.exe is to be found, along with the Microsoft Visual C++ Redistributable mfc140.dll, msvcp140.dll, vcruntime140.dll runtime components.

Contents of SSLVPNcmdline FortiClientTools_6.0.9.0277.zip.

Running FortiSSLVPNclient.exe opens the GUI.

FortiClient SSLVPN Tool Installation auf Windows
FortiClient SSLVPN

We decide not to use the VPN connection profile stored in Settings, instead to connect from CLI with append parameters.

FortiSSLVPNclient connect -h 226.62.42.81:10443 -u homer:password123 -i -q -m

It is now a good way to start the VPN connection with login and network drive mapping from the script, the following batch file should enable this.

@echo off
START "" /I FortiSSLVPNclient connect -h 226.62.42.81:10443 -u homer:password123 -i -q -m
timeout 10
net use * /delete /yes
net use R: \\10.10.10.10\data /user:homer password123 /persistent:no
REM further instructions!

With option connect -h will connect to the VPN gateway, belong the IP address and the port number separated by a colon. The user -u who should log in to the gateway and the password after the colon. With the timeout wait 10 seconds to VPN connection to be established before execute network drive mapping. The value may be reduced or it must be increased.

In the taskbar, the Icon FortiSSLVPNclient, over which the context menu opens with a right-click.

The VPN connection can be disconnected with the following script.

@echo off
START "" /I FortiSSLVPNclient disconnect

FortiSSLVPNclient Command Line Usage
Usage: FortiSSLVPNclient.exe [options] [args]

FortiSSLVPNClient Tool Help Site

Source link: Fortinet Knowledge Base

How to Install Midnight Commander on Synology NAS

Install Midnight Commander in Synology DSM Terminal Shell

This post shows how to deploy Midnight Commander on a Synology NAS, the file manager for the file system in the Synology Shell via SSH. Midnight Commander, short mc is one of the most well-known console programs on Linux. Fortunately, you can easily add additional software repositories to the Synology NAS to install additional tools.

The Midnight Commander is not provided or managed by Synology itself, but can be retrieved from the SynoCommunity repository. The SynoCommunity offers free packages for Synology NAS devices.

How to add the SynoCommunity repository

Synology DSM Main Menu

From DSM you open the main menu with the icon at the top left, there you will find the Package Center.

By clicking on the icon Package Center to open this, then click the Settings button.

Synology Icon Package Center
Synology Package Center

In the now opened General window under Trust Level, enable the Synology Inc. and trusted publishers option.

Synology Trust Level

Then go to the Package Sources section.

Synology Package Sources

Click the Add button and insert the package source, enter SynoCommunity as the name, and insert the URL https://packages.synocommunity.com/ at location and click OK.

Synology Add Package Source

Packages can now be installed. The SynoCli File Tools package provides the following command-line utilities: less, tree, ncdu, jdupes, rhash, mc (midnight-commander), nano, file, detox, rmlint, rnm, pcre2, zstd. Nano used to be a separate package, but is now only available through the SynoCli File Tools package.

SynoCli File Tools

Now you can connect with a terminal like PuTTY to diskstation and run mc in the shell.

NAS7:/$ sudo mc

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password:

Midnight Commander

Use sudo to run mc, after the admin password is entering the Midnight Commander is opened.

Midnight Commander on the Synology Shell

In the menu bar below, the functions of mc can be used via the F-keys or also with the mouse, such as Edit or Copy, with the cursor keys or the mouse you navigate in the window, press tab to switch to the other window, press F10 to leave Midnight Commander.

  Remember, changes to system files require knowledge of the function and its effects.

Enable Synology DSM SSH service

In order for the terminal to be accessible via SSH, the SSH service must be activated in the DSM Control Panel, under Terminal & SNMP, in order to make the Icon Terminal & SNMP visible, Advanced Mode is selected at the top right.

Synology Control Panel

In the Terminal window, enable the SSH service option.

Synology Enable SSH service

Next post on the same topic might be helpful, see in How to Install Nano on Synology NAS