Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Foxx
New Contributor III

Automatically enable/ disable Policy using script

Hi all,

 

I'm looking for a solution to automatically enable/ disable a Policy using script.

Background:  

We have a invoicing system on a Windows VM with a web interface for access on PC's in our local network.

The invoicing system creates an automatic backup and sent the backup to our company cloud. 

One policy allows the invoicing VB to access the internet.

However, for security reason it is not necessary for the VM to have 24/7 internet access and the invoicing system works great without the policy enabled. The backup of the invoicing system takes about 10 min. 

We would like to use a script or other steps to turn off the policy and back on for the time the system does the backup and upload the backup to our cloud.

Is that possible or is there a other way?

 

Many thanks in advance

 

2 REPLIES 2
jintrah_FTNT
Staff
Staff

Hi,

 

If the backup always occurs at fixed time during the day, you can device a schedule in the policy itself which makes the policy active during the scheduled time.

 

jintrah_FTNT_0-1663913896052.png

 

config firewall policy
edit 0
set srcintf "lan"
set dstintf "wan"
set srcaddr "VM_Invoicing_System"
set dstaddr "all"
set action accept
set schedule "Everyday-0900-0915"
set schedule-timeout enable
set service "ALL"
set nat enable
next
end

 

best regards,

Jin

Foxx
New Contributor III

Hi Jin,

 

This works like charming. Thank you very much :)

Top Kudoed Authors