FortiClient
FortiClient proactively defends against advanced attacks. Its tight integration with the Security Fabric enables policy-based automation to contain threats and control outbreaks. FortiClient is compatible with Fabric-Ready partners to further strengthen enterprises’ security posture.
jkoay
Staff
Staff
Article Id 190673

Description

 

This article describes the feature auto running script when connected to VPN.

 

This feature supports auto running a user-defined script after the configured VPN tunnel is connected or disconnected.
The script are batch scripts in Windows and shell scripts in macOS.

There are defined as part of a VPN tunnel configuration on EMS’s XML format FortiClient profile.
The profile is pushed down to FortiClient from EMS.
When FortiClient VPN tunnel is connected, script is executed.

Solution

 

In FortiClient EMS, access to Endpoint Profiles -> Remote Access Profile and Select <endpoint profile>.
On the top right corner, select 'XML tab'.

 

XML1.png

 

Then 'Edit' button.

 

XML3.png

 

Once finished editing the XML it is possible to save the changes with the 'Save' Button.

 

XML4.png
Select 'Edit' and search for the following <on_connect> tag.


XML2.png
The following is an example of configuring FortiClient to execute batch files when the VPN is connected:

 

<on_connect>
<script>
<os>windows</os>
<script>
<![CDATA[\\WIN-ADMIN\\netlogon\\logon.bat]]>
</script>
</script>
</on_connect>