![Fortinet FortiGate Voice 4.0 MR1 Administration Manual Download Page 60](http://html1.mh-extra.com/html/fortinet/fortigate-voice-4-0-mr1/fortigate-voice-4-0-mr1_administration-manual_2322091060.webp)
Setting and monitoring a security policy
Using the FortiClient API
FortiClient Endpoint Security Version 4.0 MR1 Administration Guide
54
04-40001-99556-20090626
http://docs.fortinet.com/
•
Feedback
Setting a security policy
The SetPolicy method passes four boolean values, one for each feature: antivirus,
antispam, firewall, and web filter. If the value is True, the policy requires that the feature is
enabled. It is quite easy to create a check box for each of the boolean values and call
SetPolicy in response to the user selecting a “Set Policy” button.
In this example, check boxes are named for the features (AVcheck for the antivirus check
box, for example) and the “Set Policy” button is named SetSecPolicy.
Private Sub SetSecPolicy_Click()
VPN1.SetPolicy AVcheck.Value, AScheck.Value, FWcheck.Value,
WFcheck.Value
The FortiClient application receives the policy but does not change any settings. The
FortiClient General tab and system tray menu show the option “Make compliant with
corporate policy”.
If you want to programmatically make the FortiClient settings comply with the policy you
set, you must use the MakeSystemPolicyCompliant method.
Reading a security policy
You can retrieve the security policy from the FortiClient application with the GetPolicy
method. This returns four boolean values, one for each feature: antivirus, antispam,
firewall, and web filter. If the value is True, the policy requires that the feature is enabled. If
all four values are False, there is no security policy.
This example uses the returned boolean values to set check boxes named for the features
(AVcheck for the antivirus check box, for example).
VPN1.GetPolicy a, b, c, d
AVcheck.Value = Int(a)
If b Then
AScheck.Value = 1
Else
AScheck.Value = 0
End If
If c Then
FWcheck.Value = 1
Else
FWcheck.Value = 0
End If
If d Then
WFcheck.Value = 1
Else
WFcheck.Value = 0
End If
The check boxes show the state of each feature in the policy. You could then make
changes to the policy and set them using the SetPolicy method, as shown in
“Setting a
security policy” on page 54
.
Monitoring policy compliance
The FortiClient API includes event calls for which you write appropriate code. Using
events, you can provide live status information for users. The OnOutOfCompliance event
returns four boolean values, one for each feature. A value of True indicates that the
feature is not in compliance with the policy.